mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
crypto: fix importKey required argument count check
PR-URL: https://github.com/nodejs/node/pull/62099 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
5198573bee
commit
6f975db8af
2 files changed
+9
-1
No files matched your search
@@ -865,7 +865,7 @@ async function importKey(
|
||||
|
||||
webidl ??= require('internal/crypto/webidl');
|
||||
const prefix = "Failed to execute 'importKey' on 'SubtleCrypto'";
|
||||
webidl.requiredArguments(arguments.length, 4, { prefix });
|
||||
webidl.requiredArguments(arguments.length, 5, { prefix });
|
||||
format = webidl.converters.KeyFormat(format, {
|
||||
prefix,
|
||||
context: '1st argument',
|
||||
|
||||
@@ -435,3 +435,11 @@ if (!process.features.openssl_is_boringssl) {
|
||||
subtle.importKey('jwk', jwk, { name: 'HMAC', hash: 'SHA3-256' }, false, ['sign', 'verify']).then(common.mustCall());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const keyData = new Uint8Array(32);
|
||||
assert.rejects(
|
||||
subtle.importKey('raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false),
|
||||
{ code: 'ERR_MISSING_ARGS' }
|
||||
).then(common.mustCall());
|
||||
}
|
||||
Reference in new issue
Block a user