toSecretStorage method
String
toSecretStorage(
- String password, {
- ExtendedKeyType semantic = ExtendedKeyType.p2pkh,
- CurrencySymbol currencySymbol = CurrencySymbol.btc,
- SecretWalletEncoding encoding = SecretWalletEncoding.json,
Converts the BIP32 hierarchical wallet data into a secure JSON representation for secret storage.
password
is the password used to encrypt the secret storage.
semantic
specifies the extended key type semantic (e.g., P2PKH).
currencySymbol
represents the currency symbol (e.g., BTC).
encoding
specifies the encoding format for the secret wallet data (e.g., JSON).
Returns a secure JSON representation of the wallet data encrypted with the provided password.
Implementation
String toSecretStorage(
String password, {
ExtendedKeyType semantic = ExtendedKeyType.p2pkh,
CurrencySymbol currencySymbol = CurrencySymbol.btc,
SecretWalletEncoding encoding = SecretWalletEncoding.json,
}) {
final toJs = _toJson(currencySymbol: currencySymbol, semantic: semantic);
final toStr = json.encode(toJs);
final secret = SecretWallet.encode(toStr, password);
return secret.encrypt(encoding: encoding);
}