MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / hmacSha256

Function hmacSha256

utils/s3.ts:83–86  ·  view source on GitHub ↗
(key: ArrayBuffer | Uint8Array | string, value: string)

Source from the content-addressed store, hash-verified

81}
82
83async 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
88function makeRandomHex(length = 16): string {
89 const bytes = new Uint8Array(length);

Callers 1

uploadToS3Function · 0.85

Calls 1

toArrayBufferFunction · 0.85

Tested by

no test coverage detected