MCPcopy Create free account
hub / github.com/cloudflare/wildebeest / fetchKey

Function fetchKey

backend/src/utils/httpsigjs/verifier.ts:21–33  ·  view source on GitHub ↗
(parsedSignature: ParsedSignature)

Source from the content-addressed store, hash-verified

19}
20
21export async function fetchKey(parsedSignature: ParsedSignature): Promise<CryptoKey | null> {
22 const url = parsedSignature.keyId
23 const res = await fetch(url, {
24 headers: { Accept: 'application/activity+json' },
25 })
26 if (!res.ok) {
27 console.warn(`failed to fetch keys from "${url}", returned ${res.status}.`)
28 return null
29 }
30
31 const parsedResponse = (await res.json()) as Profile
32 return importPublicKey(parsedResponse.publicKey.publicKeyPem)
33}

Callers 1

onRequestFunction · 0.90

Calls 2

importPublicKeyFunction · 0.90
fetchFunction · 0.50

Tested by

no test coverage detected