Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
3c569580
Commit
3c569580
authored
Apr 5, 2022
by
Jono Wenger
Browse files
Options
Downloads
Plain Diff
Merge branch 'release' of git.xx.network:elixxir/client into hotfix/improvedRestore
parents
57bb2d40
085eee01
No related branches found
No related tags found
3 merge requests
!233
Modify restore to call user-defined bindings callback. Add Sent requests to...
,
!231
Revert "Update store to print changes to the partners list"
,
!192
Hotfix/improved restore
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backup/backup.go
+1
-1
1 addition, 1 deletion
backup/backup.go
backup/backup_test.go
+32
-0
32 additions, 0 deletions
backup/backup_test.go
storage/e2e/store.go
+2
-1
2 additions, 1 deletion
storage/e2e/store.go
with
35 additions
and
2 deletions
backup/backup.go
+
1
−
1
View file @
3c569580
...
@@ -316,7 +316,7 @@ func (b *Backup) assembleBackup() backup.Backup {
...
@@ -316,7 +316,7 @@ func (b *Backup) assembleBackup() backup.Backup {
jww
.
INFO
.
Printf
(
"backup saved %d contacts after deduplication"
,
jww
.
INFO
.
Printf
(
"backup saved %d contacts after deduplication"
,
len
(
bu
.
Contacts
.
Identities
))
len
(
bu
.
Contacts
.
Identities
))
//
a
dd the memoized
json
params
//
A
dd the memoized
JSON
params
bu
.
JSONParams
=
b
.
jsonParams
bu
.
JSONParams
=
b
.
jsonParams
return
bu
return
bu
...
...
This diff is collapsed.
Click to expand it.
backup/backup_test.go
+
32
−
0
View file @
3c569580
...
@@ -9,7 +9,13 @@ package backup
...
@@ -9,7 +9,13 @@ package backup
import
(
import
(
"bytes"
"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"
"reflect"
"sort"
"strings"
"strings"
"testing"
"testing"
"time"
"time"
...
@@ -376,6 +382,22 @@ func TestBackup_assembleBackup(t *testing.T) {
...
@@ -376,6 +382,22 @@ func TestBackup_assembleBackup(t *testing.T) {
b
:=
newTestBackup
(
"MySuperSecurePassword"
,
nil
,
t
)
b
:=
newTestBackup
(
"MySuperSecurePassword"
,
nil
,
t
)
s
:=
b
.
store
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
{
expectedCollatedBackup
:=
backup
.
Backup
{
RegistrationTimestamp
:
s
.
GetUser
()
.
RegistrationTimestamp
,
RegistrationTimestamp
:
s
.
GetUser
()
.
RegistrationTimestamp
,
TransmissionIdentity
:
backup
.
TransmissionIdentity
{
TransmissionIdentity
:
backup
.
TransmissionIdentity
{
...
@@ -400,6 +422,16 @@ func TestBackup_assembleBackup(t *testing.T) {
...
@@ -400,6 +422,16 @@ func TestBackup_assembleBackup(t *testing.T) {
collatedBackup
:=
b
.
assembleBackup
()
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
)
{
if
!
reflect
.
DeepEqual
(
expectedCollatedBackup
,
collatedBackup
)
{
t
.
Errorf
(
"Collated backup does not match expected."
+
t
.
Errorf
(
"Collated backup does not match expected."
+
"
\n
expected: %+v
\n
received: %+v"
,
"
\n
expected: %+v
\n
received: %+v"
,
...
...
This diff is collapsed.
Click to expand it.
storage/e2e/store.go
+
2
−
1
View file @
3c569580
...
@@ -255,7 +255,8 @@ func (s *Store) GetPartners() []*id.ID {
...
@@ -255,7 +255,8 @@ func (s *Store) GetPartners() []*id.ID {
partnerIds
:=
make
([]
*
id
.
ID
,
0
,
len
(
s
.
managers
))
partnerIds
:=
make
([]
*
id
.
ID
,
0
,
len
(
s
.
managers
))
for
partnerId
:=
range
s
.
managers
{
for
partnerId
:=
range
s
.
managers
{
partnerIds
=
append
(
partnerIds
,
&
partnerId
)
pid
:=
partnerId
partnerIds
=
append
(
partnerIds
,
&
pid
)
}
}
return
partnerIds
return
partnerIds
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment