SecretWallet.encode constructor
Factory method to create a SecretWallet
with encoded credentials.
credentials
: The encoded credentials to be stored in the wallet.password
: The password used to derive the encryption key.scryptN
: Parameter 'n' for the Scrypt key derivation function (default is 8192).p
: Parameter 'p' for the Scrypt key derivation function (default is 1).
Returns a SecretWallet
instance with the encoded credentials.
Implementation
factory SecretWallet.encode(
List<int> data,
String password, {
int scryptN = 8192,
int p = 1,
}) {
final passwordBytes = StringUtils.encode(password);
final salt = QuickCrypto.generateRandom(32);
final derivator = _Scrypt(32, scryptN, 8, p, salt);
final uuid = UUID.toBuffer(UUID.generateUUIDv4());
final iv = QuickCrypto.generateRandom(128 ~/ 8);
return SecretWallet._(data, derivator, passwordBytes, iv, uuid);
}