Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6f975db

Browse filesBrowse files
panvaaduh95
authored andcommitted
crypto: fix importKey required argument count check
PR-URL: #62099 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 5198573 commit 6f975db
Copy full SHA for 6f975db

2 files changed

+9-1Lines changed: 9 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/webcrypto.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/webcrypto.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ async function importKey(
865865

866866
webidl ??= require('internal/crypto/webidl');
867867
const prefix = "Failed to execute 'importKey' on 'SubtleCrypto'";
868-
webidl.requiredArguments(arguments.length, 4, { prefix });
868+
webidl.requiredArguments(arguments.length, 5, { prefix });
869869
format = webidl.converters.KeyFormat(format, {
870870
prefix,
871871
context: '1st argument',
Collapse file

‎test/parallel/test-webcrypto-export-import.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-webcrypto-export-import.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,11 @@ if (!process.features.openssl_is_boringssl) {
435435
subtle.importKey('jwk', jwk, { name: 'HMAC', hash: 'SHA3-256' }, false, ['sign', 'verify']).then(common.mustCall());
436436
}
437437
}
438+
439+
{
440+
const keyData = new Uint8Array(32);
441+
assert.rejects(
442+
subtle.importKey('raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false),
443+
{ code: 'ERR_MISSING_ARGS' }
444+
).then(common.mustCall());
445+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.