MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / gen_hmac

Function gen_hmac

apps/toolbox/src/pages/winter-tc.ts:48–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48async function gen_hmac() {
49 let message = 'Hello World';
50 let enc = new TextEncoder();
51 const encoded = enc.encode(message);
52
53 const key = await crypto.subtle.generateKey(
54 {
55 name: 'HMAC',
56 hash: { name: 'SHA-512' },
57 },
58 true,
59 ['sign', 'verify'],
60 );
61
62 const signature = await crypto.subtle.sign('HMAC', key, encoded);
63
64 let result = await crypto.subtle.verify('HMAC', key, signature, encoded);
65
66 console.log('gen_hmac is valid? ', result);
67}
68
69async function gen_rsa_oaep() {
70 let message = 'Hello World';

Callers 1

runFunction · 0.85

Calls 5

encodeMethod · 0.95
generateKeyMethod · 0.80
signMethod · 0.80
verifyMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected