feat: restore takes both the password and the seed as args

This commit is contained in:
Vlad Stan
2022-08-15 15:59:49 +03:00
parent 01d2db5a1b
commit 32bb59255d
2 changed files with 6 additions and 5 deletions

View File

@ -631,8 +631,10 @@ async function serialSigner(path) {
}, },
hwwRestore: async function () { hwwRestore: async function () {
try { try {
await this.sendCommandSecure(COMMAND_RESTORE, [this.hww.mnemonic]) await this.sendCommandSecure(COMMAND_RESTORE, [
await this.sendCommandSecure(COMMAND_PASSWORD, [this.hww.password]) this.hww.password,
this.hww.mnemonic
])
} catch (error) { } catch (error) {
this.$q.notify({ this.$q.notify({
type: 'warning', type: 'warning',
@ -721,10 +723,10 @@ async function serialSigner(path) {
encryptMessage: async function (key, iv, message) { encryptMessage: async function (key, iv, message) {
while (message.length % 16 !== 0) message += ' ' while (message.length % 16 !== 0) message += ' '
const encodedMessage = asciiToUint8Array(message) const encodedMessage = asciiToUint8Array(message)
const aesCbc = new aesjs.ModeOfOperation.cbc(key, iv) const aesCbc = new aesjs.ModeOfOperation.cbc(key, iv)
const encryptedBytes = aesCbc.encrypt(encodedMessage) const encryptedBytes = aesCbc.encrypt(encodedMessage)
return encryptedBytes return encryptedBytes
}, },
decryptMessage: async function (key, iv, encryptedBytes) { decryptMessage: async function (key, iv, encryptedBytes) {

View File

@ -191,4 +191,3 @@ function asciiToUint8Array(str) {
} }
return new Uint8Array(chars) return new Uint8Array(chars)
} }