(key: string)
| 17 | } |
| 18 | |
| 19 | export async function hashKey(key: string): Promise<string> { |
| 20 | const hmacKey = await getHmacKey(); |
| 21 | const encoder = new TextEncoder(); |
| 22 | const signature = await crypto.subtle.sign( |
| 23 | "HMAC", |
| 24 | hmacKey, |
| 25 | encoder.encode(key), |
| 26 | ); |
| 27 | return Array.from(new Uint8Array(signature)) |
| 28 | .map((b) => b.toString(16).padStart(2, "0")) |
| 29 | .join(""); |
| 30 | } |
no test coverage detected