(key: ArrayBuffer | Uint8Array | string, value: string)
| 81 | } |
| 82 | |
| 83 | async function hmacSha256(key: ArrayBuffer | Uint8Array | string, value: string): Promise<ArrayBuffer> { |
| 84 | const cryptoKey = await crypto.subtle.importKey("raw", toArrayBuffer(key), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]); |
| 85 | return await crypto.subtle.sign("HMAC", cryptoKey, toArrayBuffer(value)); |
| 86 | } |
| 87 | |
| 88 | function makeRandomHex(length = 16): string { |
| 89 | const bytes = new Uint8Array(length); |
no test coverage detected