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

Function parseAesKey

packages/weixin/src/media.ts:42–56  ·  view source on GitHub ↗
(aesKeyBase64: string)

Source from the content-addressed store, hash-verified

40}
41
42export function parseAesKey(aesKeyBase64: string): Buffer {
43 const decoded = Buffer.from(aesKeyBase64, 'base64')
44 if (decoded.length === 16) {
45 return decoded
46 }
47 if (
48 decoded.length === 32 &&
49 /^[0-9a-fA-F]{32}$/.test(decoded.toString('ascii'))
50 ) {
51 return Buffer.from(decoded.toString('ascii'), 'hex')
52 }
53 throw new Error(
54 `Invalid aes_key: expected 16 raw bytes or 32 hex chars, got ${decoded.length} bytes`,
55 )
56}
57
58export async function downloadAndDecrypt(params: {
59 encryptQueryParam: string

Callers 2

downloadAndDecryptFunction · 0.85
media.test.tsFile · 0.85

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected