()
| 35 | const bytes = new Uint8Array(32); |
| 36 | crypto.getRandomValues(bytes); |
| 37 | return Array.from(bytes) |
| 38 | .map(b => b.toString(16).padStart(2, '0')) |
| 39 | .join(''); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Verify a token against stored token using timing-safe comparison |
| 44 | */ |
| 45 | export function verifyToken(providedToken: string, storedToken: string): boolean { |
| 46 | return timingSafeEqual(providedToken, storedToken); |
no test coverage detected