( receivedHash: string, fingerprintId: string, expiresAt: string, secret: string, )
| 121 | } |
| 122 | |
| 123 | export function validateAuthCode( |
| 124 | receivedHash: string, |
| 125 | fingerprintId: string, |
| 126 | expiresAt: string, |
| 127 | secret: string, |
| 128 | ): { valid: boolean; expectedHash: string } { |
| 129 | const expectedHash = genAuthCode(fingerprintId, expiresAt, secret) |
| 130 | return { valid: receivedHash === expectedHash, expectedHash } |
| 131 | } |
| 132 | |
| 133 | export function isAuthCodeExpired(expiresAt: string): boolean { |
| 134 | const expiresAtMs = Number(expiresAt) |
no test coverage detected