defaultValidatePasswordHash function
The default validation password hash.
Warning: Using a custom hashing algorithm for passwords will permanently disrupt compatibility with Serverpod's password hash validation and migration.
Implementation
Future<bool> defaultValidatePasswordHash(
String password,
String email,
String hash, {
void Function({
required String passwordHash,
required String storedHash,
})? onValidationFailure,
void Function(Object e)? onError,
}) async {
try {
return await PasswordHash(
hash,
legacySalt: EmailSecrets.legacySalt,
legacyEmail: AuthConfig.current.extraSaltyHash ? email : null,
pepper: EmailSecrets.pepper,
).validate(password, onValidationFailure: onValidationFailure);
} catch (e) {
onError?.call(e);
return false;
}
}