From 923804458d5d7ab9986b403084738e5d0e57b0a6 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 7 May 2015 15:35:07 -0700 Subject: [PATCH] goimports and go vet cleanups. --- core/core.go | 10 +++++++--- ecdh/ecdh.go | 1 + keycache/keycache_test.go | 5 +++-- passvault/passvault.go | 9 +++++---- symcrypt/symcrypt_test.go | 3 ++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/core/core.go b/core/core.go index b182026..f849ef9 100644 --- a/core/core.go +++ b/core/core.go @@ -155,7 +155,7 @@ func Init(path string) (err error) { err = fmt.Errorf("Failed to load password vault %s: %s", path, err) } - cache = keycache.Cache{make(map[string]keycache.ActiveUser)} + cache = keycache.Cache{UserKeys: make(map[string]keycache.ActiveUser)} crypt = cryptor.New(&records, &cache) return @@ -279,8 +279,12 @@ func Encrypt(jsonIn []byte) ([]byte, error) { return jsonStatusError(err) } - // Encrypt file - access := cryptor.AccessStructure{s.Owners, s.LeftOwners, s.RightOwners} + access := cryptor.AccessStructure{ + Names: s.Owners, + LeftNames: s.LeftOwners, + RightNames: s.RightOwners, + } + if resp, err := crypt.Encrypt(s.Data, s.Labels, access); err != nil { log.Println("Error encrypting:", err) return jsonStatusError(err) diff --git a/ecdh/ecdh.go b/ecdh/ecdh.go index 77b09a2..91b436b 100644 --- a/ecdh/ecdh.go +++ b/ecdh/ecdh.go @@ -13,6 +13,7 @@ import ( "crypto/sha1" "crypto/sha256" "errors" + "github.com/cloudflare/redoctober/padding" "github.com/cloudflare/redoctober/symcrypt" ) diff --git a/keycache/keycache_test.go b/keycache/keycache_test.go index e70f640..df7995e 100644 --- a/keycache/keycache_test.go +++ b/keycache/keycache_test.go @@ -5,10 +5,11 @@ package keycache import ( "bytes" - "github.com/cloudflare/redoctober/passvault" - "github.com/cloudflare/redoctober/symcrypt" "testing" "time" + + "github.com/cloudflare/redoctober/passvault" + "github.com/cloudflare/redoctober/symcrypt" ) func TestUsesFlush(t *testing.T) { diff --git a/passvault/passvault.go b/passvault/passvault.go index d81df4d..9990e9e 100644 --- a/passvault/passvault.go +++ b/passvault/passvault.go @@ -18,14 +18,15 @@ import ( "encoding/binary" "encoding/json" "errors" - "github.com/cloudflare/redoctober/ecdh" - "github.com/cloudflare/redoctober/padding" - "github.com/cloudflare/redoctober/symcrypt" - "golang.org/x/crypto/scrypt" "io/ioutil" "math/big" mrand "math/rand" "os" + + "github.com/cloudflare/redoctober/ecdh" + "github.com/cloudflare/redoctober/padding" + "github.com/cloudflare/redoctober/symcrypt" + "golang.org/x/crypto/scrypt" ) // Constants for record type diff --git a/symcrypt/symcrypt_test.go b/symcrypt/symcrypt_test.go index 0a76a3a..d602abd 100644 --- a/symcrypt/symcrypt_test.go +++ b/symcrypt/symcrypt_test.go @@ -2,8 +2,9 @@ package symcrypt import ( "bytes" - "github.com/cloudflare/redoctober/padding" "testing" + + "github.com/cloudflare/redoctober/padding" ) func TestCrypt(t *testing.T) {