Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output both CJS & ESM #380

Closed
wants to merge 11 commits into from
22 changes: 15 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1
orbs:
ship: auth0/[email protected]
codecov: codecov/codecov@3

jobs:
build:
parameters:
Expand All @@ -15,22 +15,30 @@ jobs:
LANG: en_US.UTF-8
steps:
- checkout

- ship/node-install-packages

- run:
name: Run Linter
command: npm run lint

- run:
name: Run Tests
command: npm run test:ci


- run:
name: Check source typings
command: npm run types:check

- run:
name: Check built typings
command: npm run build:check

- store_artifacts:
path: ./coverage/<< parameters.node-version >>/lcov-report

- codecov/upload

workflows:
build-and-test:
jobs:
Expand Down
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.ts

# Build output
dist
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"parserOptions": {
"ecmaVersion": 2018
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": [2, "always"],
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,26 @@ jobs:
key: 18-${{ env.CACHE_KEY }}

- run: npm run lint

types:
needs: build # Require build to complete before running tests

name: Check source and built types
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- uses: actions/cache/restore@v3
with:
path: .
key: 18-${{ env.CACHE_KEY }}

- run: npm run types:check

- run: npm run build:check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ node_modules
.node_repl_history

# Build output
dist
lib
!src/lib
ts-output
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@

Using [npm](https://npmjs.org) in your project directory run the following command:

````bash
```bash
npm install --save jwks-rsa
````
```

Supports all currently registered JWK types and JWS Algorithms, see [panva/jose#262](https://github.com/panva/jose/issues/262) for more information.

### Configure the client

Provide a JWKS endpoint which exposes your signing keys.

````js
const jwksClient = require('jwks-rsa');
```js
const { JwksClient } = require('jwks-rsa');

const client = jwksClient({
const client = new JwksClient({
jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json',
requestHeaders: {}, // Optional
timeout: 30000 // Defaults to 30s
});
````
```

### Retrieve a key

Then use `getSigningKey` to retrieve a signing key that matches a specific `kid`.

````js
```js
const kid = 'RkI5MjI5OUY5ODc1N0Q4QzM0OUYzNkVGMTJDOUEzQkFCOTU3NjE2Rg';
const key = await client.getSigningKey(kid);
const signingKey = key.getPublicKey();
````
```

## Feedback

Expand Down
130 changes: 0 additions & 130 deletions index.d.ts

This file was deleted.

Loading
Loading