From 7a6b4c8ad025a3f84b12548ee318896a990a46bc Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Wed, 23 Sep 2020 09:46:18 -0700
Subject: [PATCH] partially added prefix

---
 storage/cmix/store.go           | 11 +++++++----
 storage/conversation/partner.go |  3 +--
 storage/conversation/store.go   |  3 +++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/storage/cmix/store.go b/storage/cmix/store.go
index 9a34000ec..f308eb5b3 100644
--- a/storage/cmix/store.go
+++ b/storage/cmix/store.go
@@ -20,11 +20,12 @@ import (
 	"time"
 )
 
+const prefix = "cmix"
 const currentStoreVersion = 0
-const storeKey = "cmixKeyStore"
-const pubKeyKey = "cmixDhPubKey"
-const privKeyKey = "cmixDhPrivKey"
-const grpKey = "cmixGroupKey"
+const storeKey = "KeyStore"
+const pubKeyKey = "DhPubKey"
+const privKeyKey = "DhPrivKey"
+const grpKey = "GroupKey"
 
 type Store struct {
 	nodes        map[id.ID]*key
@@ -42,6 +43,7 @@ type Store struct {
 func NewStore(grp *cyclic.Group, kv *versioned.KV, priv *cyclic.Int) (*Store, error) {
 	//generate public key
 	pub := diffieHellman.GeneratePublicKey(priv, grp)
+	kv = kv.Prefix(prefix)
 
 	s := &Store{
 		nodes:        make(map[id.ID]*key),
@@ -75,6 +77,7 @@ func NewStore(grp *cyclic.Group, kv *versioned.KV, priv *cyclic.Int) (*Store, er
 
 // loads the cmix storage object
 func LoadStore(kv *versioned.KV) (*Store, error) {
+	kv = kv.Prefix(prefix)
 	s := &Store{
 		nodes: make(map[id.ID]*key),
 		kv:    kv,
diff --git a/storage/conversation/partner.go b/storage/conversation/partner.go
index 3533f65fd..f13f133b2 100644
--- a/storage/conversation/partner.go
+++ b/storage/conversation/partner.go
@@ -13,7 +13,6 @@ import (
 )
 
 const (
-	conversationKeyPrefix      = "conversation"
 	currentConversationVersion = 0
 	maxTruncatedID             = math.MaxUint32
 	bottomRegion               = maxTruncatedID / 4
@@ -182,5 +181,5 @@ func (c *Conversation) marshal() ([]byte, error) {
 }
 
 func makeConversationKey(partner *id.ID) string {
-	return conversationKeyPrefix + ":" + partner.String()
+	return partner.String()
 }
diff --git a/storage/conversation/store.go b/storage/conversation/store.go
index 80803ecab..ffae85164 100644
--- a/storage/conversation/store.go
+++ b/storage/conversation/store.go
@@ -6,6 +6,8 @@ import (
 	"sync"
 )
 
+const conversationKeyPrefix = "conversation"
+
 type Store struct {
 	loadedConversations map[id.ID]*Conversation
 	kv                  *versioned.KV
@@ -14,6 +16,7 @@ type Store struct {
 
 //Returns a new conversation store made off of the KV
 func NewStore(kv *versioned.KV) *Store {
+	kv = kv.Prefix(conversationKeyPrefix)
 	return &Store{
 		loadedConversations: make(map[id.ID]*Conversation),
 		kv:                  kv,
-- 
GitLab