mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-05 18:39:38 +00:00
Merge pull request #2772
48aab5c
WalletManager: wallet recovery - seed offset passphrase support (xiphon)
This commit is contained in:
commit
eed51e3ffa
4 changed files with 24 additions and 5 deletions
|
@ -151,14 +151,14 @@ void WalletManager::openWalletAsync(const QString &path, const QString &password
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo, NetworkType::Type nettype, quint64 restoreHeight, quint64 kdfRounds)
|
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &seed, const QString &seed_offset, NetworkType::Type nettype, quint64 restoreHeight, quint64 kdfRounds)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
if (m_currentWallet) {
|
if (m_currentWallet) {
|
||||||
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||||
delete m_currentWallet;
|
delete m_currentWallet;
|
||||||
}
|
}
|
||||||
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), "", memo.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight, kdfRounds);
|
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), "", seed.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight, kdfRounds, seed_offset.toStdString());
|
||||||
m_currentWallet = new Wallet(w);
|
m_currentWallet = new Wallet(w);
|
||||||
return m_currentWallet;
|
return m_currentWallet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
Q_INVOKABLE void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
Q_INVOKABLE void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||||
|
|
||||||
// wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
|
// wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
|
||||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &seed, const QString &seed_offset,
|
||||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
||||||
|
|
||||||
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
||||||
|
|
|
@ -59,6 +59,7 @@ Rectangle {
|
||||||
wizardController.walletOptionsLocation = '';
|
wizardController.walletOptionsLocation = '';
|
||||||
wizardController.walletOptionsPassword = '';
|
wizardController.walletOptionsPassword = '';
|
||||||
wizardController.walletOptionsSeed = '';
|
wizardController.walletOptionsSeed = '';
|
||||||
|
wizardController.walletOptionsSeedOffset = '';
|
||||||
wizardController.walletOptionsRecoverAddress = ''
|
wizardController.walletOptionsRecoverAddress = ''
|
||||||
wizardController.walletOptionsRecoverViewkey = ''
|
wizardController.walletOptionsRecoverViewkey = ''
|
||||||
wizardController.walletOptionsRecoverSpendkey = ''
|
wizardController.walletOptionsRecoverSpendkey = ''
|
||||||
|
@ -92,6 +93,7 @@ Rectangle {
|
||||||
property string walletOptionsLocation: ''
|
property string walletOptionsLocation: ''
|
||||||
property string walletOptionsPassword: ''
|
property string walletOptionsPassword: ''
|
||||||
property string walletOptionsSeed: ''
|
property string walletOptionsSeed: ''
|
||||||
|
property string walletOptionsSeedOffset: ''
|
||||||
property string walletOptionsRecoverAddress: ''
|
property string walletOptionsRecoverAddress: ''
|
||||||
property string walletOptionsRecoverViewkey: ''
|
property string walletOptionsRecoverViewkey: ''
|
||||||
property string walletOptionsRecoverSpendkey: ''
|
property string walletOptionsRecoverSpendkey: ''
|
||||||
|
@ -394,7 +396,7 @@ Rectangle {
|
||||||
var wallet = ''
|
var wallet = ''
|
||||||
// From seed or keys
|
// From seed or keys
|
||||||
if(wizardController.walletRestoreMode === 'seed')
|
if(wizardController.walletRestoreMode === 'seed')
|
||||||
wallet = walletManager.recoveryWallet(tmp_wallet_filename, wizardController.walletOptionsSeed, nettype, restoreHeight, kdfRounds)
|
wallet = walletManager.recoveryWallet(tmp_wallet_filename, wizardController.walletOptionsSeed, wizardController.walletOptionsSeedOffset, nettype, restoreHeight, kdfRounds);
|
||||||
else
|
else
|
||||||
wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, wizardController.language_wallet, nettype,
|
wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, wizardController.language_wallet, nettype,
|
||||||
wizardController.walletOptionsRecoverAddress, wizardController.walletOptionsRecoverViewkey,
|
wizardController.walletOptionsRecoverAddress, wizardController.walletOptionsRecoverViewkey,
|
||||||
|
|
|
@ -164,8 +164,8 @@ Rectangle {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
// seed textarea
|
// seed textarea
|
||||||
visible: wizardController.walletRestoreMode === 'seed'
|
visible: wizardController.walletRestoreMode === 'seed'
|
||||||
Layout.preferredHeight: 100
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
@ -217,6 +217,20 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MoneroComponents.CheckBox2 {
|
||||||
|
id: seedOffsetCheckbox
|
||||||
|
text: qsTr("Seed offset passphrase (optional)") + translationManager.emptyString
|
||||||
|
}
|
||||||
|
|
||||||
|
MoneroComponents.LineEdit {
|
||||||
|
id: seedOffset
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderFontSize: 16
|
||||||
|
placeholderText: qsTr("Passphrase") + translationManager.emptyString
|
||||||
|
visible: seedOffsetCheckbox.checked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.LineEdit {
|
MoneroComponents.LineEdit {
|
||||||
|
@ -294,6 +308,7 @@ Rectangle {
|
||||||
switch (wizardController.walletRestoreMode) {
|
switch (wizardController.walletRestoreMode) {
|
||||||
case 'seed':
|
case 'seed':
|
||||||
wizardController.walletOptionsSeed = seedInput.text;
|
wizardController.walletOptionsSeed = seedInput.text;
|
||||||
|
wizardController.walletOptionsSeedOffset = seedOffsetCheckbox.checked ? seedOffset.text : "";
|
||||||
break;
|
break;
|
||||||
default: // walletRestoreMode = keys or qr
|
default: // walletRestoreMode = keys or qr
|
||||||
wizardController.walletOptionsRecoverAddress = addressLine.text;
|
wizardController.walletOptionsRecoverAddress = addressLine.text;
|
||||||
|
@ -325,6 +340,8 @@ Rectangle {
|
||||||
// cleanup
|
// cleanup
|
||||||
wizardWalletInput.reset();
|
wizardWalletInput.reset();
|
||||||
seedInput.text = "";
|
seedInput.text = "";
|
||||||
|
seedOffsetCheckbox.checked = false;
|
||||||
|
seedOffset.text = "";
|
||||||
addressLine.text = "";
|
addressLine.text = "";
|
||||||
spendKeyLine.text = "";
|
spendKeyLine.text = "";
|
||||||
viewKeyLine.text = "";
|
viewKeyLine.text = "";
|
||||||
|
|
Loading…
Reference in a new issue