generateAuthentication method
Generates a UserAuthentication with the basePassword as the key to
pass the authentication.
Internal methodGenerator and passwordHasher are used to populate the values
Implementation
UserAuthentication generateAuthentication(
String basePassword, {
int saltLength = 64,
}) {
final authentication = UserAuthentication();
final method = methodGenerator.generateMethod();
authentication
..method = methodGenerator.encryptMethod(method)
..salt = passwordHasher.generateSalt(length: saltLength)
..password = passwordHasher.hash(
password: basePassword,
salt: authentication.salt,
method: methodGenerator.decryptMethod(authentication.method),
);
return authentication;
}