@@ -43,6 +43,7 @@ import moneroComponents.PendingTransaction 1.0
4343import moneroComponents.NetworkType 1.0
4444import moneroComponents.Settings 1.0
4545import moneroComponents.P2PoolManager 1.0
46+ import moneroComponents.Memwipe 1.0
4647
4748import "components"
4849import "components" as MoneroComponents
@@ -71,7 +72,6 @@ ApplicationWindow {
7172 property var currentWallet;
7273 property bool disconnected: currentWallet ? currentWallet .disconnected : false
7374 property var transaction;
74- property var walletPassword
7575 property int restoreHeight: 0
7676 property bool daemonSynced: false
7777 property bool walletSynced: false
@@ -140,9 +140,12 @@ ApplicationWindow {
140140 return ;
141141 }
142142
143- passwordDialog .onRejectedCallback = function () { appWindow .showWizard (); }
143+ passwordDialog .onRejectedCallback = function () {
144+ memwipe .wipeQString (passwordDialog .password );
145+ appWindow .showWizard ();
146+ }
144147 passwordDialog .onAcceptedCallback = function () {
145- if (walletPassword === passwordDialog .password )
148+ if ( currentWallet . verifyPassword ( passwordDialog .password , persistentSettings . kdfRounds ) )
146149 passwordDialog .close ();
147150 else
148151 passwordDialog .showError (qsTr (" Wrong password" ) + translationManager .emptyString );
@@ -225,16 +228,19 @@ ApplicationWindow {
225228
226229 function openWallet (prevState ) {
227230 passwordDialog .onAcceptedCallback = function () {
228- walletPassword = passwordDialog .password ;
229231 initialize ();
230232 }
231233 passwordDialog .onRejectedCallback = function () {
234+ memwipe .wipeQString (passwordDialog .password );
232235 if (prevState) {
233236 appWindow .viewState = prevState;
234237 }
235238 if (wizard .wizardState == " wizardOpenWallet1" ) {
236239 wizard .wizardStateView .wizardOpenWallet1View .pageRoot .forceActiveFocus ();
237240 }
241+ else if (wizard .wizardState == " wizardCreateWallet5" ) {
242+ showWizard ()
243+ }
238244 };
239245 passwordDialog .open (usefulName (persistentSettings .wallet_path ));
240246 }
@@ -271,13 +277,12 @@ ApplicationWindow {
271277 var wallet_path = persistentSettings .wallet_path ;
272278 if (isIOS)
273279 wallet_path = appWindow .accountsDir + wallet_path;
274- // console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword);
275280 console .log (" opening wallet at: " , wallet_path, " , network type: " , persistentSettings .nettype == NetworkType .MAINNET ? " mainnet" : persistentSettings .nettype == NetworkType .TESTNET ? " testnet" : " stagenet" );
276281
277282 this .onWalletOpening ();
278283 walletManager .openWalletAsync (
279284 wallet_path,
280- walletPassword ,
285+ passwordDialog . password ,
281286 persistentSettings .nettype ,
282287 persistentSettings .kdfRounds );
283288 }
@@ -389,7 +394,9 @@ ApplicationWindow {
389394 persistentSettings .getWalletProxyAddress ());
390395
391396 // save wallet keys in case wallet settings have been changed in the init
392- currentWallet .setPassword (walletPassword);
397+ currentWallet .setPassword (passwordDialog .password , passwordDialog .password );
398+ memwipe .wipeQString (passwordDialog .password );
399+ currentWallet .storeAsync (function (){});
393400 }
394401
395402 function isTrustedDaemon () {
@@ -543,7 +550,6 @@ ApplicationWindow {
543550 case " basic_string::_M_replace_aux" :
544551 case " std::bad_alloc" :
545552 walletManager .clearWalletCache (wallet .path );
546- walletPassword = passwordDialog .password ;
547553 appWindow .initialize ();
548554 console .error (" Repairing wallet cache with error: " , wallet .errorString );
549555 appWindow .showStatusMessage (qsTr (" Repairing incompatible wallet cache. Resyncing wallet." ),6 );
@@ -1671,13 +1677,13 @@ ApplicationWindow {
16711677 }
16721678 close ();
16731679 passwordDialog .onAcceptedCallback = function () {
1674- if (walletPassword === passwordDialog .password ) {
1680+ if ( currentWallet . verifyPassword ( passwordDialog .password , persistentSettings . kdfRounds )) {
16751681 handleAccepted ()
16761682 } else {
16771683 passwordDialog .showError (qsTr (" Wrong password" ) + translationManager .emptyString );
16781684 }
16791685 }
1680- passwordDialog .onRejectedCallback = null ;
1686+ passwordDialog .onRejectedCallback = function () { memwipe . wipeQString ( passwordDialog . password ); }
16811687 if (! persistentSettings .askPasswordBeforeSending ) {
16821688 handleAccepted ()
16831689 } else {
@@ -1785,8 +1791,7 @@ ApplicationWindow {
17851791 onRejectedCallback ();
17861792 }
17871793 onAcceptedNewPassword: {
1788- if (currentWallet .setPassword (passwordDialog .password )) {
1789- appWindow .walletPassword = passwordDialog .password ;
1794+ if (currentWallet .setPassword (/* old_password */ " " , passwordDialog .password )) {
17901795 informationPopup .title = qsTr (" Information" ) + translationManager .emptyString ;
17911796 informationPopup .text = qsTr (" Password changed successfully" ) + translationManager .emptyString ;
17921797 informationPopup .icon = StandardIcon .Information ;
@@ -1797,6 +1802,8 @@ ApplicationWindow {
17971802 }
17981803 informationPopup .onCloseCallback = null ;
17991804 informationPopup .open ();
1805+ memwipe .wipeQString (passwordDialog .password );
1806+ memwipe .wipeQString (passwordDialog .passwordConfirm );
18001807 }
18011808 onRejectedNewPassword: {}
18021809 Keys .enabled : ! passwordDialog .visible && informationPopup .visible
@@ -2352,7 +2359,7 @@ ApplicationWindow {
23522359 }
23532360
23542361 passwordDialog .onAcceptedCallback = function () {
2355- if (walletPassword === passwordDialog .password ) {
2362+ if ( currentWallet . verifyPassword ( passwordDialog .password , persistentSettings . kdfRounds )) {
23562363 passwordDialog .close ();
23572364 if (inputDialogVisible) inputDialog .open (inputDialog .inputText )
23582365 if (successfulTxPopupVisible) successfulTxPopup .open (successfulTxPopup .transactionID )
@@ -2362,7 +2369,17 @@ ApplicationWindow {
23622369 }
23632370 }
23642371
2365- passwordDialog .onRejectedCallback = function () { appWindow .showWizard (); }
2372+ passwordDialog .onRejectedCallback = function () {
2373+ memwipe .wipeQString (passwordDialog .password );
2374+ appWindow .showWizard ();
2375+ }
2376+ if (inputDialogVisible) inputDialog .close ()
2377+ remoteNodeDialog .close ();
2378+ informationPopup .close ()
2379+ txConfirmationPopup .close ()
2380+ txConfirmationPopup .clearFields ()
2381+ txConfirmationPopup .rejected ()
2382+ successfulTxPopup .close ();
23662383 passwordDialog .open ();
23672384 }
23682385
@@ -2497,4 +2514,8 @@ ApplicationWindow {
24972514 id: walletManager
24982515 proxyAddress: persistentSettings .getProxyAddress ()
24992516 }
2517+
2518+ Memwipe {
2519+ id: memwipe
2520+ }
25002521}
0 commit comments