Skip to content
Snippets Groups Projects
Commit 40b0df72 authored by Josh Brooks's avatar Josh Brooks
Browse files

Merge branch 'XX-3437/DeleteFactAuth' into 'release'

Add fact signature to RemoveFact

See merge request !10
parents bca7ca51 eda46adc
No related branches found
No related tags found
2 merge requests!23Release,!10Add fact signature to RemoveFact
...@@ -246,7 +246,6 @@ func Login(storageDir string, password []byte, parameters params.Network) (*Clie ...@@ -246,7 +246,6 @@ func Login(storageDir string, password []byte, parameters params.Network) (*Clie
// initialize the auth tracker // initialize the auth tracker
c.auth = auth.NewManager(c.switchboard, c.storage, c.network) c.auth = auth.NewManager(c.switchboard, c.storage, c.network)
// Add all processes to the followerServices // Add all processes to the followerServices
err = c.registerFollower() err = c.registerFollower()
if err != nil { if err != nil {
......
...@@ -11,8 +11,8 @@ package cmd ...@@ -11,8 +11,8 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
) )
// initCmd creates a new user object with the given NDF // initCmd creates a new user object with the given NDF
......
...@@ -17,7 +17,7 @@ require ( ...@@ -17,7 +17,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/viper v1.7.1 github.com/spf13/viper v1.7.1
gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228
gitlab.com/elixxir/comms v0.0.4-0.20210820163054-c177e37ef3d1 gitlab.com/elixxir/comms v0.0.4-0.20210820174341-535c11488dd0
gitlab.com/elixxir/crypto v0.0.7-0.20210803232056-ba3ff44cc618 gitlab.com/elixxir/crypto v0.0.7-0.20210803232056-ba3ff44cc618
gitlab.com/elixxir/ekv v0.1.5 gitlab.com/elixxir/ekv v0.1.5
gitlab.com/elixxir/primitives v0.0.3-0.20210803231939-7b924f78eaac gitlab.com/elixxir/primitives v0.0.3-0.20210803231939-7b924f78eaac
......
...@@ -253,6 +253,8 @@ gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 h1:Gi6rj4mAlK0 ...@@ -253,6 +253,8 @@ gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 h1:Gi6rj4mAlK0
gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k= gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k=
gitlab.com/elixxir/comms v0.0.4-0.20210820163054-c177e37ef3d1 h1:NthGhjTb+oEy4KR0Lmbk8Oq12/Xeai9UvvDEHyQy4+Y= gitlab.com/elixxir/comms v0.0.4-0.20210820163054-c177e37ef3d1 h1:NthGhjTb+oEy4KR0Lmbk8Oq12/Xeai9UvvDEHyQy4+Y=
gitlab.com/elixxir/comms v0.0.4-0.20210820163054-c177e37ef3d1/go.mod h1:1fHnPjj5Sv2qfnQplu8+BKlehQy54vtgM7khp5axXMU= gitlab.com/elixxir/comms v0.0.4-0.20210820163054-c177e37ef3d1/go.mod h1:1fHnPjj5Sv2qfnQplu8+BKlehQy54vtgM7khp5axXMU=
gitlab.com/elixxir/comms v0.0.4-0.20210820174341-535c11488dd0 h1:gapAJ4Fi8jRDwkpgsb6r2hpi0xXMMRYBv5Jf1B8kwM4=
gitlab.com/elixxir/comms v0.0.4-0.20210820174341-535c11488dd0/go.mod h1:1fHnPjj5Sv2qfnQplu8+BKlehQy54vtgM7khp5axXMU=
gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c= gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c=
gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA= gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA=
gitlab.com/elixxir/crypto v0.0.7-0.20210803232056-ba3ff44cc618 h1:Z1SI2a8mXP4Zf2xfhURT1Hbmtq3tufTdebNLgCdlufg= gitlab.com/elixxir/crypto v0.0.7-0.20210803232056-ba3ff44cc618 h1:Z1SI2a8mXP4Zf2xfhURT1Hbmtq3tufTdebNLgCdlufg=
......
...@@ -123,7 +123,6 @@ func TestValidFilterRange(t *testing.T) { ...@@ -123,7 +123,6 @@ func TestValidFilterRange(t *testing.T) {
}, },
} }
bloomFilter := &mixmessages.ClientBloom{ bloomFilter := &mixmessages.ClientBloom{
Filter: data, Filter: data,
FirstRound: firstRound, FirstRound: firstRound,
...@@ -180,7 +179,6 @@ func TestValidFilterRange_OutBounds(t *testing.T) { ...@@ -180,7 +179,6 @@ func TestValidFilterRange_OutBounds(t *testing.T) {
}, },
} }
bloomFilter := &mixmessages.ClientBloom{ bloomFilter := &mixmessages.ClientBloom{
Filter: data, Filter: data,
FirstRound: firstRound, FirstRound: firstRound,
......
package ud package ud
import ( import (
"crypto/rand"
"github.com/pkg/errors" "github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/crypto/factID"
"gitlab.com/elixxir/crypto/hash"
"gitlab.com/elixxir/primitives/fact" "gitlab.com/elixxir/primitives/fact"
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/comms/messages" "gitlab.com/xx_network/comms/messages"
"gitlab.com/xx_network/crypto/signature/rsa"
) )
type removeFactComms interface { type removeFactComms interface {
SendDeleteMessage(host *connect.Host, message *mixmessages.FactRemovalRequest) (*messages.Ack, error) SendRemoveFact(host *connect.Host, message *mixmessages.FactRemovalRequest) (*messages.Ack, error)
} }
// Removes a previously confirmed fact. Will fail if the fact is not // Removes a previously confirmed fact. Will fail if the fact is not
...@@ -33,14 +37,24 @@ func (m *Manager) removeFact(fact fact.Fact, rFC removeFactComms) error { ...@@ -33,14 +37,24 @@ func (m *Manager) removeFact(fact fact.Fact, rFC removeFactComms) error {
FactType: uint32(fact.T), FactType: uint32(fact.T),
} }
// Create a hash of our fact
fhash := factID.Fingerprint(fact)
// Sign our inFact for putting into the request
fsig, err := rsa.Sign(rand.Reader, m.privKey, hash.CMixHash, fhash, nil)
if err != nil {
return err
}
// Create our Fact Removal Request message data // Create our Fact Removal Request message data
remFactMsg := mixmessages.FactRemovalRequest{ remFactMsg := mixmessages.FactRemovalRequest{
UID: m.myID.Marshal(), UID: m.myID.Marshal(),
RemovalData: &mmFact, RemovalData: &mmFact,
FactSig: fsig,
} }
// Send the message // Send the message
_, err := rFC.SendDeleteMessage(m.host, &remFactMsg) _, err = rFC.SendRemoveFact(m.host, &remFactMsg)
// Return the error // Return the error
return err return err
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
type testRFC struct{} type testRFC struct{}
func (rFC *testRFC) SendDeleteMessage(host *connect.Host, message *pb.FactRemovalRequest) (*messages.Ack, error) { func (rFC *testRFC) SendRemoveFact(host *connect.Host, message *pb.FactRemovalRequest) (*messages.Ack, error) {
return &messages.Ack{}, nil return &messages.Ack{}, nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment