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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
50f2a890
Commit
50f2a890
authored
3 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
next step in designign the interface
parent
07a8db5b
No related branches found
No related tags found
3 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
interfaces/networkManager.go
+65
-32
65 additions, 32 deletions
interfaces/networkManager.go
with
65 additions
and
32 deletions
interfaces/networkManager.go
+
65
−
32
View file @
50f2a890
...
...
@@ -55,46 +55,70 @@ type NetworkManager interface {
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
ed
ge
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 */
trying to pick up message on. Each identity has a def
a
ult
trig
ge
r
pickup that it will receive on, but this default is generally
low privacy and an alternative should be used in most cases
. An identity must be added
to receive messages, fake ones will be used to poll the network
if none are present
.
*/
// AddIdentity adds an identity to be tracked
AddIdentity
(
i
dentity
Identity
)
AddIdentity
(
I
dentity
,
Identity
Params
)
// RemoveIdentity removes a currently tracked identity.
RemoveIdentity
(
ephID
ephemeral
.
Id
)
RemoveIdentity
(
Identity
)
//fingerprints
AddFingerprint
(
f
ingerprint
format
.
Fingerprint
,
response
FingerprintResponse
)
Check
Fingerprint
(
fingerprint
format
.
Fingerprint
)
bool
Remove
Fingerprint
(
fingerprint
format
.
Fingerprint
)
bool
AddFingerprint
(
f
p
format
.
Fingerprint
,
processor
MessageProcessorFP
)
Add
Fingerprint
s
(
map
[
format
.
Fingerprint
]
MessageProcessorFP
)
Check
Fingerprint
(
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
which, though trial hashing, are used to determine if a message applies
to this client
Triggers are used for 2 purposes - can be processed by the notifications system,
or can be used to implement custom non fingerprint processing of payloads.
I.E. key negotiation, broadcast negotiation
A tag is appended to the message of the format tag = H(H(messageContents),preimage)
and trial hashing is used to determine if a message adheres to a tag.
WARNING: If a preiamge is known by an adversary, they can determine which messages
are for the client.
Due to the extra overhead of trial hashing, triggers are processed after fingerprints.
If a fingerprint match occurs on the message, triggers will not be handled.
Triggers are ephemeral to the session. When starting a new client, all triggers must be
re-added before StartNetworkFollower is called.
*/
// AddTrigger - Adds a trigger which can call a message
// handing function or be used for notifications.
// Multiple triggers can be registered for the same preimage.
// preimage - the preimage which is triggered on
// type - a descriptive string of the trigger. Generally used in notifications
// source - a byte buffer of related data. Generally used in notifications.
// Example: Sender ID
AddTrigger
(
trigger
Trigger
,
response
MessageProcessorTrigger
)
error
// RemoveTrigger - If only a single response is associated with the preimage, the entire
// preimage is removed. If there is more than one response, only the given response is removed
// if nil is passed in for response, all triggers for the preimage will be removed
RemoveTrigger
(
preimage
[]
byte
,
response
MessageProcessorTrigger
)
error
// TrackTriggers - Registers a callback which will get called every time triggers change.
// It will receive the triggers list every time it is modified.
// Will only get callbacks while the Network Follower is running.
// Multiple trackTriggers can be registered
TrackTriggers
(
func
(
triggers
[]
Trigger
))
}
type
Identity
struct
{
// Identity
EphId
ephemeral
.
Id
Source
*
id
.
ID
EphId
ephemeral
.
Id
Source
*
id
.
ID
}
type
IdentityParams
struct
{
AddressSize
uint8
// Usage variables
...
...
@@ -110,8 +134,19 @@ type Identity struct {
Ephemeral
bool
}
type
FingerprintResponse
func
(
format
.
Message
)
type
Trigger
struct
{
Preimage
[]
byte
Type
string
Source
[]
byte
}
type
MessageProcessorFP
interface
{
Process
(
message
format
.
Message
)
}
type
MessageProcessorTrigger
interface
{
Process
(
message
format
.
Message
,
preimage
[]
byte
,
Type
string
,
source
[]
byte
)
}
type
Ratchet
interface
{
SendE2E
(
m
message
.
Send
,
p
params
.
E2E
,
stop
*
stoppable
.
Single
)
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
error
)
...
...
@@ -123,8 +158,6 @@ type Ratchet interface {
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
...
...
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
register
or
sign in
to comment