MCPcopy
hub / github.com/codeaashu/claude-code / decrypt

Method decrypt

src/server/web/auth/adapter.ts:198–210  ·  view source on GitHub ↗

Decrypts a value produced by encrypt. Returns null on failure.

(encoded: string)

Source from the content-addressed store, hash-verified

196
197 /** Decrypts a value produced by {@link encrypt}. Returns null on failure. */
198 decrypt(encoded: string): string | null {
199 try {
200 const buf = Buffer.from(encoded, "base64url");
201 const iv = buf.subarray(0, 12);
202 const tag = buf.subarray(12, 28);
203 const ciphertext = buf.subarray(28);
204 const decipher = createDecipheriv("aes-256-gcm", this.key, iv);
205 decipher.setAuthTag(tag);
206 return decipher.update(ciphertext).toString("utf8") + decipher.final("utf8");
207 } catch {
208 return null;
209 }
210 }
211
212 // ── Internals ─────────────────────────────────────────────────────────────
213

Callers 1

authenticateMethod · 0.80

Calls 2

toStringMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected