Documentation ¶
Index ¶
- Constants
- func CheckVersionAndSetupStorage(def *ndf.NetworkDefinition, storageKV versioned.KV, userInfo user.Info, ...) (storage.Session, error)
- func CompressJpeg(imgBytes []byte) ([]byte, error)
- func CompressJpegForPreview(imgBytes []byte) ([]byte, error)
- func DecodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group)
- func DownloadAndVerifySignedNdfWithUrl(url, cert string) ([]byte, error)
- func DownloadNdfFromGateway(address string, cert []byte) ([]byte, error)
- func LoadSecretWithMnemonic(mnemonic, path string) (secret []byte, err error)
- func LocalKV(storageDir string, password []byte, rng *fastRNG.StreamGenerator) (versioned.KV, error)
- func MakeAuthCB(e2e *E2e, cbs AuthCallbacks) auth.Callbacks
- func MakeAuthCallbacksAdapter(ac AuthCallbacks, e2e *E2e) *authCallbacksAdapter
- func NewCmix(ndfJSON, storageDir string, password []byte, registrationCode string) error
- func NewPrecannedCmix(precannedID uint, defJSON, storageDir string, password []byte) error
- func NewProtoCmix_Unsafe(ndfJSON, storageDir string, password []byte, protoUser *user.Proto) error
- func NewSynchronizedCmix(ndfJSON, storageDir, remoteStoragePathPrefix string, password []byte, ...) error
- func NewVanityCmix(ndfJSON, storageDir string, password []byte, registrationCode string, ...) error
- func ParseNDF(ndfString string) (*ndf.NetworkDefinition, error)
- func StoreReceptionIdentity(key string, identity ReceptionIdentity, net *Cmix) error
- func StoreSecretWithMnemonic(secret []byte, path string) (string, error)
- func SynchronizedKV(storageDir, remoteStoragePathPrefix string, password []byte, ...) (versioned.KV, error)
- type AuthCallbacks
- type CMIXParams
- type ClientError
- type ClientErrorReport
- type Cmix
- func LoadCmix(storageDir string, password []byte, parameters CMIXParams) (*Cmix, error)
- func LoadSynchronizedCmix(storageDir, remoteStoragePathPrefix string, password []byte, ...) (*Cmix, error)
- func OpenCmix(storageDir string, password []byte) (*Cmix, error)
- func OpenSynchronizedCmix(storageDir, remoteStoragePathPrefix string, password []byte, ...) (*Cmix, error)
- func (c *Cmix) AddService(sp Service) error
- func (c *Cmix) ChangeNumberOfNodeRegistrations(toRun int, timeout time.Duration) error
- func (c *Cmix) ConstructProtoUserFile() ([]byte, error)
- func (c *Cmix) GetCmix() cmix.Client
- func (c *Cmix) GetComms() *client.Comms
- func (c *Cmix) GetErrorsChannel() <-chan ClientError
- func (c *Cmix) GetEventReporter() event.Reporter
- func (c *Cmix) GetNodeRegistrationStatus() (int, int, error)
- func (c *Cmix) GetPreferredBins(countryCode string) ([]string, error)
- func (c *Cmix) GetRng() *fastRNG.StreamGenerator
- func (c *Cmix) GetRoundEvents() RoundEvents
- func (c *Cmix) GetRunningProcesses() []string
- func (c *Cmix) GetStorage() storage.Session
- func (c *Cmix) GetTransmissionIdentity() TransmissionIdentity
- func (c *Cmix) HasRunningProcessies() bool
- func (c *Cmix) IsReady(percentReady float64) (isReady bool, howClose float64)
- func (c *Cmix) NetworkFollowerStatus() Status
- func (c *Cmix) PauseNodeRegistrations(timeout time.Duration) error
- func (c *Cmix) RegisterEventCallback(name string, myFunc event.Callback) error
- func (c *Cmix) ReportEvent(priority int, category, evtType, details string)
- func (c *Cmix) SetTrackNetworkPeriod(d time.Duration)
- func (c *Cmix) StartNetworkFollower(timeout time.Duration) error
- func (c *Cmix) StopNetworkFollower() error
- func (c *Cmix) UnregisterEventCallback(name string)
- type Container
- type DefaultAuthCallbacks
- func (a DefaultAuthCallbacks) Confirm(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
- func (a DefaultAuthCallbacks) Request(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
- func (a DefaultAuthCallbacks) Reset(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
- type E2EParams
- type E2e
- func (m *E2e) ConstructProtoUserFile() ([]byte, error)
- func (m *E2e) DeleteContact(partnerId *id.ID) error
- func (m *E2e) DeleteContactNotify(partnerId *id.ID, params e2e.Params) error
- func (m *E2e) GetAuth() auth.State
- func (m *E2e) GetBackupContainer() *Container
- func (m *E2e) GetE2E() e2e.Handler
- func (m *E2e) GetReceptionIdentity() ReceptionIdentity
- func (m *E2e) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Contact, error)
- type HealthTracker
- type ReceptionIdentity
- func (r ReceptionIdentity) DeepCopy() ReceptionIdentity
- func (r ReceptionIdentity) GetContact() contact.Contact
- func (r ReceptionIdentity) GetDHKeyPrivate() (*cyclic.Int, error)
- func (r ReceptionIdentity) GetGroup() (*cyclic.Group, error)
- func (r ReceptionIdentity) GetRSAPrivateKey() (rsa.PrivateKey, error)
- func (r ReceptionIdentity) Marshal() ([]byte, error)
- type RoundEvents
- type Service
- type Status
- type TransmissionIdentity
- type TriggerBackup
Constants ¶
const DEPENDENCIES = `` /* 4314-byte string literal not displayed */
const GITVERSION = `085e9805 Fix python error`
const SEMVER = "4.7.4"
const (
// SaltSize is the length of user salts, in bytes.
SaltSize = 32
)
Variables ¶
This section is empty.
Functions ¶
func CheckVersionAndSetupStorage ¶
func CheckVersionAndSetupStorage(def *ndf.NetworkDefinition, storageKV versioned.KV, userInfo user.Info, cmixGrp, e2eGrp *cyclic.Group, registrationCode string, rng *fastRNG.StreamGenerator) (storage.Session, error)
CheckVersionAndSetupStorage checks the client version and creates a new storage for user data. This function is common code shared by NewCmix, NewPrecannedCmix and NewVanityCmix.
func CompressJpeg ¶
CompressJpeg takes a JPEG image in byte format and compresses it based on desired output size.
func CompressJpegForPreview ¶
CompressJpegForPreview takes a JPEG image in byte format and compresses it based on desired output size.
func DecodeGroups ¶
func DecodeGroups(ndf *ndf.NetworkDefinition) (cmixGrp, e2eGrp *cyclic.Group)
DecodeGroups returns the E2E and cMix groups from the NDF.
func DownloadAndVerifySignedNdfWithUrl ¶
DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified using the cert string passed in. The NDF is returned as marshaled byte data that may be used to start a client.
func DownloadNdfFromGateway ¶
DownloadNdfFromGateway will download an NDF from a gateway on the cMix network. It will take the given address and certificate and send a request to a gateway for an NDF over HTTP/2 using the xx network's gRPC implementation. This returns a JSON marshalled version of the NDF.
func LoadSecretWithMnemonic ¶
LoadSecretWithMnemonic loads the encrypted secret from storage and decrypts the secret using the given mnemonic.
func LocalKV ¶ added in v4.7.1
func LocalKV(storageDir string, password []byte, rng *fastRNG.StreamGenerator) (versioned.KV, error)
LocalKV creates a filesystem based KV that doesn't synchronize with a remote storage system.
func MakeAuthCB ¶
func MakeAuthCB(e2e *E2e, cbs AuthCallbacks) auth.Callbacks
MakeAuthCB generates a new auth.Callbacks with the given AuthCallbacks.
func MakeAuthCallbacksAdapter ¶
func MakeAuthCallbacksAdapter(ac AuthCallbacks, e2e *E2e) *authCallbacksAdapter
MakeAuthCallbacksAdapter creates an authCallbacksAdapter.
func NewCmix ¶
NewCmix creates client storage, generates keys, and connects and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date.
func NewPrecannedCmix ¶
NewPrecannedCmix creates an insecure user with predetermined keys with nodes. It creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date.
func NewProtoCmix_Unsafe ¶
NewProtoCmix_Unsafe initializes a client object from a JSON containing predefined cryptographic that defines a user. This is designed for some specific deployment procedures and is generally unsafe.
func NewSynchronizedCmix ¶ added in v4.7.1
func NewSynchronizedCmix(ndfJSON, storageDir, remoteStoragePathPrefix string, password []byte, remote collective.RemoteStore) error
NewSynchronizedCmix clones a Cmix from remote storage Parameters:
- ndfJSON - the NDF file used to connect to the network.
- storageDir - the local directory or path used for the encrypted key value store.
- remoteStoragePathPrefix - the remote "directory" or path prefix used by the RemoteStore when reading/writing files.
- password - the pssword used to decrypt the encrypted key value store.
- remote - the RemoteStore implementation to use for multi-device synchronization.
func NewVanityCmix ¶
func NewVanityCmix(ndfJSON, storageDir string, password []byte, registrationCode string, userIdPrefix string) error
NewVanityCmix creates a user with a receptionID that starts with the supplied prefix. It creates client storage, generates keys, and connects and registers with the network. Note that this does not register a username/ identity, but merely creates a new cryptographic identity for adding such information at a later date.
func ParseNDF ¶
func ParseNDF(ndfString string) (*ndf.NetworkDefinition, error)
ParseNDF parses the initial NDF string for the client. This function does not check the signature; it is deprecated.
func StoreReceptionIdentity ¶
func StoreReceptionIdentity(key string, identity ReceptionIdentity, net *Cmix) error
StoreReceptionIdentity stores the given identity in Cmix storage with the given key. This is the ideal way to securely store identities, as the caller of this function is only required to store the given key separately rather than the keying material.
func StoreSecretWithMnemonic ¶
StoreSecretWithMnemonic creates a mnemonic and uses it to encrypt the secret. This encrypted data saved in storage.
func SynchronizedKV ¶ added in v4.7.1
func SynchronizedKV(storageDir, remoteStoragePathPrefix string, password []byte, remote collective.RemoteStore, synchedPrefixes []string, rng *fastRNG.StreamGenerator) (versioned.KV, error)
SynchronizedKV creates a filesystem based KV that synchronizes with a remote storage system.
Types ¶
type AuthCallbacks ¶
type AuthCallbacks interface { Request(partner contact.Contact, receptionID receptionID.EphemeralIdentity, round rounds.Round, user *E2e) Confirm(partner contact.Contact, receptionID receptionID.EphemeralIdentity, round rounds.Round, user *E2e) Reset(partner contact.Contact, receptionID receptionID.EphemeralIdentity, round rounds.Round, user *E2e) }
AuthCallbacks is an adapter for the auth.Callbacks interface that allows for initializing an E2e object without an E2e-dependant auth.Callbacks.
type CMIXParams ¶
type CMIXParams struct { Network cmix.Params CMIX cmix.CMIXParams }
CMIXParams contains the parameters for Network tracking and for specific CMIX messaging settings.
Example JSON:
{ "Network": { "TrackNetworkPeriod": 1000000000, "MaxCheckedRounds": 500, "RegNodesBufferLen": 1000, "NetworkHealthTimeout": 15000000000, "ParallelNodeRegistrations": 20, "KnownRoundsThreshold": 1500, "FastPolling": true, "VerboseRoundTracking": false, "RealtimeOnly": false, "ReplayRequests": true, "Rounds": { "MaxHistoricalRounds": 100, "HistoricalRoundsPeriod": 100000000, "HistoricalRoundsBufferLen": 1000, "MaxHistoricalRoundsRetries": 3 }, "Pickup": { "NumMessageRetrievalWorkers": 2, "LookupRoundsBufferLen": 100000, "MaxHistoricalRoundsRetries": 2, "UncheckRoundPeriod": 120000000000, "ForceMessagePickupRetry": false, "SendTimeout": 3000000000, "RealtimeOnly": false, "ForceHistoricalRounds": false }, "Message": { "MessageReceptionBuffLen": 500, "MessageReceptionWorkerPoolSize": 2, "MaxChecksInProcessMessage": 10, "InProcessMessageWait": 900000000000, "RealtimeOnly": false }, "Historical": { "MaxHistoricalRounds": 100, "HistoricalRoundsPeriod": 100000000, "HistoricalRoundsBufferLen": 1000, "MaxHistoricalRoundsRetries": 3 }, "MaxParallelIdentityTracks": 5, "EnableImmediateSending": false }, "CMIX": { "RoundTries": 10, "Timeout": 45000000000, "RetryDelay": 1000000000, "SendTimeout": 3000000000, "DebugTag": "External", "BlacklistedNodes": {}, "Critical": false } }
FIXME: this breakdown could be cleaner and is an unfortunate side effect of
several refactors of the codebase.
func GetDefaultCMixParams ¶
func GetDefaultCMixParams() CMIXParams
GetDefaultCMixParams returns a new CMIXParams with the default parameters.
func (*CMIXParams) Marshal ¶
func (p *CMIXParams) Marshal() ([]byte, error)
Marshal creates JSON data of the object.
func (*CMIXParams) Unmarshal ¶
func (p *CMIXParams) Unmarshal(jsonData []byte) error
Unmarshal fills an empty object with the deserialized contents of the JSON data.
type ClientError ¶ added in v4.7.1
type ClientErrorReport ¶ added in v4.7.1
type ClientErrorReport func(source, message, trace string)
type Cmix ¶
type Cmix struct {
// contains filtered or unexported fields
}
func LoadCmix ¶
func LoadCmix(storageDir string, password []byte, parameters CMIXParams) ( *Cmix, error)
LoadCmix initializes a Cmix object from existing storage and starts the network.
func LoadSynchronizedCmix ¶ added in v4.7.1
func LoadSynchronizedCmix(storageDir, remoteStoragePathPrefix string, password []byte, remote collective.RemoteStore, synchedPrefixes []string, parameters CMIXParams) (*Cmix, error)
LoadSynchronizedCmix initializes a Cmix object from existing storage using a remote synchronization storage object and starts the network.
func OpenCmix ¶
OpenCmix creates client storage but does not connect to the network or login. Note that this is a helper function that, in most applications, should not be used on its own. Consider using LoadCmix instead, which calls this function for you.
func OpenSynchronizedCmix ¶ added in v4.7.1
func OpenSynchronizedCmix(storageDir, remoteStoragePathPrefix string, password []byte, remote collective.RemoteStore, synchedPrefixes []string) (*Cmix, error)
func (*Cmix) AddService ¶
AddService adds a service to be controlled by the client thread control. These will be started and stopped with the network follower.
func (*Cmix) ChangeNumberOfNodeRegistrations ¶
ChangeNumberOfNodeRegistrations changes the number of parallel node registrations up to the initialized maximum.
func (*Cmix) ConstructProtoUserFile ¶
ConstructProtoUserFile is a helper function that is used for proto client testing. This is used for development testing.
func (*Cmix) GetErrorsChannel ¶
func (c *Cmix) GetErrorsChannel() <-chan ClientError
GetErrorsChannel returns a channel that passes errors from the long-running threads controlled by StartNetworkFollower and StopNetworkFollower.
func (*Cmix) GetEventReporter ¶
GetEventReporter returns the event reporter.
func (*Cmix) GetNodeRegistrationStatus ¶
GetNodeRegistrationStatus gets the current state of nodes registration. It returns the number of nodes that the user is currently registered with and the total number of nodes in the NDF. An error is returned if the network is not healthy.
func (*Cmix) GetPreferredBins ¶
GetPreferredBins returns the geographic bin or bins that the provided two character country code is a part of.
func (*Cmix) GetRng ¶
func (c *Cmix) GetRng() *fastRNG.StreamGenerator
GetRng returns the client RNG object.
func (*Cmix) GetRoundEvents ¶
func (c *Cmix) GetRoundEvents() RoundEvents
GetRoundEvents registers a callback for round events.
func (*Cmix) GetRunningProcesses ¶
GetRunningProcesses returns the names of all running processes at the time of this call. Note that this list may change and is subject to race conditions if multiple threads are in the process of starting or stopping.
func (*Cmix) GetStorage ¶
GetStorage returns the client storage object.
func (*Cmix) GetTransmissionIdentity ¶
func (c *Cmix) GetTransmissionIdentity() TransmissionIdentity
GetTransmissionIdentity returns the current TransmissionIdentity for this client.
func (*Cmix) HasRunningProcessies ¶
HasRunningProcessies checks if any background threads are running and returns true if one or more are.
func (*Cmix) IsReady ¶
IsReady returns true if at least percentReady of node registrations has completed. If not all have completed, then it returns false and howClose will be a percent (0-1) of node registrations completed.
func (*Cmix) NetworkFollowerStatus ¶
NetworkFollowerStatus gets the state of the network follower. It returns a status with the following values:
Stopped - 0 Running - 2000 Stopping - 3000
func (*Cmix) PauseNodeRegistrations ¶
PauseNodeRegistrations stops all node registrations and returns a function to resume them.
func (*Cmix) RegisterEventCallback ¶
RegisterEventCallback records the given function to receive ReportableEvent objects.
func (*Cmix) ReportEvent ¶
ReportEvent reports an event from the client to api users, providing a priority, category, eventType, and details.
func (*Cmix) SetTrackNetworkPeriod ¶ added in v4.4.4
SetTrackNetworkPeriod allows changing the frequency that follower threads are started.
Note that the frequency of the follower threads affect the power usage of the device following the network.
- Low period -> Higher frequency of polling -> Higher battery usage
- High period -> Lower frequency of polling -> Lower battery usage
This may be used to enable a low power (or battery optimization) mode for the end user.
func (*Cmix) StartNetworkFollower ¶
StartNetworkFollower kicks off the tracking of the network. It starts long- running network client threads and returns an object for checking state and stopping those threads.
Call this when returning from sleep and close when going back to sleep.
These threads may become a significant drain on battery when offline, ensure they are stopped if there is no internet access.
Threads Started:
- Network Follower (/network/follow.go) tracks the network events and hands them off to workers for handling.
- Historical Round Retrieval (/network/rounds/historical.go) retrieves data about rounds that are too old to be stored by the client.
- Message Retrieval Worker Group (/network/rounds/retrieve.go) requests all messages in a given round from the gateway of the last nodes.
- Message Handling Worker Group (/network/message/handle.go) decrypts and partitions messages when signals via the Switchboard.
- Health Tracker (/network/health), via the network instance, tracks the state of the network.
- Garbled Messages (/network/message/garbled.go) can be signaled to check all recent messages that could be decoded. It uses a message store on disk for persistence.
- Critical Messages (/network/message/critical.go) ensures all protocol layer mandatory messages are sent. It uses a message store on disk for persistence.
- KeyExchange Trigger (/keyExchange/trigger.go) responds to sent rekeys and executes them.
- KeyExchange Confirm (/keyExchange/confirm.go) responds to confirmations of successful rekey operations.
- Auth Callback (/auth/callback.go) handles both auth confirm and requests.
func (*Cmix) StopNetworkFollower ¶
StopNetworkFollower stops the network follower if it is running. It returns an error if the follower is in the wrong state to stop or if it fails to stop it.
If the network follower is running and this fails, the client object will most likely be in an unrecoverable state and need to be trashed.
func (*Cmix) UnregisterEventCallback ¶
UnregisterEventCallback deletes the callback identified by the name.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container contains the trigger to call to initiate a backup.
func (*Container) SetBackup ¶
func (bc *Container) SetBackup(triggerBackup TriggerBackup)
SetBackup sets the backup trigger function which will cause a backup to start on the next event that triggers is.
func (*Container) TriggerBackup ¶
TriggerBackup triggers a backup if a backup trigger has been set. The passed in reason will be printed to the log when the backup is sent. It should be in the paste tense. For example, if a contact is deleted, the reason can be "contact deleted" and the log will show:
Triggering backup: contact deleted
type DefaultAuthCallbacks ¶
type DefaultAuthCallbacks struct{}
DefaultAuthCallbacks is a simple structure for providing a default AuthCallbacks implementation. It should generally not be used.
func (DefaultAuthCallbacks) Confirm ¶
func (a DefaultAuthCallbacks) Confirm(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
Confirm will be called when an auth Confirm message is processed.
func (DefaultAuthCallbacks) Request ¶
func (a DefaultAuthCallbacks) Request(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
Request will be called when an auth Request message is processed.
func (DefaultAuthCallbacks) Reset ¶
func (a DefaultAuthCallbacks) Reset(contact.Contact, receptionID.EphemeralIdentity, rounds.Round, *E2e)
Reset will be called when an auth Reset operation occurs.
type E2EParams ¶
type E2EParams struct { Session session.Params Base e2e.Params Rekey rekey.Params EphemeralRekey rekey.Params Auth auth.Params }
E2EParams holds all the settings for e2e and it's various submodules.
Note that Base wraps cmix.CMIXParams to control message send params, so that xxdk library users should copy the desired settings to both. FIXME: this should not wrap a copy of cmix.CMIXParams.
func GetDefaultE2EParams ¶
func GetDefaultE2EParams() E2EParams
GetDefaultE2EParams returns a new E2EParams with the default parameters.
type E2e ¶
type E2e struct { *Cmix // contains filtered or unexported fields }
E2e object bundles a ReceptionIdentity with a Cmix object and can be used for high-level operations, such as connections.
func Login ¶
func Login(net *Cmix, callbacks AuthCallbacks, identity ReceptionIdentity, params E2EParams) (m *E2e, err error)
Login creates a new E2e backed by the xxdk.Cmix persistent versioned.KV. It bundles a Cmix object with a ReceptionIdentity object and initializes the auth.State and e2e.Handler objects.
func LoginEphemeral ¶
func LoginEphemeral(net *Cmix, callbacks AuthCallbacks, identity ReceptionIdentity, params E2EParams) (m *E2e, err error)
LoginEphemeral creates a new E2e backed by a totally ephemeral versioned.KV.
func (*E2e) ConstructProtoUserFile ¶
ConstructProtoUserFile is a helper function that is used for proto client testing. This is used for development testing.
func (*E2e) DeleteContact ¶
DeleteContact removes a partner from E2e's storage.
func (*E2e) DeleteContactNotify ¶
DeleteContactNotify removes a partner from E2e's storage and sends an E2E message to the contact notifying them.
func (*E2e) GetBackupContainer ¶
GetBackupContainer returns the backup Container.
func (*E2e) GetReceptionIdentity ¶
func (m *E2e) GetReceptionIdentity() ReceptionIdentity
GetReceptionIdentity returns a safe copy of the E2e ReceptionIdentity.
type HealthTracker ¶ added in v4.7.1
type ReceptionIdentity ¶
type ReceptionIdentity struct { ID *id.ID RSAPrivatePem []byte Salt []byte DHKeyPrivate []byte E2eGrp []byte }
ReceptionIdentity is used by the E2e object for managing identities used for message pickup.
func LoadReceptionIdentity ¶
func LoadReceptionIdentity(key string, net *Cmix) (ReceptionIdentity, error)
LoadReceptionIdentity loads the given identity in Cmix storage with the given key.
func MakeLegacyReceptionIdentity ¶
func MakeLegacyReceptionIdentity(net *Cmix) (ReceptionIdentity, error)
MakeLegacyReceptionIdentity generates the cryptographic identity for receiving messages based on the extant stored user.Info.
func MakeReceptionIdentity ¶
func MakeReceptionIdentity(net *Cmix) (ReceptionIdentity, error)
MakeReceptionIdentity generates a new cryptographic identity for receiving messages.
func UnmarshalReceptionIdentity ¶
func UnmarshalReceptionIdentity(marshaled []byte) (ReceptionIdentity, error)
UnmarshalReceptionIdentity takes in a marshalled ReceptionIdentity and converts it to an object.
func (ReceptionIdentity) DeepCopy ¶
func (r ReceptionIdentity) DeepCopy() ReceptionIdentity
DeepCopy produces a safe copy of the ReceptionIdentity.
func (ReceptionIdentity) GetContact ¶
func (r ReceptionIdentity) GetContact() contact.Contact
GetContact returns a contact.Contact object of the reception identity.
func (ReceptionIdentity) GetDHKeyPrivate ¶
func (r ReceptionIdentity) GetDHKeyPrivate() (*cyclic.Int, error)
GetDHKeyPrivate returns the DHKeyPrivate.
func (ReceptionIdentity) GetGroup ¶
func (r ReceptionIdentity) GetGroup() (*cyclic.Group, error)
GetGroup returns the cyclic.Group.
func (ReceptionIdentity) GetRSAPrivateKey ¶
func (r ReceptionIdentity) GetRSAPrivateKey() (rsa.PrivateKey, error)
GetRSAPrivateKey returns the RSAPrivatePem.
func (ReceptionIdentity) Marshal ¶
func (r ReceptionIdentity) Marshal() ([]byte, error)
Marshal returns the JSON representation of a ReceptionIdentity.
type RoundEvents ¶ added in v4.7.1
type RoundEvents interface { // AddRoundEvent designates a callback to call on the specified event // rid is the id of the round the event occurs on // callback is the callback the event is triggered on // timeout is the amount of time before an error event is returned // valid states are the states which the event should trigger on AddRoundEvent(rid id.Round, callback ds.RoundEventCallback, timeout time.Duration, validStates ...states.Round) *ds.EventCallback // AddRoundEventChan designates a go channel to signal the specified event // rid is the id of the round the event occurs on // eventChan is the channel the event is triggered on // timeout is the amount of time before an error event is returned // valid states are the states which the event should trigger on AddRoundEventChan(rid id.Round, eventChan chan ds.EventReturn, timeout time.Duration, validStates ...states.Round) *ds.EventCallback // Remove Allows the un-registration of a round event before it triggers Remove(rid id.Round, e *ds.EventCallback) }
type Service ¶
Service is a service process that starts itself in a new thread, returning from the originator a stoppable to control it.
type Status ¶
type Status int
Status holds the status of the network.
const ( // Stopped signifies that the network follower is stopped; none of its // processes are running. Stopped Status = 0 // Running signifies that the network follower and its processes are active // and running. Running Status = 2000 // Stopping signifies that the network follower has been signalled to stop // and is in the processes of stopping the processes. Stopping Status = 3000 )
type TransmissionIdentity ¶
type TransmissionIdentity struct { ID *id.ID RSAPrivate rsa.PrivateKey Salt []byte // Timestamp of when the user has registered with the network RegistrationTimestamp int64 }
TransmissionIdentity represents the identity used to transmit over the network via a specific Cmix object.
func (TransmissionIdentity) DeepCopy ¶
func (t TransmissionIdentity) DeepCopy() TransmissionIdentity
DeepCopy produces a safe copy of a TransmissionIdentity.
type TriggerBackup ¶
type TriggerBackup func(reason string)
TriggerBackup function is called to start a backup. The reason is used for logging purposes and should describe the event that triggered a backup.
For example, the reason can say "contact added" when a new contact is saved.