MCPcopy Create free account
hub / github.com/CapSoftware/Cap / hashKey

Function hashKey

apps/web/lib/developer-key-hash.ts:19–30  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

17}
18
19export 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}

Callers 4

regenerateDeveloperKeysFunction · 0.90
createDeveloperAppFunction · 0.90
utils.tsFile · 0.90

Calls 1

getHmacKeyFunction · 0.85

Tested by

no test coverage detected