MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / deriveSigningKey

Function deriveSigningKey

packages/filesystem/s3/client.ts:44–54  ·  view source on GitHub ↗

派生 AWS Signature V4 签名密钥

(
  secretKey: string,
  dateStamp: string,
  region: string,
  service: string
)

Source from the content-addressed store, hash-verified

42
43/** 派生 AWS Signature V4 签名密钥 */
44async function deriveSigningKey(
45 secretKey: string,
46 dateStamp: string,
47 region: string,
48 service: string
49): Promise<ArrayBuffer> {
50 const kDate = await hmacSha256(new TextEncoder().encode(`AWS4${secretKey}`).buffer as ArrayBuffer, dateStamp);
51 const kRegion = await hmacSha256(kDate, region);
52 const kService = await hmacSha256(kRegion, service);
53 return hmacSha256(kService, "aws4_request");
54}
55
56// ---- URI 编码 ----
57

Callers 1

signRequestMethod · 0.85

Calls 1

hmacSha256Function · 0.85

Tested by

no test coverage detected