(text: string)
| 37 | } |
| 38 | |
| 39 | function base64UrlDecode(text: string): Uint8Array | null { |
| 40 | try { |
| 41 | const binary = atob(text.replace(/-/g, '+').replace(/_/g, '/')); |
| 42 | const bytes = new Uint8Array(binary.length); |
| 43 | for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i); |
| 44 | return bytes; |
| 45 | } catch { |
| 46 | return null; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Importing the HMAC key costs a round through WebCrypto; cache it per isolate. |
| 51 | // A secret rotation ships a new deployment, which means new isolates. |