()
| 4 | * @returns A unique id |
| 5 | */ |
| 6 | export function getUID(): string { |
| 7 | if ('randomBytes' in crypto) { |
| 8 | return crypto.randomBytes(8).toString('hex') |
| 9 | } |
| 10 | |
| 11 | const bytes = crypto.getRandomValues(new Uint8Array(8)) |
| 12 | const array = Array.from(bytes) |
| 13 | const hexPairs = array.map(b => b.toString(16).padStart(2, '0')) |
| 14 | |
| 15 | return hexPairs.join('') |
| 16 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…