File tree 4 files changed +46
-3
lines changed
4 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
ImportBIP39Dialog::ImportBIP39Dialog (QWidget* parent)
24
24
: QDialog(parent)
25
+ {
26
+ init ();
27
+ }
28
+
29
+ ImportBIP39Dialog::ImportBIP39Dialog (const QString& name, QWidget* parent)
30
+ : QDialog(parent)
31
+ {
32
+ init (name);
33
+ }
34
+
35
+ void ImportBIP39Dialog::init (const QString& name)
25
36
{
26
37
setWindowTitle (tr (" Import Wordlist" ));
27
38
@@ -34,6 +45,13 @@ ImportBIP39Dialog::ImportBIP39Dialog(QWidget* parent)
34
45
35
46
QLabel* nameLabel = new QLabel (tr (" Name:" ));
36
47
m_nameEdit = new QLineEdit ();
48
+
49
+ if (!name.isEmpty ())
50
+ {
51
+ m_nameEdit->setText (name);
52
+ m_nameEdit->setReadOnly (true );
53
+ }
54
+
37
55
QHBoxLayout* nameLayout = new QHBoxLayout ();
38
56
nameLayout->addWidget (nameLabel);
39
57
nameLayout->addWidget (m_nameEdit);
Original file line number Diff line number Diff line change @@ -22,11 +22,14 @@ class ImportBIP39Dialog : public QDialog
22
22
23
23
public:
24
24
ImportBIP39Dialog (QWidget* parent = NULL );
25
+ ImportBIP39Dialog (const QString& name, QWidget* parent = NULL );
25
26
26
27
QString getName () const ;
27
28
secure_bytes_t getSeed () const ;
28
29
29
30
private:
31
+ void init (const QString& name = QString());
32
+
30
33
QLineEdit* m_nameEdit;
31
34
QLineEdit* m_wordlistEdit;
32
35
};
Original file line number Diff line number Diff line change @@ -695,10 +695,32 @@ void MainWindow::newKeychain()
695
695
696
696
{
697
697
// TODO: Randomize using user input for entropy
698
+ secure_bytes_t seed = getRandomBytes (32 );
699
+
700
+ // Prompt user to write down and verify word list
701
+ ViewBIP39Dialog viewDlg (name, seed, this );
702
+ viewDlg.exec ();
703
+
704
+ while (true )
705
+ {
706
+ try
707
+ {
708
+ ImportBIP39Dialog checkDlg (name, this );
709
+ if (!checkDlg.exec ()) return ; // User canceled out
710
+
711
+ secure_bytes_t seed2 = checkDlg.getSeed ();
712
+ if (seed == seed2) break ;
713
+ else throw std::runtime_error (" Wordlists do not match." );
714
+ }
715
+ catch (const exception & e)
716
+ {
717
+ showError (e.what ());
718
+ }
719
+ }
720
+
698
721
CoinDB::VaultLock lock (synchedVault);
699
722
if (!synchedVault.isVaultOpen ()) throw std::runtime_error (" No vault is open." );
700
- secure_bytes_t entropy = getRandomBytes (32 );
701
- synchedVault.getVault ()->newKeychain (name.toStdString (), entropy);
723
+ synchedVault.getVault ()->newKeychain (name.toStdString (), seed);
702
724
}
703
725
704
726
keychainModel->update ();
Original file line number Diff line number Diff line change 16
16
#include < openssl/opensslv.h>
17
17
18
18
// Definitions
19
- const QString VERSIONTEXT (" 0.9.2 beta" );
19
+ const QString VERSIONTEXT (" 0.9.3 beta" );
20
20
21
21
const QString commitHash (COMMIT_HASH);
22
22
const QString shortCommitHash (QString(COMMIT_HASH).left(7 ));
You can’t perform that action at this time.
0 commit comments