deriveKeyFromPassword method

Future<SecretKey> deriveKeyFromPassword({
  1. required String password,
  2. required List<int> nonce,
})
inherited

Generates a new secret key from a password and a nonce.

The nonce (also called a "salt") should be some random sequence of bytes. Nonce does not need to be protected.

If possible, you should have a different nonce for each password. For example, if you are doing server-side password hashing, this could mean generating a random 32-byte nonce and storing it in the database along with the hashed password.

The default implementation encodes the string using utf8 and calls deriveKey.

Implementation

Future<SecretKey> deriveKeyFromPassword({
  required String password,
  required List<int> nonce,
}) async {
  return deriveKey(
    secretKey: SecretKey(utf8.encode(password)),
    nonce: nonce,
  );
}