Style changes

This commit is contained in:
Brendan Mc
2015-05-07 13:51:00 -07:00
parent 935b929dd5
commit ef80162f14
3 changed files with 10 additions and 9 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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")
}