Fix metalinter complaints

This commit is contained in:
Ethan Frey
2017-10-24 11:56:37 +02:00
parent 2d04544088
commit 6f6bbf718e
6 changed files with 30 additions and 30 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ func (e secretbox) Encrypt(privKey crypto.PrivKey, passphrase string) (saltBytes
return saltBytes, crypto.EncryptSymmetric(privKeyBytes, key), nil
}
func (e secretbox) Decrypt(saltBytes []byte, encBytes []byte, passphrase string) (privKey crypto.PrivKey, err error) {
func (e secretbox) Decrypt(saltBytes []byte, encBytes []byte, passphrase string) (crypto.PrivKey, error) {
privKeyBytes := encBytes
// NOTE: Some keys weren't encrypted with a passphrase and hence we have the conditional
if passphrase != "" {
@@ -53,7 +53,7 @@ func (e secretbox) Decrypt(saltBytes []byte, encBytes []byte, passphrase string)
return crypto.PrivKey{}, errors.Wrap(err, "Invalid Passphrase")
}
}
privKey, err = crypto.PrivKeyFromBytes(privKeyBytes)
privKey, err := crypto.PrivKeyFromBytes(privKeyBytes)
if err != nil {
return crypto.PrivKey{}, errors.Wrap(err, "Private Key")
}
+4 -4
View File
@@ -68,8 +68,8 @@ func TestSecretBoxNoPass(t *testing.T) {
assert, require := assert.New(t), require.New(t)
enc := cryptostore.SecretBox
key, err := cryptostore.GenEd25519.Generate(cmn.RandBytes(16))
require.NoError(err)
key, rerr := cryptostore.GenEd25519.Generate(cmn.RandBytes(16))
require.NoError(rerr)
cases := []struct {
encode string
@@ -99,7 +99,7 @@ func TestSecretBoxNoPass(t *testing.T) {
// now let's make sure raw bytes also work...
b := key.Bytes()
pk, err := enc.Decrypt(nil, b, "")
require.Nil(err, "%+v", err)
pk, rerr := enc.Decrypt(nil, b, "")
require.NoError(rerr)
assert.Equal(key, pk)
}
+1 -1
View File
@@ -320,7 +320,7 @@ func TestSeedPhrase(t *testing.T) {
assert.Equal(info.PubKey, newInfo.PubKey)
}
func ExampleStore() {
func ExampleNew() {
// Select the encryption and storage for your cryptostore
cstore := cryptostore.New(
cryptostore.SecretBox,