private KeyParameter aesKey;
// Note: NOT called by FXMLLoader!
public void initialize(@Nullable KeyParameter aesKey) {
DeterministicSeed seed = Main.bitcoin.wallet().getKeyChainSeed();
if (aesKey == null) {
if (seed.isEncrypted()) {
log.info("Wallet is encrypted, requesting password first.");
// Delay execution of this until after we've finished initialising this screen.
Platform.runLater(this::askForPasswordAndRetry);
return;
}
} else {
this.aesKey = aesKey;
seed = seed.decrypt(checkNotNull(Main.bitcoin.wallet().getKeyCrypter()), "", aesKey);
// Now we can display the wallet seed as appropriate.
passwordButton.setText("Remove password");
}
// Set the date picker to show the birthday of this wallet.
Instant creationTime = Instant.ofEpochSecond(seed.getCreationTimeSeconds());
LocalDate origDate = creationTime.atZone(ZoneId.systemDefault()).toLocalDate();
datePicker.setValue(origDate);
// Set the mnemonic seed words.
final List<String> mnemonicCode = seed.getMnemonicCode();
checkNotNull(mnemonicCode); // Already checked for encryption.
String origWords = Joiner.on(" ").join(mnemonicCode);
wordsArea.setText(origWords);
// Validate words as they are being typed.