MCPcopy
hub / github.com/claude-code-best/claude-code / downloadAndDecrypt

Function downloadAndDecrypt

packages/weixin/src/media.ts:58–70  ·  view source on GitHub ↗
(params: {
  encryptQueryParam: string
  aesKey: string
  cdnBaseUrl: string
})

Source from the content-addressed store, hash-verified

56}
57
58export async function downloadAndDecrypt(params: {
59 encryptQueryParam: string
60 aesKey: string
61 cdnBaseUrl: string
62}): Promise<Buffer> {
63 const url = buildCdnDownloadUrl(params.encryptQueryParam, params.cdnBaseUrl)
64 const response = await fetch(url)
65 if (!response.ok) {
66 throw new Error(`CDN download failed: HTTP ${response.status}`)
67 }
68 const ciphertext = Buffer.from(await response.arrayBuffer())
69 return decryptAesEcb(ciphertext, parseAesKey(params.aesKey))
70}
71
72export interface UploadedFileInfo {
73 encryptQueryParam: string

Callers 1

downloadMediaFunction · 0.85

Calls 4

buildCdnDownloadUrlFunction · 0.85
fetchFunction · 0.85
decryptAesEcbFunction · 0.85
parseAesKeyFunction · 0.85

Tested by

no test coverage detected