Web3SecretStorageDefinationV3.encode constructor
Web3SecretStorageDefinationV3.encode(})
Factory method to create a Web3SecretStorageDefinationV3 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 Web3SecretStorageDefinationV3 instance with the encoded credentials.
Implementation
factory Web3SecretStorageDefinationV3.encode(
List<int> data,
String password, {
int scryptN = 8192,
int p = 1,
}) {
final passwordBytes = StringUtils.encode(password);
final salt = QuickCrypto.generateRandom(_SecretStorageConst.saltLength);
final derivator = KDFScrypt(dklen: 32, n: scryptN, r: 8, p: p, salt: salt);
final uuid = UUID.generateUUIDv4();
final iv = QuickCrypto.generateRandom(_SecretStorageConst.ivLength);
final CryptoParam crypto = CryptoParam(kdf: derivator, iv: iv);
return Web3SecretStorageDefinationV3._(crypto, passwordBytes, uuid, data);
}