crypto: use WebIDL converters in WebCryptoAPI#46067
Merged
nodejs-github-bot merged 27 commits intonodejs:mainfrom Jan 17, 2023
Merged
crypto: use WebIDL converters in WebCryptoAPI#46067nodejs-github-bot merged 27 commits intonodejs:mainfrom
nodejs-github-bot merged 27 commits intonodejs:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is currently the case that what works in Node.js webcrypto will most likely work in every browser's webcrypto as well.
This PR makes the other direction work as well.
Our built in validators are just too strict and intervene in cases when WebCryptoAPI through use of WebIDL should successfully coerse a value.
This is a semver-majorPRs that contain breaking changes and should be released in the next major version.
change because:
BufferSourceinputs and optionsExample errors generated through the webcrypto specific webidl
I would also love to hide all stack traces from all functions in
lib/internal/crypto/webidl.jsand also ones stemming from thenormalizeAlgorithmfunction inlib/internal/crypto/util.js.I've tried my best using the utils exported from
lib/internal/errors.jsbut it lead nowhere, all it did was rename the functions in the trace but they remained visible.If you have an idea how to do this please reach out to me on the OpenJS Foundation slack. Probably not required for the PR to land though.
notable-changePRs with changes that should be highlighted in changelogs.
summary
WebCryptoAPI functions' arguments are now coersed and validated as per their WebIDL definitions like in other Web Crypto API implementations. This further improves interoperability with other implementations of Web Crypto API.