Type definitions don't support JWK
See original GitHub issueType definitions in types/index.d.ts don’t support the documented configuration using jwks. Typical configuration looks like this:
import * as jwt from 'koa-jwt'
import * as jwks from 'jwks-rsa'
export default jwt({
secret: jwks({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: "https://foo.com/.well-known/jwks.json"
}),
audience: 'https://foo/',
issuer: "https://foo.com/",
algorithms: ['RS256']
})
And this code works in js. It’s easy enough to have a workaround with the missing audience issuer and algorithms keys but the secret is defined as sting | Buffer
I’ll happily submit a PR for the missing keys; but I’m not quite sure what to do with the secret.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Exposing KeyObject fields vs. native JWK support #26854
Another solution would be to natively support JWK. I am not an expert when it comes to JWK, but it shouldn't be difficult...
Read more >JSON Web Key (JWK) RFC 7517 - IETF Datatracker
The "kty" value is a case-sensitive string. This member MUST be present in a JWK. A list of defined "kty" values can be...
Read more >JSON Web Key Sets - Auth0
The JSON Web Key Set (JWKS) is a set of keys containing the public keys used to verify any JSON Web Token (JWT)...
Read more >JSON Web Key (JWK) - Mike Jones: self-issued
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure ... The key type definitions include specification of the members...
Read more >step crypto jwk create - Smallstep
--crv= curve , --curve= curve The elliptic curve to use for EC and OKP key types. Corresponds to the "crv" JWK parameter. Valid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is it possible to merge one of the solutions to fix this?
Fixed in https://github.com/koajs/jwt/commit/f37d5768982b06fddcf907f3edaad4f1866dc5a8