Skip to content

Commit 60a30c3

Browse files
committed
Add rollup and update README
1 parent ffc3bf0 commit 60a30c3

File tree

7 files changed

+7251
-17
lines changed

7 files changed

+7251
-17
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ npm install --save jwks-rsa
2525

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

28+
Note latest version will require node@^20.19.0 or node@^22.12.0 or newer.
29+
2830
### Configure the client
2931

3032
Provide a JWKS endpoint which exposes your signing keys.
@@ -49,6 +51,36 @@ const key = await client.getSigningKey(kid);
4951
const signingKey = key.getPublicKey();
5052
````
5153

54+
## Known Issues
55+
56+
### Workaround Jest ESM issue
57+
58+
Downstream repositories using Jest may not support ESM fully.
59+
60+
One way to work around this issue is to add the following to your `jest.config.ts`:
61+
62+
```
63+
moduleNameMapper: {
64+
'^jwks-rsa$': '<rootDir>/__mocks__/jwks-rsa.ts',
65+
},
66+
```
67+
68+
and add the `__mocks__/jwks-rsa.ts` file with the following content:
69+
70+
```ts
71+
// Provide a fake implementation of the secret provider, repeat for other methods that your app imports from jwks-rsa
72+
export const passportJwtSecret = jest.fn(() => {
73+
// return a fake key provider function
74+
return (req: any, header: any, cb: any) => {
75+
cb(null, 'fake-secret')
76+
}
77+
})
78+
79+
export default {
80+
passportJwtSecret,
81+
}
82+
```
83+
5284
## Feedback
5385

5486
### Contributing

0 commit comments

Comments
 (0)