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
ad7bb9a0
Commit
ad7bb9a0
authored
Nov 20, 2020
by
Sydney Anne Erickson
Browse files
Options
Downloads
Plain Diff
Merge branch 'Anne/FactCommsHotfix' into 'Ursula/UD'
Fix SendDeleteMessage See merge request
!463
parents
65ec2a3d
0468b2d1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
globals/version_vars.go
+8
-7
8 additions, 7 deletions
globals/version_vars.go
ud/remove.go
+2
-35
2 additions, 35 deletions
ud/remove.go
ud/remove_test.go
+3
-28
3 additions, 28 deletions
ud/remove_test.go
with
13 additions
and
70 deletions
globals/version_vars.go
+
8
−
7
View file @
ad7bb9a0
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2020-11-
0
9 13:
57:29.571995
-0800 PST m=+0.0
22551937
// 2020-11-
1
9 13:
39:33.271593
-0800 PST m=+0.0
18178459
package
globals
const
GITVERSION
=
`
4adb5fe made skeleton
for remove
f
act`
const
GITVERSION
=
`
df5c21e Fix tests
for remove
F
act`
const
SEMVER
=
"1.4.0"
const
DEPENDENCIES
=
`module gitlab.com/elixxir/client
...
...
@@ -24,13 +24,14 @@ require (
github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.1
gitlab.com/elixxir/comms v0.0.4-0.20201103220934-c476c9282f30
gitlab.com/elixxir/crypto v0.0.5-0.20201109203841-ba162a25be6e
gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228
gitlab.com/elixxir/comms v0.0.4-0.20201116233755-b476dea10095
gitlab.com/elixxir/crypto v0.0.5-0.20201118204646-9b23991834c6
gitlab.com/elixxir/ekv v0.1.3
gitlab.com/elixxir/primitives v0.0.
2
gitlab.com/xx_network/comms v0.0.
3
gitlab.com/elixxir/primitives v0.0.
3-0.20201116174806-97f190989704
gitlab.com/xx_network/comms v0.0.
4-0.20201118225304-345dad24bb1e
gitlab.com/xx_network/crypto v0.0.4
gitlab.com/xx_network/primitives v0.0.
2
gitlab.com/xx_network/primitives v0.0.
3-0.20201116234927-44e42fc91e7c
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
google.golang.org/protobuf v1.25.0
gopkg.in/ini.v1 v1.61.0 // indirect
...
...
...
...
This diff is collapsed.
Click to expand it.
ud/remove.go
+
2
−
35
View file @
ad7bb9a0
package
ud
import
(
"crypto/rand"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/any"
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/crypto/hash"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/comms/messages"
"gitlab.com/xx_network/crypto/signature/rsa"
)
type
removeFactComms
interface
{
SendDeleteMessage
(
host
*
connect
.
Host
,
message
*
messages
.
AuthenticatedMessage
)
(
*
messages
.
Ack
,
error
)
SendDeleteMessage
(
host
*
connect
.
Host
,
message
*
mix
messages
.
FactRemovalRequest
)
(
*
messages
.
Ack
,
error
)
}
func
(
m
*
Manager
)
RemoveFact
(
fact
fact
.
Fact
)
error
{
...
...
@@ -28,42 +23,14 @@ func (m *Manager) removeFact(fact fact.Fact, rFC removeFactComms) error {
FactType
:
uint32
(
fact
.
T
),
}
// Sign the fact
signedFact
,
err
:=
rsa
.
Sign
(
rand
.
Reader
,
m
.
privKey
,
hash
.
CMixHash
,
mmFact
.
Digest
(),
rsa
.
NewDefaultOptions
())
if
err
!=
nil
{
return
err
}
// Create our Fact Removal Request message data
remFactMsg
:=
mixmessages
.
FactRemovalRequest
{
UID
:
m
.
host
.
GetId
()
.
Marshal
(),
RemovalData
:
&
mmFact
,
}
// Marshal it to bytes for sending over the wire
remFactMsgMarshalled
,
err
:=
proto
.
Marshal
(
&
remFactMsg
)
if
err
!=
nil
{
return
err
}
// Convert our marshalled Fact Removal Request to an Any
// object for sending in an authed message
remFactMsgAny
:=
any
.
Any
{
TypeUrl
:
"gitlab.com/elixxir/client/interfaces/contact.Fact"
,
Value
:
remFactMsgMarshalled
,
}
// Create our AuthenticatedMessage so we can send the data over
msg
:=
messages
.
AuthenticatedMessage
{
ID
:
nil
,
Signature
:
signedFact
,
Token
:
nil
,
Client
:
nil
,
Message
:
&
remFactMsgAny
,
}
// Send the message
_
,
err
=
rFC
.
SendDeleteMessage
(
m
.
host
,
&
m
sg
)
_
,
err
:
=
rFC
.
SendDeleteMessage
(
m
.
host
,
&
remFactM
sg
)
// Return the error
return
err
...
...
...
...
This diff is collapsed.
Click to expand it.
ud/remove_test.go
+
3
−
28
View file @
ad7bb9a0
package
ud
import
(
"gitlab.com/elixxir/comms/client"
"gitlab.com/elixxir/crypto/cyclic"
pb
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/comms/messages"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/large"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
"testing"
)
var
genericGroup
=
cyclic
.
NewGroup
(
large
.
NewIntFromString
(
"9DB6FB5951B66BB6FE1E140F1D2CE5502374161FD6538DF1648218642F0B5C48"
+
"C8F7A41AADFA187324B87674FA1822B00F1ECF8136943D7C55757264E5A1A44F"
+
"FE012E9936E00C1D3E9310B01C7D179805D3058B2A9F4BB6F9716BFE6117C6B5"
+
"B3CC4D9BE341104AD4A80AD6C94E005F4B993E14F091EB51743BF33050C38DE2"
+
"35567E1B34C3D6A5C0CEAA1A0F368213C3D19843D0B4B09DCB9FC72D39C8DE41"
+
"F1BF14D4BB4563CA28371621CAD3324B6A2D392145BEBFAC748805236F5CA2FE"
+
"92B871CD8F9C36D3292B5509CA8CAA77A2ADFC7BFD77DDA6F71125A7456FEA15"
+
"3E433256A2261C6A06ED3693797E7995FAD5AABBCFBE3EDA2741E375404AE25B"
,
16
),
large
.
NewIntFromString
(
"5C7FF6B06F8F143FE8288433493E4769C4D988ACE5BE25A0E24809670716C613"
+
"D7B0CEE6932F8FAA7C44D2CB24523DA53FBE4F6EC3595892D1AA58C4328A06C4"
+
"6A15662E7EAA703A1DECF8BBB2D05DBE2EB956C142A338661D10461C0D135472"
+
"085057F3494309FFA73C611F78B32ADBB5740C361C9F35BE90997DB2014E2EF5"
+
"AA61782F52ABEB8BD6432C4DD097BC5423B285DAFB60DC364E8161F4A2A35ACA"
+
"3A10B1C4D203CC76A470A33AFDCBDD92959859ABD8B56E1725252D78EAC66E71"
+
"BA9AE3F1DD2487199874393CD4D832186800654760E1E34C09E4D155179F9EC0"
+
"DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7"
,
16
))
type
testRFC
struct
{}
func
(
rFC
*
testRFC
)
SendDeleteMessage
(
host
*
connect
.
Host
,
message
*
messages
.
AuthenticatedMessage
)
(
*
messages
.
Ack
,
error
)
{
func
(
rFC
*
testRFC
)
SendDeleteMessage
(
host
*
connect
.
Host
,
message
*
pb
.
FactRemovalRequest
)
(
*
messages
.
Ack
,
error
)
{
return
&
messages
.
Ack
{},
nil
}
func
TestRemoveFact
(
t
*
testing
.
T
)
{
c
,
err
:=
client
.
NewClientComms
(
&
id
.
DummyUser
,
nil
,
nil
,
nil
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
h
,
err
:=
connect
.
NewHost
(
&
id
.
DummyUser
,
"address"
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -55,7 +30,7 @@ func TestRemoveFact(t *testing.T) {
}
m
:=
Manager
{
comms
:
c
,
comms
:
nil
,
host
:
h
,
privKey
:
cpk
,
}
...
...
...
...
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
sign in
to comment