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.

Typescript JWK Key return type issues

See original GitHub issue

Describe the bug Currently all return values regarding Keys are typed under the Key interface.

This causes that no Key type specific parameters can be accessed (for example EC Key crv value) in the return values regarding keys.

*To Reproduce

// fill with EC type public / private key
const ecTypeKey = 'EC KEY';
const key = JWK.asKey(ecTypeKey);
// This will cause an error: Property 'crv' does not exist on type 'Key'.
console.log(key.crv);

Expected behaviour Should return proper Key sub type, so parameters can be accessed

Environment:

  • jose version: [e.g. v1.22.2]
  • node version: [e.g. v13.3.0]

Additional context

  • This should be implemented to all return values regarding Key type (JWE.completeDecrypt, etc)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
panvacommented, Feb 13, 2020

This branch will land with the next 13.x node release. Planned for the 18th

0reactions
HiskiRobocommented, Feb 13, 2020

Nice solution in the commit! This can be closed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript Node.js guide for JWT signing and verifying using ...
Current guide will show how asymmetric keys approach could be used to issue signed JWT token. After this, signed token would be used...
Read more >
Type is not assignable to type 'GetVerificationKey' in express ...
So, I can't figure out the solution to this problem. This is the first time of used auth0. Anyone who can solve this...
Read more >
Building a verify JWT function in TypeScript
Verifying an RS232 signed JWT JSON Web Tokens (JWT) are used as a way to verify the identity of the caller of an...
Read more >
Building a verify JWT function in TypeScript
Verifying an RS256 signed JWT. JSON Web Tokens (JWT) are used as a way to verify the identity of the caller of an...
Read more >
RFC 7517: JSON Web Key (JWK)
"kty" values should either be registered in the IANA "JSON Web Key Types" ... reject JWK Sets with duplicate member names or use...
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