(value: string)
| 484 | type DecodedBase64Body = { readonly ok: true; readonly bytes: Uint8Array } | { readonly ok: false }; |
| 485 | |
| 486 | const base64ToUint8Array = (value: string): Uint8Array | null => { |
| 487 | let binary = ""; |
| 488 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: atob throws for invalid base64; invalid shapes are treated as non-byte input |
| 489 | try { |
| 490 | binary = atob(normalizeBase64(value, "base64")); |
| 491 | } catch { |
| 492 | return null; |
| 493 | } |
| 494 | const bytes = new Uint8Array(binary.length); |
| 495 | for (let index = 0; index < binary.length; index += 1) { |
| 496 | bytes[index] = binary.charCodeAt(index); |
| 497 | } |
| 498 | return bytes; |
| 499 | }; |
| 500 | |
| 501 | const decodeBase64Body = (value: string): DecodedBase64Body => { |
| 502 | const bytes = base64ToUint8Array(value); |
no test coverage detected