(base64: Base64)
| 11 | |
| 12 | // https://web.dev/articles/base64-encoding#btoa_and_atob_with_unicode |
| 13 | export function base64ToArray(base64: Base64): Uint8Array<ArrayBuffer> { |
| 14 | const binString = atob(base64) |
| 15 | return Uint8Array.from(binString, (m) => m.codePointAt(0)!) |
| 16 | } |
| 17 | |
| 18 | export function toBase64URL(base64: Base64): Base64Url { |
| 19 | return base64.replaceAll('+', '-').replaceAll('/', '_') as Base64Url |
no outgoing calls
no test coverage detected