Fixed all imports in keys

This commit is contained in:
Ethan Frey
2017-04-19 17:25:53 +02:00
parent 0bfae964e1
commit 91bd7efb7b
13 changed files with 24 additions and 25 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ func (es encryptedStorage) Put(name, pass string, key crypto.PrivKey) error {
func (es encryptedStorage) Get(name, pass string) (crypto.PrivKey, keys.Info, error) {
secret, info, err := es.store.Get(name)
if err != nil {
return nil, info, err
return crypto.PrivKey{}, info, err
}
key, err := es.coder.Decrypt(secret, pass)
return key, info, err
@@ -44,6 +44,6 @@ func info(name string, key crypto.PrivKey) keys.Info {
return keys.Info{
Name: name,
Address: pub.Address(),
PubKey: crypto.PubKeyS{pub},
PubKey: pub,
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ func (e secretbox) Decrypt(data []byte, pass string) (crypto.PrivKey, error) {
s := secret(pass)
private, err := crypto.DecryptSymmetric(data, s)
if err != nil {
return nil, errors.Wrap(err, "Invalid Passphrase")
return crypto.PrivKey{}, errors.Wrap(err, "Invalid Passphrase")
}
key, err := crypto.PrivKeyFromBytes(private)
return key, errors.Wrap(err, "Invalid Passphrase")
+1 -1
View File
@@ -50,7 +50,7 @@ func TestSecretBox(t *testing.T) {
// decoding with a different pass is an error
pk, err := enc.Decrypt(b, "decode")
require.NotNil(err)
require.Nil(pk)
require.True(pk.Empty())
// but decoding with the same passphrase gets us our key
pk, err = enc.Decrypt(b, pass)
+2 -2
View File
@@ -25,11 +25,11 @@ func (f GenFunc) Generate() crypto.PrivKey {
}
func genEd25519() crypto.PrivKey {
return crypto.GenPrivKeyEd25519()
return crypto.GenPrivKeyEd25519().Wrap()
}
func genSecp256() crypto.PrivKey {
return crypto.GenPrivKeySecp256k1()
return crypto.GenPrivKeySecp256k1().Wrap()
}
func getGenerator(algo string) (Generator, error) {