( receivedHash: string, fingerprintId: string, expiresAt: string, secret: string, )
| 142 | } |
| 143 | |
| 144 | export function validateAuthCode( |
| 145 | receivedHash: string, |
| 146 | fingerprintId: string, |
| 147 | expiresAt: string, |
| 148 | secret: string, |
| 149 | ): { valid: boolean; expectedHash: string } { |
| 150 | const expectedHash = genAuthCode(fingerprintId, expiresAt, secret) |
| 151 | return { valid: receivedHash === expectedHash, expectedHash } |
| 152 | } |
| 153 | |
| 154 | export function isAuthCodeExpired(expiresAt: string): boolean { |
| 155 | const expiresAtMs = Number(expiresAt) |
no test coverage detected