* Parse a UUID string (with or without hyphens) into a 128-bit bigint.
(uuid: string)
| 34 | * Parse a UUID string (with or without hyphens) into a 128-bit bigint. |
| 35 | */ |
| 36 | function uuidToBigInt(uuid: string): bigint { |
| 37 | const hex = uuid.replace(/-/g, '') |
| 38 | if (hex.length !== 32) { |
| 39 | throw new Error(`Invalid UUID hex length: ${hex.length}`) |
| 40 | } |
| 41 | return BigInt('0x' + hex) |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Convert an account UUID to a tagged ID in the API's format. |