From ef80162f146147aca0ad246e169d51a23ab783ba Mon Sep 17 00:00:00 2001 From: Brendan Mc Date: Thu, 7 May 2015 13:51:00 -0700 Subject: [PATCH] Style changes --- cryptor/cryptor.go | 8 ++++---- passvault/passvault.go | 4 ++-- passvault/passvault_test.go | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cryptor/cryptor.go b/cryptor/cryptor.go index 7c3aa14..0d27cd5 100644 --- a/cryptor/cryptor.go +++ b/cryptor/cryptor.go @@ -358,7 +358,7 @@ func (encrypted *EncryptedData) unwrapKey(cache *keycache.Cache, user string) (u func (c *Cryptor) Encrypt(in []byte, labels []string, access AccessStructure) (resp []byte, err error) { var encrypted EncryptedData encrypted.Version = DEFAULT_VERSION - if encrypted.VaultId, err = c.records.GetVaultId(); err != nil { + if encrypted.VaultId, err = c.records.GetVaultID(); err != nil { return } @@ -393,7 +393,7 @@ func (c *Cryptor) Encrypt(in []byte, labels []string, access AccessStructure) (r encrypted.Data = encryptedFile encrypted.Labels = labels - hmacKey, err := c.records.GetHmacKey() + hmacKey, err := c.records.GetHMACKey() if err != nil { return } @@ -416,7 +416,7 @@ func (c *Cryptor) Decrypt(in []byte, user string) (resp []byte, names []string, secure = encrypted.Version == -1 - hmacKey, err := c.records.GetHmacKey() + hmacKey, err := c.records.GetHMACKey() if err != nil { return } @@ -426,7 +426,7 @@ func (c *Cryptor) Decrypt(in []byte, user string) (resp []byte, names []string, } // make sure file was encrypted with the active vault - vaultId, err := c.records.GetVaultId() + vaultId, err := c.records.GetVaultID() if err != nil { return } diff --git a/passvault/passvault.go b/passvault/passvault.go index 3a434dc..d81df4d 100644 --- a/passvault/passvault.go +++ b/passvault/passvault.go @@ -465,12 +465,12 @@ func (records *Records) GetRecord(name string) (PasswordRecord, bool) { } // GetVaultId returns the id of the current vault. -func (records *Records) GetVaultId() (id int, err error) { +func (records *Records) GetVaultID() (id int, err error) { return records.VaultId, nil } // GetHmacKey returns the hmac key of the current vault. -func (records *Records) GetHmacKey() (key []byte, err error) { +func (records *Records) GetHMACKey() (key []byte, err error) { return records.HmacKey, nil } diff --git a/passvault/passvault_test.go b/passvault/passvault_test.go index 88b3daf..7516520 100644 --- a/passvault/passvault_test.go +++ b/passvault/passvault_test.go @@ -10,8 +10,10 @@ import ( ) func TestStaticVault(t *testing.T) { - // Initial create. - records, err := InitFrom("/tmp/redoctober.jso") + // Creates a temporary on-disk database to test if passvault can read and + // write from/to disk. It's deleted at the bottom of the function--this + // should be the only test that requires touching disk. + records, err := InitFrom("/tmp/redoctober.json") if err != nil { t.Fatalf("Error reading record") } @@ -27,7 +29,6 @@ func TestStaticVault(t *testing.T) { t.Fatalf("Error reading record") } - // Cleaning. os.Remove("/tmp/redoctober.json") }