* OTP values are stored as `"code:attempts"` (e.g. `"654321:0"`). * This keeps the attempt counter in the same key/row as the OTP itself.
(otp: string, attempts: number)
| 60 | * This keeps the attempt counter in the same key/row as the OTP itself. |
| 61 | */ |
| 62 | function encodeOTPValue(otp: string, attempts: number): string { |
| 63 | return `${otp}:${attempts}` |
| 64 | } |
| 65 | |
| 66 | export function decodeOTPValue(value: string): { otp: string; attempts: number } { |
| 67 | const lastColon = value.lastIndexOf(':') |
no outgoing calls
no test coverage detected