-
Notifications
You must be signed in to change notification settings - Fork 236
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
fix: types-compabitility for express-jwt @ 7 #301
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,7 @@ | ||||||
import * as jwksRsaType from '../index'; | ||||||
import {expect} from 'chai'; | ||||||
import expressjwt6 from "express-jwt"; | ||||||
import { expressjwt as expressjwt7, GetVerificationKey } from "express-jwt-v7"; | ||||||
const { jwksEndpoint } = require('../tests/mocks/jwks'); | ||||||
const { publicKey } = require('../tests/mocks/keys'); | ||||||
const jwksRsa: typeof jwksRsaType = require('../src'); | ||||||
|
@@ -24,7 +26,7 @@ describe('typescript definition', () => { | |||||
}); | ||||||
}); | ||||||
|
||||||
describe('getKeysInterceptor', async () => { | ||||||
it('getKeysInterceptor', async () => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spotting this, looks like you've uncovered a failing test. Could you replace |
||||||
const keySetResponse = { | ||||||
keys: [ | ||||||
{ | ||||||
|
@@ -44,4 +46,22 @@ describe('typescript definition', () => { | |||||
const key = await client.getSigningKey('NkFCNEE1NDFDNTQ5RTQ5OTE1QzRBMjYyMzY0NEJCQTJBMjJBQkZCMA'); | ||||||
expect(key.kid).to.equal('NkFCNEE1NDFDNTQ5RTQ5OTE1QzRBMjYyMzY0NEJCQTJBMjJBQkZCMA'); | ||||||
}); | ||||||
|
||||||
it.skip('Types-Only Validation with express-jwt', () => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a I've removed the skip marker in c98ac1f I've purposely not duplicated the test suite from |
||||||
expressjwt6({ | ||||||
algorithms: ["RS256"], | ||||||
secret: jwksRsa.expressJwtSecret({ | ||||||
cache: true, | ||||||
jwksUri: `https://my-authz-server/.well-known/jwks.json` | ||||||
}) | ||||||
}); | ||||||
|
||||||
expressjwt7({ | ||||||
algorithms: ['RS256'], | ||||||
secret: jwksRsa.expressJwtSecret({ | ||||||
cache: true, | ||||||
jwksUri: `https://my-authz-server/.well-known/jwks.json` | ||||||
}) as GetVerificationKey | ||||||
}); | ||||||
}) | ||||||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes jwks-rsa only compatible with Typescript 3.8+ as the type-only imports and exports feature was release with TS 3.8. For one of my projects, we are on TS 3.7.3, which means this breaks our compatibility
Also - this line is missing a semicolon :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, my bad.
Internally, I'd say update typescript on the project.
If that's not possible, then you may want to open a merge request to address that issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem - we just attempted to upgrade and ran into a couple of other issues. We will be putting up a pull request soon!