MCPcopy Index your code
hub / github.com/nodejs/node / assertSameCryptoKey

Function assertSameCryptoKey

test/parallel/test-webcrypto-cryptokey-clone-transfer.js:45–60  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

43}
44
45function assertSameCryptoKey(a, b) {
46 assert.notStrictEqual(a, b);
47 assert.strictEqual(a.type, b.type);
48 assert.strictEqual(a.extractable, b.extractable);
49 assert.deepStrictEqual(a.algorithm, b.algorithm);
50 assert.deepStrictEqual([...a.usages].sort(), [...b.usages].sort());
51 assertNoOwnReflection(a);
52 assertNoOwnReflection(b);
53 // util.inspect reads native internal slots directly, so a clone's
54 // rendered form must match the original's.
55 assert.strictEqual(inspect(a, { depth: 4 }), inspect(b, { depth: 4 }));
56 // assert.deepStrictEqual on CryptoKey objects goes through the
57 // dedicated isCryptoKey branch in comparisons.js; a clone must be
58 // deep-equal to its source.
59 assert.deepStrictEqual(a, b);
60}
61
62async function roundTripViaMessageChannel(key) {
63 const { port1, port2 } = new MessageChannel();

Callers 5

checkHmacKeyFunction · 0.85
checkAsymmetricKeyPairFunction · 0.85
checkTransferToWorkerFunction · 0.85

Calls 3

assertNoOwnReflectionFunction · 0.85
sortMethod · 0.80
inspectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…