question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type definitions don't support JWK

See original GitHub issue

Type 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
lev-kuznetsovcommented, Jul 26, 2018

Is it possible to merge one of the solutions to fix this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found