KeyObject to JWK with v3 #109
Replies: 11 comments
-
See this is tricky, since Web Cryptography API has this affordance i don't feel like putting this in for the other runtime. How would you feel if, instead, there was a separate, node-specific module for KeyObject to JWK conversion? |
Beta Was this translation helpful? Give feedback.
-
I could live with that. I understand you're trying to keep the v3 API slimmed down (and coming from |
Beta Was this translation helpful? Give feedback.
-
That's a fair point. I'll see what can be done. In the meantime, there are established modules for |
Beta Was this translation helpful? Give feedback.
-
That's a good suggestion. Exporting the key and using https://npm.io/package/rsa-pem-to-jwk does what I need. |
Beta Was this translation helpful? Give feedback.
-
@youngbob i think https://www.npmjs.com/package/@trust/keyto is a more general alternative, supporting more key types. |
Beta Was this translation helpful? Give feedback.
-
Nevertheless, i'll put a util function in for KeyLike to JWK conversion |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Perfect, thanks! |
Beta Was this translation helpful? Give feedback.
-
Please consider supporting the library if it provides value to you or your company and this support was of help to you. Supporting the library means, amongst other things, that such support will be available in the future. |
Beta Was this translation helpful? Give feedback.
-
Is your feature proposal related to a problem? Please describe.
In v3, there does not seem to be any way to generate and export a key as a JWK. There is a utility to parse a JWK into a native key, but not the other way around.
Describe the solution you'd like
An
exportJwk
that takesKeyObject | CryptoKey
and returnsJWK
Describe alternatives you've considered
Stay on v2, or copy the
keyObjectToJWK
and supporting utilsAdditional context
The Web Crypto API natively supports parsing and exporting keys as JWK. The Node Crypto API does not, though.
Beta Was this translation helpful? Give feedback.
All reactions