1
0

qml: multisig create_storage

This commit is contained in:
Sander van Grieken
2022-11-14 14:37:05 +01:00
parent ba2905105d
commit ce35e68514
4 changed files with 40 additions and 24 deletions

View File

@@ -26,8 +26,10 @@ WizardComponent {
valid = false
validationtext.text = ''
if (!bitcoin.verifyMasterKey(key.trim(), wizard_data['wallet_type']))
if (!bitcoin.verifyMasterKey(key.trim(), wizard_data['wallet_type'])) {
validationtext.text = qsTr('Error: invalid master key')
return false
}
if (cosigner) {
apply()
@@ -57,6 +59,7 @@ WizardComponent {
id: masterkey_ta
Layout.fillWidth: true
Layout.minimumHeight: 80
font.family: FixedFont
focus: true
wrapMode: TextEdit.WrapAnywhere
onTextChanged: verifyMasterKey(text)
@@ -67,8 +70,7 @@ WizardComponent {
icon.height: constants.iconSizeMedium
icon.width: constants.iconSizeMedium
onClicked: {
if (verifyMasterKey(AppController.clipboardToText()))
masterkey_ta.text = AppController.clipboardToText()
masterkey_ta.text = AppController.clipboardToText()
}
}
ToolButton {
@@ -79,8 +81,7 @@ WizardComponent {
onClicked: {
var scan = qrscan.createObject(root)
scan.onFound.connect(function() {
if (verifyMasterKey(scan.scanData))
masterkey_ta.text = scan.scanData
masterkey_ta.text = scan.scanData
scan.destroy()
})
}

View File

@@ -53,10 +53,12 @@ WizardComponent {
}
Component.onCompleted: {
if (wizard_data['seed_variant'] == 'electrum') {
masterPubkey = bitcoin.getMultisigMasterPubkey(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words'])
if ('master_key' in wizard_data) {
masterPubkey = bitcoin.getMultisigMasterPubkeyFromKey(wizard_data['master_key'])
} else if (wizard_data['seed_variant'] == 'electrum') {
masterPubkey = bitcoin.getMultisigMasterPubkeyFromSeed(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words'])
} else {
masterPubkey = bitcoin.getMultisigMasterPubkey(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words'], wizard_data['derivation_path'])
masterPubkey = bitcoin.getMultisigMasterPubkeyFromSeed(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words'], wizard_data['derivation_path'])
}
}
}

View File

@@ -126,7 +126,6 @@ class QEBitcoin(QObject):
if t1 not in ['standard', 'p2wsh', 'p2wsh-p2sh']:
self.validationMessage = '%s: %s' % (_('Wrong key type'), t1)
return False
# TODO: check against other cosigner xpubs
return True
raise Exception(f'Unsupported wallet type: {wallet_type}')
@@ -167,9 +166,13 @@ class QEBitcoin(QObject):
def isPrivateKeyList(self, csv: str):
return keystore.is_private_key_list(csv)
@pyqtSlot(str, result=str)
def getMultisigMasterPubkeyFromKey(self, key):
return keystore.from_master_key(key).get_master_public_key()
@pyqtSlot(str, str, str, result=str)
@pyqtSlot(str, str, str, str, result=str)
def getMultisigMasterPubkey(self, seed_variant, seed, seed_extra_words, derivation_path = None):
def getMultisigMasterPubkeyFromSeed(self, seed_variant, seed, seed_extra_words, derivation_path = None):
if seed_variant == 'electrum':
k = keystore.from_seed(seed, seed_extra_words, True)
elif seed_variant == 'bip39':