Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

24 changes: 16 additions & 8 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,32 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x, 22.x]

steps:
- name: Repository checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.8.1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install latest npm
run: npm install -g npm
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Run lint
run: npm run lint
run: pnpm lint

- name: Run build
run: npm run build
run: pnpm build

- name: Run tests
run: npm run test:coverage
run: pnpm test:coverage

- name: Code coverage
uses: codecov/codecov-action@v1
14 changes: 8 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3.8.1
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm run test
- run: pnpm install
- run: pnpm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3.8.1
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm publish --access public
- run: pnpm install
- run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-manager-strict=false
4 changes: 0 additions & 4 deletions .prettierrc.js

This file was deleted.

16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ Duo especially thanks [Lukas Hroch](https://github.com/lukashroch) for creating

## Getting Started

This library requires Node.js v14 or later.
This library requires Node.js LTS (v20 or later).

To use this client in your existing developing environment, install it from NPM
To use this client in your existing developing environment, install it with your package manager of choice.

```sh
npm install @duosecurity/duo_universal

pnpm add @duosecurity/duo_universal

yarn add @duosecurity/duo_universal
```

Once it's installed, see our developer documentation at https://duo.com/docs/duoweb and the `example` folder in this repo for guidance on integrating Duo 2FA into your web application.
Expand Down Expand Up @@ -68,7 +72,7 @@ const state = client.generateState();
Creates authentication URL to redirect user to Duo Security Universal prompt. Provide user identifier and state generated in previous step.

```ts
const authUrl = client.createAuthUrl('username', 'state');
const authUrl = await client.createAuthUrl('username', 'state');
```

### 6. Token & code exchange
Expand All @@ -92,19 +96,19 @@ Fork the repository
Install dependencies

```sh
npm install
pnpm install
```

Make your proposed changes. Add tests if applicable, lint the code. Submit a pull request.

## Tests

```sh
npm run test
pnpm run test
```

## Lint

```sh
npm run lint
pnpm run lint
```
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
{
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }],
},
},
);
15 changes: 0 additions & 15 deletions example/.eslintrc.js

This file was deleted.

7 changes: 1 addition & 6 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ Navigate to example folder
cd duo_universal_nodejs/example
```

Install dependencies
```
npm install
```

## Run the application

1. Copy the Client ID, Client Secret, and API Hostname values for your Web SDK application into `src/config.js`

2. Start the application
```
npm run start
pnpm start
```

3. Navigate to http://localhost:3000
Expand Down
Loading
Loading