(length: number)
| 67 | } |
| 68 | |
| 69 | function randomBase62(length: number): string { |
| 70 | const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |
| 71 | const bytes = getRandomBytes(length) |
| 72 | let result = "" |
| 73 | for (let i = 0; i < length; i += 1) { |
| 74 | result += chars[bytes[i] % 62] |
| 75 | } |
| 76 | return result |
| 77 | } |
| 78 | |
| 79 | function getRandomBytes(length: number): Uint8Array { |
| 80 | const bytes = new Uint8Array(length) |
no test coverage detected