(value: string)
| 64 | } |
| 65 | |
| 66 | export function decodeOTPValue(value: string): { otp: string; attempts: number } { |
| 67 | const lastColon = value.lastIndexOf(':') |
| 68 | if (lastColon === -1) return { otp: value, attempts: 0 } |
| 69 | const attempts = Number.parseInt(value.slice(lastColon + 1), 10) |
| 70 | return { otp: value.slice(0, lastColon), attempts: Number.isNaN(attempts) ? 0 : attempts } |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Stores an OTP for a deployment+email pair, choosing Redis or the |
no outgoing calls
no test coverage detected