diff --git a/storage/cmix/store.go b/storage/cmix/store.go index 9a34000ec3c7e9c28b36c6e39304ca08b3b2e6d8..f308eb5b34950ebc977cd22c3068f5114c84cf4e 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 3533f65fd6ce51382fb0ec77507da6b92583aa14..f13f133b22cd1521e0c6520436dec70cae1d6b6e 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 80803ecab81a445d311bcf871b95726f25284c4c..ffae85164764afb8de6ada964e0083120a3af32e 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,