use of network.bisq.api.model.SeedWords in project bisq-api by mrosseel.
the class BisqProxy method getSeedWords.
public SeedWords getSeedWords(String password) {
final DeterministicSeed keyChainSeed = btcWalletService.getKeyChainSeed();
final WalletsManager walletsManager = injector.getInstance(WalletsManager.class);
final LocalDate walletCreationDate = Instant.ofEpochSecond(walletsManager.getChainSeedCreationTimeSeconds()).atZone(ZoneId.systemDefault()).toLocalDate();
DeterministicSeed seed = keyChainSeed;
if (keyChainSeed.isEncrypted()) {
if (null == password)
throw new UnauthorizedException();
final KeyParameter aesKey = getAESKey(password);
if (!isWalletPasswordValid(aesKey))
throw new UnauthorizedException();
seed = walletsManager.getDecryptedSeed(aesKey, btcWalletService.getKeyChainSeed(), btcWalletService.getKeyCrypter());
}
return new SeedWords(seed.getMnemonicCode(), walletCreationDate.toString());
}
Aggregations