(value: string)
| 1 | export function base64Encode(value: string) { |
| 2 | const bytes = new TextEncoder().encode(value) |
| 3 | const binary = Array.from(bytes, (b) => String.fromCharCode(b)).join("") |
| 4 | return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "") |
| 5 | } |
| 6 | |
| 7 | export function base64Decode(value: string) { |
| 8 | const binary = atob(value.replace(/-/g, "+").replace(/_/g, "/")) |