Files
orca/src/shared/browser-certificate-errors.ts
T
Jinjing e074bc3f05 Gate certificate trust proceed action on runtime capability (#9070)
Only offer 'Proceed Anyway (Unsafe)' if the connected remote runtime
advertises browser.certificate-trust.v1 support. Older runtimes cannot
honor the request and would fail silently, creating a false affordance.

Centralize certificate error normalization to prevent divergence
between main and renderer certificate matching, and unify URL redaction
for Kagi session token stripping across load-error paths.
2026-07-18 23:40:01 -07:00

20 lines
737 B
TypeScript

// Why: use Chromium's exact certificate codes so unrelated network failures
// never receive certificate-specific recovery copy.
const CHROMIUM_CERTIFICATE_ERROR_CODES = new Set([
-200, -201, -202, -203, -204, -205, -206, -207, -208, -210, -211, -212, -213, -214, -217, -219
])
export function isChromiumCertificateErrorCode(code: number): boolean {
return CHROMIUM_CERTIFICATE_ERROR_CODES.has(code)
}
// Why: main (certificate-error handler) and the renderer overlay both compare
// Chromium error strings; keep one normalizer so their challenge-matching can
// never silently diverge.
export function normalizeCertificateError(error: string): string {
return error
.trim()
.replace(/^net::/i, '')
.toUpperCase()
}