(hashedPassword: string | undefined)
| 187 | * @returns {PasswordMethod} "SHA256" | "ARGON2" | "PLAIN_TEXT" |
| 188 | */ |
| 189 | export function getPasswordMethod(hashedPassword: string | undefined): PasswordMethod { |
| 190 | if (!hashedPassword) { |
| 191 | return "PLAIN_TEXT" |
| 192 | } |
| 193 | |
| 194 | // This is the new hashing algorithm |
| 195 | if (hashedPassword.includes("$argon")) { |
| 196 | return "ARGON2" |
| 197 | } |
| 198 | |
| 199 | // This is the legacy hashing algorithm |
| 200 | return "SHA256" |
| 201 | } |
| 202 | |
| 203 | type PasswordValidation = { |
| 204 | isPasswordValid: boolean |
no outgoing calls
no test coverage detected