feat: add passphrase support

This commit is contained in:
Vlad Stan 2022-08-22 09:04:16 +03:00
parent 739646f702
commit d08b7455e7
2 changed files with 39 additions and 10 deletions

View file

@ -428,6 +428,31 @@
</template>
</q-input>
<br />
<q-toggle
label="Passphrase (optional)"
color="secodary"
v-model="hww.hasPassphrase"
></q-toggle>
<br />
<q-input
v-if="hww.hasPassphrase"
v-model.trim="hww.passphrase"
filled
:type="hww.showPassphrase ? 'text' : 'password'"
filled
dense
label="Passphrase"
>
<template v-slot:append>
<q-icon
:name="hww.showPassphrase ? 'visibility' : 'visibility_off'"
class="cursor-pointer"
@click="hww.showPassphrase = !hww.showPassphrase"
/>
</template>
</q-input>
<q-separator></q-separator>
<br />
<span>Enter new password (8 numbers/letters)</span>
<q-input
v-model.trim="hww.password"
@ -453,15 +478,7 @@
type="password"
label="Confirm Password"
></q-input>
<br /><br />
<q-badge
color="pink"
text-color="black"
class="text-subtitle2"
multi-line
>
For test purposes only. Do not enter word list with real funds!!!
</q-badge>
<br />
<q-separator></q-separator>
<q-badge
color="pink"

View file

@ -22,6 +22,9 @@ async function serialSigner(path) {
showPassword: false,
mnemonic: null,
showMnemonic: false,
passphrase: null,
showPassphrase: false,
hasPassphrase: false,
authenticated: false,
showPasswordDialog: false,
showConfigDialog: false,
@ -797,9 +800,17 @@ async function serialSigner(path) {
},
hwwRestore: async function () {
try {
let mnemonicWithPassphrase = this.hww.mnemonic
if (
this.hww.hasPassphrase &&
this.hww.passphrase &&
this.hww.passphrase.length
) {
mnemonicWithPassphrase += '/' + this.hww.passphrase
}
await this.sendCommandSecure(COMMAND_RESTORE, [
this.hww.password,
this.hww.mnemonic
mnemonicWithPassphrase
])
} catch (error) {
this.$q.notify({
@ -811,6 +822,7 @@ async function serialSigner(path) {
} finally {
this.hww.showRestoreDialog = false
this.hww.mnemonic = null
this.hww.passphrase = null
this.hww.showMnemonic = false
this.hww.password = null
this.hww.confirmedPassword = null