mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
decrypt keystore before requesting passphrase to show masterfingerprint
This commit is contained in:
parent
06026b0a09
commit
55809b7dc3
1 changed files with 9 additions and 8 deletions
|
@ -8,6 +8,7 @@ import com.sparrowwallet.drongo.wallet.StandardAccount;
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.SparrowWallet;
|
import com.sparrowwallet.sparrow.SparrowWallet;
|
||||||
|
import com.sparrowwallet.sparrow.control.WalletPasswordDialog;
|
||||||
import com.sparrowwallet.sparrow.soroban.Soroban;
|
import com.sparrowwallet.sparrow.soroban.Soroban;
|
||||||
import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
|
import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
|
||||||
import javafx.concurrent.ScheduledService;
|
import javafx.concurrent.ScheduledService;
|
||||||
|
@ -146,6 +147,14 @@ public class Storage {
|
||||||
if(wallet.containsMasterPrivateKeys()) {
|
if(wallet.containsMasterPrivateKeys()) {
|
||||||
//Derive xpub and master fingerprint from seed, potentially with passphrase
|
//Derive xpub and master fingerprint from seed, potentially with passphrase
|
||||||
Wallet copy = wallet.copy(false);
|
Wallet copy = wallet.copy(false);
|
||||||
|
if(wallet.isEncrypted()) {
|
||||||
|
if(key == null) {
|
||||||
|
throw new IllegalStateException("Wallet was not encrypted, but seed is");
|
||||||
|
}
|
||||||
|
|
||||||
|
copy.decrypt(key);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < copy.getKeystores().size(); i++) {
|
for(int i = 0; i < copy.getKeystores().size(); i++) {
|
||||||
Keystore copyKeystore = copy.getKeystores().get(i);
|
Keystore copyKeystore = copy.getKeystores().get(i);
|
||||||
if(copyKeystore.hasSeed() && copyKeystore.getSeed().getPassphrase() == null) {
|
if(copyKeystore.hasSeed() && copyKeystore.getSeed().getPassphrase() == null) {
|
||||||
|
@ -166,14 +175,6 @@ public class Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wallet.isEncrypted()) {
|
|
||||||
if(key == null) {
|
|
||||||
throw new IllegalStateException("Wallet was not encrypted, but seed is");
|
|
||||||
}
|
|
||||||
|
|
||||||
copy.decrypt(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(wallet.isWhirlpoolMasterWallet()) {
|
if(wallet.isWhirlpoolMasterWallet()) {
|
||||||
String walletId = getWalletId(wallet);
|
String walletId = getWalletId(wallet);
|
||||||
Whirlpool whirlpool = AppServices.getWhirlpoolServices().getWhirlpool(walletId);
|
Whirlpool whirlpool = AppServices.getWhirlpoolServices().getWhirlpool(walletId);
|
||||||
|
|
Loading…
Reference in a new issue