Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Aug 8, 2024
1 parent 1aafe65 commit 5cd8977
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 43 deletions.
4 changes: 2 additions & 2 deletions internal/encryption/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ func NewRequestKeysMessage(
// NewKeysRetrievedMessage creates a new event message for a key that was retrieved
func NewKeysRetrievedMessage(
schemaRoot string,
data map[core.EncStoreDocKey][]byte,
keys map[core.EncStoreDocKey][]byte,
) event.Message {
return event.NewMessage(KeysRetrievedEventName, KeyRetrievedEvent{
SchemaRoot: schemaRoot,
Keys: data,
Keys: keys,
})
}
2 changes: 1 addition & 1 deletion net/pb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ clean:
rm -f *.pb.go
rm -f *pb_test.go

.PHONY: clean deps debug
.PHONY: clean deps
6 changes: 3 additions & 3 deletions net/server_encryption_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ import (

const encryptionTopic = "encryption"

// Server is the request/response instance for all P2P RPC communication.
// Implements gRPC server. See net/pb/net.proto for corresponding service definitions.
// getEncryptionKeys retrieves the encryption keys for the given targets.
// It returns the encryption keys and the targets for which the keys were found.
func (s *server) getEncryptionKeys(
ctx context.Context,
req *pb.FetchEncryptionKeyRequest,
) ([]byte, []*pb.EncryptionKeyTarget, error) {
encryptionKeys := make([]byte, 0)
targets := make([]*pb.EncryptionKeyTarget, 0)
targets := make([]*pb.EncryptionKeyTarget, 0, len(req.Targets))
for _, target := range req.Targets {
docID, err := client.NewDocIDFromString(string(target.DocID))
if err != nil {
Expand Down
37 changes: 0 additions & 37 deletions tests/integration/encryption/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,6 @@ import (
testUtils "github.com/sourcenetwork/defradb/tests/integration"
)

/*func TestDocEncryptionPeer_IfPeerHasNoKey_ShouldNotFetch(t *testing.T) {
test := testUtils.TestCase{
Actions: []any{
testUtils.RandomNetworkingConfig(),
testUtils.RandomNetworkingConfig(),
updateUserCollectionSchema(),
testUtils.ConnectPeers{
SourceNodeID: 1,
TargetNodeID: 0,
},
testUtils.SubscribeToCollection{
NodeID: 1,
CollectionIDs: []int{0},
},
testUtils.CreateDoc{
NodeID: immutable.Some(0),
Doc: john21Doc,
IsDocEncrypted: true,
},
testUtils.WaitForSync{},
testUtils.Request{
NodeID: immutable.Some(1),
Request: `query {
Users {
age
}
}`,
Results: map[string]any{
"Users": []map[string]any{},
},
},
},
}
testUtils.ExecuteTestCase(t, test)
}*/

func TestDocEncryptionPeer_UponSync_ShouldSyncEncryptedDAG(t *testing.T) {
test := testUtils.TestCase{
Actions: []any{
Expand Down

0 comments on commit 5cd8977

Please sign in to comment.