diff --git a/bindings/channels.go b/bindings/channels.go index 1fc12dbb2414bb8dc0f097cb64b7c3c1212fdc0d..2119f816bcbc323207586bb10e07b39c6b76aa88 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 c5d5b7d289c4fa34bbfd84a727c4bde514458289..18b60c15d4d9f3d39aba0d34fb7efb4877fd92e0 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