mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
Qr code passphrase restoration flow fix (#1694)
* add passphrase to credentials * prevent double restoring * fix conflict, simplify restricting user from tapping restore multiple times --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -56,12 +56,8 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
|
||||
WalletCredentials getCredentialsFromRestoredWallet(
|
||||
dynamic options, RestoredWallet restoreWallet) {
|
||||
final password = generateWalletPassword();
|
||||
String? passphrase;
|
||||
|
||||
DerivationInfo? derivationInfo;
|
||||
if (options != null) {
|
||||
derivationInfo = options["derivationInfo"] as DerivationInfo?;
|
||||
passphrase = options["passphrase"] as String?;
|
||||
}
|
||||
derivationInfo ??= getDefaultCreateDerivation();
|
||||
|
||||
switch (restoreWallet.restoreMode) {
|
||||
@@ -119,7 +115,7 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
|
||||
name: name,
|
||||
mnemonic: restoreWallet.mnemonicSeed ?? '',
|
||||
password: password,
|
||||
passphrase: passphrase,
|
||||
passphrase: restoreWallet.passphrase,
|
||||
derivationType: derivationInfo!.derivationType!,
|
||||
derivationPath: derivationInfo.derivationPath!,
|
||||
);
|
||||
|
||||
@@ -10,6 +10,7 @@ class RestoredWallet {
|
||||
this.spendKey,
|
||||
this.viewKey,
|
||||
this.mnemonicSeed,
|
||||
this.passphrase,
|
||||
this.txAmount,
|
||||
this.txDescription,
|
||||
this.recipientName,
|
||||
@@ -23,6 +24,7 @@ class RestoredWallet {
|
||||
final String? spendKey;
|
||||
final String? viewKey;
|
||||
final String? mnemonicSeed;
|
||||
final String? passphrase;
|
||||
final String? txAmount;
|
||||
final String? txDescription;
|
||||
final String? recipientName;
|
||||
@@ -46,11 +48,13 @@ class RestoredWallet {
|
||||
final height = json['height'] as String?;
|
||||
final mnemonic_seed = json['mnemonic_seed'] as String?;
|
||||
final seed = json['seed'] as String? ?? json['hexSeed'] as String?;
|
||||
final passphrase = json['passphrase'] as String?;
|
||||
return RestoredWallet(
|
||||
restoreMode: json['mode'] as WalletRestoreMode,
|
||||
type: json['type'] as WalletType,
|
||||
address: json['address'] as String?,
|
||||
mnemonicSeed: mnemonic_seed ?? seed,
|
||||
passphrase: passphrase,
|
||||
height: height != null ? int.parse(height) : 0,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user