Skip to content
Snippets Groups Projects
Commit 7a6b4c8a authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

partially added prefix

parent 1e7552fe
Branches
Tags
No related merge requests found
......@@ -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,
......
......@@ -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()
}
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment