Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! crypto: do not add undefined hash in webcrypto normalizeAlgorithm
  • Loading branch information
panva committed Apr 2, 2022
commit 04e4cc868dc8ace3cb94346ded9ec0ae3a96a984
1 change: 0 additions & 1 deletion lib/internal/crypto/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ function normalizeAlgorithm(algorithm) {
throw lazyDOMException('Unrecognized name.', 'NotSupportedError');
}


function hasAnyNotIn(set, checks) {
for (const s of set)
if (!ArrayPrototypeIncludes(checks, s))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const {
} = require('internal/crypto/util');

{
// Check that normalizeAlgorithm does not add an undefined hash property
// Check that normalizeAlgorithm does not add an undefined hash property.
assert.strictEqual('hash' in normalizeAlgorithm({ name: 'ECDH' }), false);
assert.strictEqual('hash' in normalizeAlgorithm('ECDH'), false);
}

{
// Check that normalizeAlgorithm does not mutate object inputs
// Check that normalizeAlgorithm does not mutate object inputs.
const algorithm = { name: 'ECDH', hash: 'SHA-256' };
assert.strictEqual(normalizeAlgorithm(algorithm) !== algorithm, true);
assert.deepStrictEqual(algorithm, { name: 'ECDH', hash: 'SHA-256' });
Expand Down