(length: number)
| 39 | } |
| 40 | |
| 41 | function randomBase62(length: number): string { |
| 42 | const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |
| 43 | let result = "" |
| 44 | const bytes = randomBytes(length) |
| 45 | for (let i = 0; i < length; i++) { |
| 46 | result += chars[bytes[i] % 62] |
| 47 | } |
| 48 | return result |
| 49 | } |
| 50 | |
| 51 | export function create(prefix: string, direction: "descending" | "ascending", timestamp?: number): string { |
| 52 | const currentTimestamp = timestamp ?? Date.now() |