Repository navigation
Node.js failing ECDH and ECDSA importKey() WPT #55090
Copy link
Copy link
Closed
Labels
web-standardsIssues and PRs related to web-platform APIs and standards compliance.Issues and PRs related to web-platform APIs and standards compliance.webcryptoIssues and PRs related to the Web Crypto API.Issues and PRs related to the Web Crypto API.
Description
Activity
- addedwebcryptoIssues and PRs related to the Web Crypto API.Issues and PRs related to the Web Crypto API.web-standardsIssues and PRs related to web-platform APIs and standards compliance.Issues and PRs related to web-platform APIs and standards compliance.
on Sep 23, 2024 Possible fix?
A possible fix is the following diff, but I'm not a webcrypto expert:
diff --git a/lib/internal/crypto/webidl.js b/lib/internal/crypto/webidl.js index ee9b7b69b7..a927fe877b 100644 --- a/lib/internal/crypto/webidl.js +++ b/lib/internal/crypto/webidl.js @@ -317,7 +317,7 @@ converters.KeyFormat = createEnumConverter('KeyFormat', [ 'pkcs8', 'spki', 'jwk', -]); +], 'DataError'); converters.KeyUsage = createEnumConverter('KeyUsage', [ 'encrypt', @@ -328,7 +328,7 @@ converters.KeyUsage = createEnumConverter('KeyUsage', [ 'deriveBits', 'wrapKey', 'unwrapKey', -]); +], 'DataError'); converters['sequence<KeyUsage>'] = createSequenceConverter(converters.KeyUsage); diff --git a/lib/internal/webidl.js b/lib/internal/webidl.js index 9e4b20435b..e811b0e8d0 100644 --- a/lib/internal/webidl.js +++ b/lib/internal/webidl.js @@ -204,7 +204,7 @@ function makeException(message, opts = kEmptyObject) { ); } -function createEnumConverter(name, values) { +function createEnumConverter(name, values, errorName = 'TypeError') { const E = new SafeSet(values); return function(V, opts = kEmptyObject) { @@ -213,7 +213,7 @@ function createEnumConverter(name, values) { if (!E.has(S)) { throw makeException( `value '${S}' is not a valid enum value of type ${name}.`, - { __proto__: null, ...opts, code: 'ERR_INVALID_ARG_VALUE' }); + { __proto__: null, ...opts, code: 'ERR_INVALID_ARG_VALUE', name: errorName }); } return S;
- Reacted by Aviv Keller
Metadata
Metadata
Assignees
Labels
web-standardsIssues and PRs related to web-platform APIs and standards compliance.Issues and PRs related to web-platform APIs and standards compliance.webcryptoIssues and PRs related to the Web Crypto API.Issues and PRs related to the Web Crypto API.
Node.js is failing the WPT tests added by web-platform-tests/wpt#48243
All the errors appear to be
expected "DataError" but got "TypeError", so it looks like Node.js is returning the wrong errors.Ref: https://developer.mozilla.org/en-US/docs/Web/API/DOMException#dataerror