(value: string)
| 450 | type DecodedBase64Body = { readonly ok: true; readonly bytes: Uint8Array } | { readonly ok: false }; |
| 451 | |
| 452 | const base64ToUint8Array = (value: string): Uint8Array | null => { |
| 453 | let binary = ""; |
| 454 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: atob throws for invalid base64; invalid shapes are treated as non-byte input |
| 455 | try { |
| 456 | binary = atob(normalizeBase64(value, "base64")); |
| 457 | } catch { |
| 458 | return null; |
| 459 | } |
| 460 | const bytes = new Uint8Array(binary.length); |
| 461 | for (let index = 0; index < binary.length; index += 1) { |
| 462 | bytes[index] = binary.charCodeAt(index); |
| 463 | } |
| 464 | return bytes; |
| 465 | }; |
| 466 | |
| 467 | const decodeBase64Body = (value: string): DecodedBase64Body => { |
| 468 | const bytes = base64ToUint8Array(value); |
no test coverage detected