{"record":{"id":"c458dae85fbf4407","repo":"garrytan/gstack","slug":"v20-encryption","errorCode":"v20_encryption","errorMessage":"Cookie uses App-Bound Encryption (v20). Use CDP extraction instead.","messagePattern":"Cookie uses App-Bound Encryption \\(v20\\)\\. Use CDP extraction instead\\.","errorType":"exception","errorClass":"CookieImportError","httpStatus":null,"severity":"error","filePath":"browse/src/cookie-import-browser.ts","lineNumber":686,"sourceCode":"  expires_utc: number | bigint;\n  is_secure: number;\n  is_httponly: number;\n  has_expires: number;\n  samesite: number;\n}\n\nfunction decryptCookieValue(row: RawCookie, keys: Map<string, Buffer>, platform: BrowserPlatform): string {\n  // Prefer unencrypted value if present\n  if (row.value && row.value.length > 0) return row.value;\n\n  const ev = Buffer.from(row.encrypted_value);\n  if (ev.length === 0) return '';\n\n  const prefix = ev.slice(0, 3).toString('utf-8');\n\n  // Chrome 127+ on Windows uses App-Bound Encryption (v20) — cannot be decrypted\n  // outside the Chrome process. Caller should fall back to CDP extraction.\n  if (prefix === 'v20') throw new CookieImportError(\n    'Cookie uses App-Bound Encryption (v20). Use CDP extraction instead.',\n    'v20_encryption',\n  );\n\n  const key = keys.get(prefix);\n  if (!key) throw new Error(`No decryption key available for ${prefix} cookies`);\n\n  if (platform === 'win32' && prefix === 'v10') {\n    // Windows: AES-256-GCM — structure: v10(3) + nonce(12) + ciphertext + tag(16)\n    const nonce = ev.slice(3, 15);\n    const tag = ev.slice(ev.length - 16);\n    const ciphertext = ev.slice(15, ev.length - 16);\n    const decipher = crypto.createDecipheriv('aes-256-gcm', key, nonce) as crypto.DecipherGCM;\n    decipher.setAuthTag(tag);\n    return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf-8');\n  }\n\n  // macOS / Linux: AES-128-CBC — structure: v10/v11(3) + ciphertext","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/cookie-import-browser.ts#L668-L704","documentation":"Error \"Cookie uses App-Bound Encryption (v20). Use CDP extraction instead.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/cookie-import-browser.ts:686 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}