forked from TrueCloudLab/neoneo-go
wallet: set WIF and public key on account decrypt
They are set during account creation and open+decrypt is expected to put account in the same state.
This commit is contained in:
parent
d837eb3761
commit
ad6fa2aea9
1 changed files with 8 additions and 1 deletions
|
@ -122,9 +122,16 @@ func (a *Account) Decrypt(passphrase string) error {
|
||||||
return errors.New("no encrypted wif in the account")
|
return errors.New("no encrypted wif in the account")
|
||||||
}
|
}
|
||||||
a.privateKey, err = keys.NEP2Decrypt(a.EncryptedWIF, passphrase)
|
a.privateKey, err = keys.NEP2Decrypt(a.EncryptedWIF, passphrase)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.publicKey = a.privateKey.PublicKey().Bytes()
|
||||||
|
a.wif = a.privateKey.WIF()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Encrypt encrypts the wallet's PrivateKey with the given passphrase
|
// Encrypt encrypts the wallet's PrivateKey with the given passphrase
|
||||||
// under the NEP-2 standard.
|
// under the NEP-2 standard.
|
||||||
func (a *Account) Encrypt(passphrase string) error {
|
func (a *Account) Encrypt(passphrase string) error {
|
||||||
|
|
Loading…
Reference in a new issue