From 37460f48c57889d577885ceb5a7d965774cc2f53 Mon Sep 17 00:00:00 2001 From: Benjamin Wenger <ben@elixxir.ioo> Date: Mon, 24 Oct 2022 13:09:08 -0700 Subject: [PATCH] fixed fucntion names and moved the salt system and renamed it --- bindings/channels.go | 9 +++++---- .../database.go => storage/utility/encryptionSalt.go | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) rename channels/database.go => storage/utility/encryptionSalt.go (94%) diff --git a/bindings/channels.go b/bindings/channels.go index 1fc12dbb2..2119f816b 100644 --- a/bindings/channels.go +++ b/bindings/channels.go @@ -13,6 +13,7 @@ import ( "github.com/pkg/errors" "gitlab.com/elixxir/client/channels" "gitlab.com/elixxir/client/cmix/rounds" + "gitlab.com/elixxir/client/storage/utility" "gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/client/xxdk" cryptoBroadcast "gitlab.com/elixxir/crypto/broadcast" @@ -1450,9 +1451,9 @@ type channelDbCipherTracker struct { mux sync.RWMutex } -// make create a ChannelDbCipher from a [channel.Cipher], assigns it a unique +// create creates a ChannelDbCipher from a [channel.Cipher], assigns it a unique // ID, and adds it to the channelDbCipherTracker. -func (ct *channelDbCipherTracker) make(c cryptoChannel.Cipher) *ChannelDbCipher { +func (ct *channelDbCipherTracker) create(c cryptoChannel.Cipher) *ChannelDbCipher { ct.mux.Lock() defer ct.mux.Unlock() @@ -1516,7 +1517,7 @@ func NewChannelsDatabaseCipher(cmixID int, password []byte, stream := user.api.GetRng().GetStream() // Load or generate a salt - salt, err := channels.NewOrLoadSalt( + salt, err := utility.NewOrLoadSalt( user.api.GetStorage().GetKV(), stream) if err != nil { return nil, err @@ -1530,7 +1531,7 @@ func NewChannelsDatabaseCipher(cmixID int, password []byte, } // Return a cipher - return channelDbCipherTrackerSingleton.make(c), nil + return channelDbCipherTrackerSingleton.create(c), nil } // GetID returns the ID for this ChannelDbCipher in the channelDbCipherTracker. diff --git a/channels/database.go b/storage/utility/encryptionSalt.go similarity index 94% rename from channels/database.go rename to storage/utility/encryptionSalt.go index c5d5b7d28..18b60c15d 100644 --- a/channels/database.go +++ b/storage/utility/encryptionSalt.go @@ -1,4 +1,4 @@ -package channels +package utility import ( jww "github.com/spf13/jwalterweatherman" @@ -9,9 +9,9 @@ import ( // Storage constats const ( - saltKey = "databaseSalt" + saltKey = "encryptionSalt" saltVersion = 0 - saltPrefix = "databaseSaltPrefix" + saltPrefix = "encryptionSaltPrefix" ) // saltSize is the defined size in bytes of the salt generated in -- GitLab