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

playing with interfaces

parent ef61cb65
No related branches found
No related tags found
3 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast
...@@ -8,11 +8,14 @@ ...@@ -8,11 +8,14 @@
package interfaces package interfaces
import ( import (
"github.com/cloudflare/circl/dh/sidh"
"gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/message"
"gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/interfaces/params"
"gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/stoppable"
"gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/e2e" "gitlab.com/elixxir/crypto/e2e"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
...@@ -22,8 +25,6 @@ import ( ...@@ -22,8 +25,6 @@ import (
type NetworkManager interface { type NetworkManager interface {
// The stoppable can be nil. // The stoppable can be nil.
SendE2E(m message.Send, p params.E2E, stop *stoppable.Single) ([]id.Round, e2e.MessageID, time.Time, error)
SendUnsafe(m message.Send, p params.Unsafe) ([]id.Round, error)
SendCMIX(message format.Message, recipient *id.ID, p params.CMIX) (id.Round, ephemeral.Id, error) SendCMIX(message format.Message, recipient *id.ID, p params.CMIX) (id.Round, ephemeral.Id, error)
SendManyCMIX(messages []message.TargetedCmixMessage, p params.CMIX) (id.Round, []ephemeral.Id, error) SendManyCMIX(messages []message.TargetedCmixMessage, p params.CMIX) (id.Round, []ephemeral.Id, error)
GetInstance() *network.Instance GetInstance() *network.Instance
...@@ -52,6 +53,78 @@ type NetworkManager interface { ...@@ -52,6 +53,78 @@ type NetworkManager interface {
// SetPoolFilter sets the filter used to filter gateway IDs. // SetPoolFilter sets the filter used to filter gateway IDs.
SetPoolFilter(f gateway.Filter) SetPoolFilter(f gateway.Filter)
/* Identities are all network identites which the client is currently
trying to pick up message on. Each identity has a defult edge
pickup that it will receive on, but this default is generally
low privacy and an alternative should be used in most cases
all identities imply a default edge. An identity must be added,
fake ones will be used to poll the network if none are present */
// AddIdentity adds an identity to be tracked
AddIdentity(identity Identity)
// RemoveIdentity removes a currently tracked identity.
RemoveIdentity(ephID ephemeral.Id)
//fingerprints
AddFingerprint(fingerprint format.Fingerprint, response FingerprintResponse)
CheckFingerprint(fingerprint format.Fingerprint)bool
RemoveFingerprint(fingerprint format.Fingerprint)bool
/* trigger - predefined hash based tags appended to all cmix messages
which, though trial hashing, are used to determine if a message
is for a specific identity, can can contain metadata about
the sending party
These can be processed by the notifications system, or can be used to*/
AddEdge(preimage EdgePreimage, identity *id.ID)
RemoveEdge(preimage EdgePreimage, identity *id.ID) error
}
type EdgePreimage struct{
Data []byte
Type string
Source []byte
}
type Identity struct {
// Identity
EphId ephemeral.Id
Source *id.ID
AddressSize uint8
// Usage variables
End time.Time // Timestamp when active polling will stop
ExtraChecks uint // Number of extra checks executed as active after the
// ID exits active
// Polling parameters
StartValid time.Time // Timestamp when the ephID begins being valid
EndValid time.Time // Timestamp when the ephID stops being valid
// Makes the identity not store on disk
Ephemeral bool
}
type FingerprintResponse func(format.Message)
type Ratchet interface {
SendE2E(m message.Send, p params.E2E, stop *stoppable.Single) ([]id.Round, e2e.MessageID, time.Time, error)
SendUnsafe(m message.Send, p params.Unsafe) ([]id.Round, error)
AddPartner(partnerID *id.ID, partnerPubKey,
myPrivKey *cyclic.Int, partnerSIDHPubKey *sidh.PublicKey,
mySIDHPrivKey *sidh.PrivateKey,
sendParams, receiveParams params.E2ESessionParams)
GetPartner(partnerID *id.ID) (*Manager, error)
DeletePartner(partnerId *id.ID)
GetAllPartnerIDs() []*id.ID
} }
//for use in key exchange which needs to be callable inside of network //for use in key exchange which needs to be callable inside of network
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment