From 3b81ffe59014808637cbe10936bebb861e349872 Mon Sep 17 00:00:00 2001 From: Benjamin Wenger <ben@elixxir.ioo> Date: Thu, 3 Mar 2022 12:51:02 -0800 Subject: [PATCH] playing with interfaces --- interfaces/networkManager.go | 77 +++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/interfaces/networkManager.go b/interfaces/networkManager.go index 88d4623df..63e338d37 100644 --- a/interfaces/networkManager.go +++ b/interfaces/networkManager.go @@ -8,11 +8,14 @@ package interfaces import ( + "github.com/cloudflare/circl/dh/sidh" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/comms/network" + "gitlab.com/elixxir/crypto/contact" + "gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/e2e" "gitlab.com/elixxir/primitives/format" "gitlab.com/xx_network/primitives/id" @@ -22,8 +25,6 @@ import ( type NetworkManager interface { // 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) SendManyCMIX(messages []message.TargetedCmixMessage, p params.CMIX) (id.Round, []ephemeral.Id, error) GetInstance() *network.Instance @@ -52,6 +53,78 @@ type NetworkManager interface { // SetPoolFilter sets the filter used to filter gateway IDs. 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 -- GitLab