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

Function test

test/parallel/test-webcrypto-sign-verify.js:18–34  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

16// Test Sign/Verify RSASSA-PKCS1-v1_5
17{
18 async function test(data) {
19 const ec = new TextEncoder();
20 const { publicKey, privateKey } = await subtle.generateKey({
21 name: 'RSASSA-PKCS1-v1_5',
22 modulusLength: 1024,
23 publicExponent: new Uint8Array([1, 0, 1]),
24 hash: 'SHA-256'
25 }, true, ['sign', 'verify']);
26
27 const signature = await subtle.sign({
28 name: 'RSASSA-PKCS1-v1_5'
29 }, privateKey, ec.encode(data));
30
31 assert(await subtle.verify({
32 name: 'RSASSA-PKCS1-v1_5'
33 }, publicKey, signature, ec.encode(data)));
34 }
35
36 test('hello world').then(common.mustCall());
37}

Callers 1

Calls 3

encodeMethod · 0.95
assertFunction · 0.50
verifyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…