Skip to content
Snippets Groups Projects
Commit 3c569580 authored by Jono Wenger's avatar Jono Wenger
Browse files

Merge branch 'release' of git.xx.network:elixxir/client into hotfix/improvedRestore

parents 57bb2d40 085eee01
Branches
Tags
3 merge requests!233Modify restore to call user-defined bindings callback. Add Sent requests to...,!231Revert "Update store to print changes to the partners list",!192Hotfix/improved restore
......@@ -316,7 +316,7 @@ func (b *Backup) assembleBackup() backup.Backup {
jww.INFO.Printf("backup saved %d contacts after deduplication",
len(bu.Contacts.Identities))
//add the memoized json params
// Add the memoized JSON params
bu.JSONParams = b.jsonParams
return bu
......
......
......@@ -9,7 +9,13 @@ package backup
import (
"bytes"
"github.com/cloudflare/circl/dh/sidh"
"gitlab.com/elixxir/client/interfaces/params"
util "gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/crypto/diffieHellman"
"gitlab.com/xx_network/primitives/id"
"reflect"
"sort"
"strings"
"testing"
"time"
......@@ -376,6 +382,22 @@ func TestBackup_assembleBackup(t *testing.T) {
b := newTestBackup("MySuperSecurePassword", nil, t)
s := b.store
rng := csprng.NewSystemRNG()
for i := 0; i < 10; i++ {
recipient, _ := id.NewRandomID(rng, id.User)
dhKey := s.E2e().GetGroup().NewInt(int64(i + 10))
pubKey := diffieHellman.GeneratePublicKey(dhKey, s.E2e().GetGroup())
_, mySidhPriv := util.GenerateSIDHKeyPair(sidh.KeyVariantSidhA, rng)
theirSidhPub, _ := util.GenerateSIDHKeyPair(sidh.KeyVariantSidhB, rng)
p := params.GetDefaultE2ESessionParams()
err := s.E2e().AddPartner(
recipient, pubKey, dhKey, mySidhPriv, theirSidhPub, p, p)
if err != nil {
t.Errorf("Failed to add partner %s: %+v", recipient, err)
}
}
expectedCollatedBackup := backup.Backup{
RegistrationTimestamp: s.GetUser().RegistrationTimestamp,
TransmissionIdentity: backup.TransmissionIdentity{
......@@ -400,6 +422,16 @@ func TestBackup_assembleBackup(t *testing.T) {
collatedBackup := b.assembleBackup()
sort.Slice(expectedCollatedBackup.Contacts.Identities, func(i, j int) bool {
return bytes.Compare(expectedCollatedBackup.Contacts.Identities[i].Bytes(),
expectedCollatedBackup.Contacts.Identities[j].Bytes()) == -1
})
sort.Slice(collatedBackup.Contacts.Identities, func(i, j int) bool {
return bytes.Compare(collatedBackup.Contacts.Identities[i].Bytes(),
collatedBackup.Contacts.Identities[j].Bytes()) == -1
})
if !reflect.DeepEqual(expectedCollatedBackup, collatedBackup) {
t.Errorf("Collated backup does not match expected."+
"\nexpected: %+v\nreceived: %+v",
......
......
......@@ -255,7 +255,8 @@ func (s *Store) GetPartners() []*id.ID {
partnerIds := make([]*id.ID, 0, len(s.managers))
for partnerId := range s.managers {
partnerIds = append(partnerIds, &partnerId)
pid := partnerId
partnerIds = append(partnerIds, &pid)
}
return partnerIds
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment