(length: number)
| 44 | } |
| 45 | |
| 46 | function generateRandomString(length: number) { |
| 47 | const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~" |
| 48 | return Array.from(crypto.getRandomValues(new Uint8Array(length))) |
| 49 | .map((b) => chars[b % chars.length]) |
| 50 | .join("") |
| 51 | } |
| 52 | |
| 53 | function base64UrlEncode(buffer: ArrayBuffer) { |
| 54 | const binary = String.fromCharCode(...new Uint8Array(buffer)) |
no test coverage detected