-
Notifications
You must be signed in to change notification settings - Fork 104
fix: add jose
compatibility, Symbol.toStringTag
values
#692
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
base: 0.x
Are you sure you want to change the base?
Conversation
@panva moving conversation from #681 to the PR
You are correct. fixed ✅
Is it? I know that's what the Node docs say. But I traced code in Node.js and it looks like the return is
Okay, I've changed hash: algorithm.hash to hash: { name: algorithm.hash } as HashAlgorithmIdentifier in this lib's There are other downstream issues with polyfills. The RNQC example app doesn't use TextEncoder/TextDecoder as of a recent change (this PR), but I guess to work with Jose, users will need to add them. When I added them back in, the Would love your thoughts on above. And thank you for your time on this issue 🙏 |
Is it? Yes. I can't say what you're tracing but crypto.generateKeyPair and crypto.generateKeyPairSync are node:crypto methods that generate node's KeyObject instances, not WebCrypto's CryptoKey.
You're linking a key gen dictionary, not the resulting crypto key one. This is a rather laborious process but you if were to read the algorithms defined in WebCryptoAPI you'd see that before the algorithm, and in the process of it some of its members like hash, are assigned to an internal [[algorithm]] slot of a CryptoKey instance they get run through a normalization algorithm. Which turns those simple string inputs into dictionaries. Input algorithm identifiers are normalized to a particular casing, only recognized properties are used, it's not as straight forward as taking the user input and assigning it to a key. The fact that it goes through normalization is why the algorithm can be used to determine what the key's for and what its parameters are.
Yeah, they're part of the standard library of any Web API implementing platform.
Those tests are likely wrong? 🤷
It seems to me the core of webcrypto's algorithm normalization functionality is not implemented in RNQC. |
You've also helped me discover a few bugs in the webcrypto docs in Node.js, when in doubt the WebCryptoAPI spec is what ought to be used as reference. |
fixes #681
fixes #683