seed fix
This commit is contained in:
parent
9b2c71cf16
commit
84ed7c7b3f
1 changed files with 5 additions and 1 deletions
|
|
@ -214,8 +214,9 @@ export class Unlocker {
|
||||||
if (!encrypted || !encrypted.seed) {
|
if (!encrypted || !encrypted.seed) {
|
||||||
throw new Error("seed not found")
|
throw new Error("seed not found")
|
||||||
}
|
}
|
||||||
|
this.log("seed found, decrypting")
|
||||||
const decrypted = this.DecryptWalletSeed(JSON.parse(encrypted.seed))
|
const decrypted = this.DecryptWalletSeed(JSON.parse(encrypted.seed))
|
||||||
|
this.log("seed decrypted")
|
||||||
return { seed: decrypted }
|
return { seed: decrypted }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,9 +278,12 @@ export class Unlocker {
|
||||||
const secret = Buffer.from(sec, 'hex')
|
const secret = Buffer.from(sec, 'hex')
|
||||||
const iv = Buffer.from(data.iv, 'hex')
|
const iv = Buffer.from(data.iv, 'hex')
|
||||||
const encrypted = Buffer.from(data.encrypted, 'hex')
|
const encrypted = Buffer.from(data.encrypted, 'hex')
|
||||||
|
this.log("decoded encrypted data")
|
||||||
const decipher = crypto.createDecipheriv('aes-256-cbc', secret, iv)
|
const decipher = crypto.createDecipheriv('aes-256-cbc', secret, iv)
|
||||||
const decrypted = decipher.update(encrypted)
|
const decrypted = decipher.update(encrypted)
|
||||||
|
this.log("decrypted data")
|
||||||
const raw = Buffer.concat([decrypted, decipher.final()])
|
const raw = Buffer.concat([decrypted, decipher.final()])
|
||||||
|
this.log("got raw data")
|
||||||
return raw.toString('utf-8')
|
return raw.toString('utf-8')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue