Documentation ¶
Index ¶
- func AsyncRequestRestLike(_ js.Value, args []js.Value) any
- func ConstructIdentity(_ js.Value, args []js.Value) any
- func CreateUserFriendlyErrorMessage(_ js.Value, args []js.Value) any
- func DecodePrivateURL(_ js.Value, args []js.Value) any
- func DecodePublicURL(_ js.Value, args []js.Value) any
- func DeserializeGroup(_ js.Value, args []js.Value) any
- func DownloadAndVerifySignedNdfWithUrl(_ js.Value, args []js.Value) any
- func EnableGrpcLogs(_ js.Value, args []js.Value) any
- func GenerateChannel(_ js.Value, args []js.Value) any
- func GenerateChannelIdentity(_ js.Value, args []js.Value) any
- func GenerateSecret(_ js.Value, args []js.Value) any
- func GetChannelInfo(_ js.Value, args []js.Value) any
- func GetChannelJSON(_ js.Value, args []js.Value) any
- func GetClientDependencies(js.Value, []js.Value) any
- func GetClientGitVersion(js.Value, []js.Value) any
- func GetClientVersion(js.Value, []js.Value) any
- func GetContactFromReceptionIdentity(_ js.Value, args []js.Value) any
- func GetDefaultCMixParams(js.Value, []js.Value) any
- func GetDefaultE2EParams(js.Value, []js.Value) any
- func GetDefaultE2eFileTransferParams(js.Value, []js.Value) any
- func GetDefaultFileTransferParams(js.Value, []js.Value) any
- func GetDefaultSingleUseParams(js.Value, []js.Value) any
- func GetFactsFromContact(_ js.Value, args []js.Value) any
- func GetIDFromContact(_ js.Value, args []js.Value) any
- func GetPubkeyFromContact(_ js.Value, args []js.Value) any
- func GetPublicChannelIdentity(_ js.Value, args []js.Value) any
- func GetPublicChannelIdentityFromPrivate(_ js.Value, args []js.Value) any
- func GetSavedChannelPrivateKeyUNSAFE(_ js.Value, args []js.Value) any
- func GetShareUrlType(_ js.Value, args []js.Value) any
- func GetVersion(js.Value, []js.Value) any
- func ImportPrivateIdentity(_ js.Value, args []js.Value) any
- func InitFileTransfer(_ js.Value, args []js.Value) any
- func InitializeBackup(_ js.Value, args []js.Value) any
- func IsNicknameValid(_ js.Value, args []js.Value) any
- func Listen(_ js.Value, args []js.Value) any
- func LoadChannelsManager(_ js.Value, args []js.Value) any
- func LoadChannelsManagerWithIndexedDb(_ js.Value, args []js.Value) any
- func LoadChannelsManagerWithIndexedDbUnsafe(_ js.Value, args []js.Value) any
- func LoadCmix(_ js.Value, args []js.Value) any
- func LoadReceptionIdentity(_ js.Value, args []js.Value) any
- func LogLevel(_ js.Value, args []js.Value) any
- func LogToFile(_ js.Value, args []js.Value) any
- func Login(_ js.Value, args []js.Value) any
- func LoginEphemeral(_ js.Value, args []js.Value) any
- func LookupUD(_ js.Value, args []js.Value) any
- func NewChannelsDatabaseCipher(_ js.Value, args []js.Value) any
- func NewChannelsManager(_ js.Value, args []js.Value) any
- func NewChannelsManagerWithIndexedDb(_ js.Value, args []js.Value) any
- func NewChannelsManagerWithIndexedDbUnsafe(_ js.Value, args []js.Value) any
- func NewCmix(_ js.Value, args []js.Value) any
- func NewCmixFromBackup(_ js.Value, args []js.Value) any
- func NewDummyTrafficManager(_ js.Value, args []js.Value) any
- func NewGroupChat(_ js.Value, args []js.Value) any
- func NewOrLoadUd(_ js.Value, args []js.Value) any
- func NewUdManagerFromBackup(_ js.Value, args []js.Value) any
- func RegisterLogWriter(_ js.Value, args []js.Value) any
- func RequestRestLike(_ js.Value, args []js.Value) any
- func RestlikeRequest(_ js.Value, args []js.Value) any
- func RestlikeRequestAuth(_ js.Value, args []js.Value) any
- func ResumeBackup(_ js.Value, args []js.Value) any
- func SearchUD(_ js.Value, args []js.Value) any
- func SetDashboardURL(_ js.Value, args []js.Value) any
- func SetFactsOnContact(_ js.Value, args []js.Value) any
- func SetOffset(_ js.Value, args []js.Value) any
- func SetTimeSource(_ js.Value, args []js.Value) any
- func StoreReceptionIdentity(_ js.Value, args []js.Value) any
- func TransmitSingleUse(_ js.Value, args []js.Value) any
- func UpdateCommonErrors(_ js.Value, args []js.Value) any
- type AuthenticatedConnection
- func (ac *AuthenticatedConnection) Close(js.Value, []js.Value) any
- func (ac *AuthenticatedConnection) GetId(js.Value, []js.Value) any
- func (ac *AuthenticatedConnection) GetPartner(js.Value, []js.Value) any
- func (ac *AuthenticatedConnection) IsAuthenticated(js.Value, []js.Value) any
- func (ac *AuthenticatedConnection) RegisterListener(_ js.Value, args []js.Value) any
- func (ac *AuthenticatedConnection) SendE2E(_ js.Value, args []js.Value) any
- type Backup
- type ChannelDbCipher
- func (c *ChannelDbCipher) Decrypt(_ js.Value, args []js.Value) any
- func (c *ChannelDbCipher) Encrypt(_ js.Value, args []js.Value) any
- func (c *ChannelDbCipher) GetID(js.Value, []js.Value) any
- func (c *ChannelDbCipher) MarshalJSON(js.Value, []js.Value) any
- func (c *ChannelDbCipher) UnmarshalJSON(_ js.Value, args []js.Value) any
- type ChannelsManager
- func (ch *ChannelsManager) DeleteNickname(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) ExportPrivateIdentity(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) GetChannels(js.Value, []js.Value) any
- func (ch *ChannelsManager) GetID(js.Value, []js.Value) any
- func (ch *ChannelsManager) GetIdentity(js.Value, []js.Value) any
- func (ch *ChannelsManager) GetNickname(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) GetShareURL(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) GetStorageTag(js.Value, []js.Value) any
- func (ch *ChannelsManager) JoinChannel(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) LeaveChannel(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) RegisterReceiveHandler(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) ReplayChannel(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SendAdminGeneric(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SendGeneric(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SendMessage(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SendReaction(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SendReply(_ js.Value, args []js.Value) any
- func (ch *ChannelsManager) SetNickname(_ js.Value, args []js.Value) any
- type Cmix
- func (c *Cmix) AddHealthCallback(_ js.Value, args []js.Value) any
- func (c *Cmix) ChangeNumberOfNodeRegistrations(_ js.Value, args []js.Value) any
- func (c *Cmix) Connect(_ js.Value, args []js.Value) any
- func (c *Cmix) ConnectWithAuthentication(_ js.Value, args []js.Value) any
- func (c *Cmix) GetID(js.Value, []js.Value) any
- func (c *Cmix) GetNodeRegistrationStatus(js.Value, []js.Value) any
- func (c *Cmix) GetReceptionRegistrationValidationSignature(js.Value, []js.Value) any
- func (c *Cmix) GetRunningProcesses(js.Value, []js.Value) any
- func (c *Cmix) HasRunningProcessies(js.Value, []js.Value) any
- func (c *Cmix) IsHealthy(js.Value, []js.Value) any
- func (c *Cmix) IsReady(_ js.Value, args []js.Value) any
- func (c *Cmix) MakeLegacyReceptionIdentity(js.Value, []js.Value) any
- func (c *Cmix) MakeReceptionIdentity(js.Value, []js.Value) any
- func (c *Cmix) NetworkFollowerStatus(js.Value, []js.Value) any
- func (c *Cmix) PauseNodeRegistrations(_ js.Value, args []js.Value) any
- func (c *Cmix) ReadyToSend(js.Value, []js.Value) any
- func (c *Cmix) RegisterClientErrorCallback(_ js.Value, args []js.Value) any
- func (c *Cmix) RemoveHealthCallback(_ js.Value, args []js.Value) any
- func (c *Cmix) StartNetworkFollower(_ js.Value, args []js.Value) any
- func (c *Cmix) StopNetworkFollower(js.Value, []js.Value) any
- func (c *Cmix) TrackServices(_ js.Value, args []js.Value) any
- func (c *Cmix) TrackServicesWithIdentity(_ js.Value, args []js.Value) any
- func (c *Cmix) WaitForNetwork(_ js.Value, args []js.Value) any
- func (c *Cmix) WaitForRoundResult(_ js.Value, args []js.Value) any
- type Connection
- type DummyTraffic
- type E2e
- func (e *E2e) AddPartnerCallback(_ js.Value, args []js.Value) any
- func (e *E2e) AddService(_ js.Value, args []js.Value) any
- func (e *E2e) CallAllReceivedRequests(js.Value, []js.Value) any
- func (e *E2e) Confirm(_ js.Value, args []js.Value) any
- func (e *E2e) DeleteAllRequests(js.Value, []js.Value) any
- func (e *E2e) DeleteContact(_ js.Value, args []js.Value) any
- func (e *E2e) DeletePartnerCallback(_ js.Value, args []js.Value) any
- func (e *E2e) DeleteReceiveRequests(js.Value, []js.Value) any
- func (e *E2e) DeleteRequest(_ js.Value, args []js.Value) any
- func (e *E2e) DeleteSentRequests(js.Value, []js.Value) any
- func (e *E2e) FirstPartitionSize(js.Value, []js.Value) any
- func (e *E2e) GetAllPartnerIDs(js.Value, []js.Value) any
- func (e *E2e) GetContact(js.Value, []js.Value) any
- func (e *E2e) GetHistoricalDHPrivkey(js.Value, []js.Value) any
- func (e *E2e) GetHistoricalDHPubkey(js.Value, []js.Value) any
- func (e *E2e) GetID(js.Value, []js.Value) any
- func (e *E2e) GetReceivedRequest(_ js.Value, args []js.Value) any
- func (e *E2e) GetReceptionID(js.Value, []js.Value) any
- func (e *E2e) GetUdAddressFromNdf(js.Value, []js.Value) any
- func (e *E2e) GetUdCertFromNdf(js.Value, []js.Value) any
- func (e *E2e) GetUdContactFromNdf(js.Value, []js.Value) any
- func (e *E2e) HasAuthenticatedChannel(_ js.Value, args []js.Value) any
- func (e *E2e) PartitionSize(_ js.Value, args []js.Value) any
- func (e *E2e) PayloadSize(js.Value, []js.Value) any
- func (e *E2e) RegisterListener(_ js.Value, args []js.Value) any
- func (e *E2e) RemoveService(_ js.Value, args []js.Value) any
- func (e *E2e) ReplayConfirm(_ js.Value, args []js.Value) any
- func (e *E2e) Request(_ js.Value, args []js.Value) any
- func (e *E2e) Reset(_ js.Value, args []js.Value) any
- func (e *E2e) SecondPartitionSize(js.Value, []js.Value) any
- func (e *E2e) SendE2E(_ js.Value, args []js.Value) any
- func (e *E2e) VerifyOwnership(_ js.Value, args []js.Value) any
- type FilePartTracker
- type FileTransfer
- func (f *FileTransfer) CloseSend(_ js.Value, args []js.Value) any
- func (f *FileTransfer) MaxFileNameLen(js.Value, []js.Value) any
- func (f *FileTransfer) MaxFileSize(js.Value, []js.Value) any
- func (f *FileTransfer) MaxFileTypeLen(js.Value, []js.Value) any
- func (f *FileTransfer) MaxPreviewSize(js.Value, []js.Value) any
- func (f *FileTransfer) Receive(_ js.Value, args []js.Value) any
- func (f *FileTransfer) RegisterReceivedProgressCallback(_ js.Value, args []js.Value) any
- func (f *FileTransfer) RegisterSentProgressCallback(_ js.Value, args []js.Value) any
- func (f *FileTransfer) Send(_ js.Value, args []js.Value) any
- type Group
- func (g *Group) GetCreatedMS(js.Value, []js.Value) any
- func (g *Group) GetCreatedNano(js.Value, []js.Value) any
- func (g *Group) GetID(js.Value, []js.Value) any
- func (g *Group) GetInitMessage(js.Value, []js.Value) any
- func (g *Group) GetMembership(js.Value, []js.Value) any
- func (g *Group) GetName(js.Value, []js.Value) any
- func (g *Group) Serialize(js.Value, []js.Value) any
- type GroupChat
- func (g *GroupChat) GetGroup(_ js.Value, args []js.Value) any
- func (g *GroupChat) GetGroups(js.Value, []js.Value) any
- func (g *GroupChat) JoinGroup(_ js.Value, args []js.Value) any
- func (g *GroupChat) LeaveGroup(_ js.Value, args []js.Value) any
- func (g *GroupChat) MakeGroup(_ js.Value, args []js.Value) any
- func (g *GroupChat) NumGroups(js.Value, []js.Value) any
- func (g *GroupChat) ResendRequest(_ js.Value, args []js.Value) any
- func (g *GroupChat) Send(_ js.Value, args []js.Value) any
- type JsConsoleLogListener
- type LogFile
- func (lf *LogFile) GetFile(js.Value, []js.Value) any
- func (lf *LogFile) Listen(t jww.Threshold) io.Writer
- func (lf *LogFile) MaxSize(js.Value, []js.Value) any
- func (lf *LogFile) Name(js.Value, []js.Value) any
- func (lf *LogFile) Size(js.Value, []js.Value) any
- func (lf *LogFile) Threshold(js.Value, []js.Value) any
- type ShareURL
- type Stopper
- type UserDiscovery
- func (ud *UserDiscovery) ConfirmFact(_ js.Value, args []js.Value) any
- func (ud *UserDiscovery) GetContact(js.Value, []js.Value) any
- func (ud *UserDiscovery) GetFacts(js.Value, []js.Value) any
- func (ud *UserDiscovery) GetID(js.Value, []js.Value) any
- func (ud *UserDiscovery) PermanentDeleteAccount(_ js.Value, args []js.Value) any
- func (ud *UserDiscovery) RemoveFact(_ js.Value, args []js.Value) any
- func (ud *UserDiscovery) SendRegisterFact(_ js.Value, args []js.Value) any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncRequestRestLike ¶
AsyncRequestRestLike sends an asynchronous restlike request to a given contact.
The RestlikeCallback will be called with the results of JSON marshalling the response when received.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the recipient contact.Contact (Uint8Array).
- args[2] - JSON of bindings.RestlikeMessage (Uint8Array).
- args[3] - JSON of single.RequestParams (Uint8Array).
- args[4] - Javascript object that has functions that implement the bindings.RestlikeCallback interface.
Returns:
- Throws a TypeError if parsing the parameters or making the request fails.
func ConstructIdentity ¶
ConstructIdentity constructs a channel.Identity from a user's public key and codeset version.
Parameters:
- args[0] - The Ed25519 public key (Uint8Array).
- args[1] - The version of the codeset used to generate the identity (int).
Returns:
- JSON of channel.Identity (Uint8Array).
- Throws a TypeError if constructing the identity fails.
func CreateUserFriendlyErrorMessage ¶
CreateUserFriendlyErrorMessage will convert the passed in error string to an error string that is user-friendly if a substring match is found to a common error. Common errors is a map that can be updated using UpdateCommonErrors. If the error is not common, some simple parsing is done on the error message to make it more user-accessible, removing backend specific jargon.
Parameters:
- args[0] - an error returned from the backend (string).
Returns
- A user-friendly error message. This should be devoid of technical speak but still be meaningful for front-end or back-end teams (string).
func DecodePrivateURL ¶
DecodePrivateURL decodes the channel URL, using the password, into a channel pretty print. This function can only be used for private or secret channel URLs. To get the privacy level of a channel URL, use GetShareUrlType.
Parameters:
- args[0] - The channel's share URL (string). Should be received from another user or generated via ChannelsManager.GetShareURL.
- args[1] - The password needed to decrypt the secret data in the URL (string).
Returns:
- The channel pretty print (string)
func DecodePublicURL ¶
DecodePublicURL decodes the channel URL into a channel pretty print. This function can only be used for public channel URLs. To get the privacy level of a channel URL, use GetShareUrlType.
Parameters:
- args[0] - The channel's share URL (string). Should be received from another user or generated via ChannelsManager.GetShareURL.
Returns:
- The channel pretty print (string).
func DeserializeGroup ¶
DeserializeGroup converts the results of Group.Serialize into a bindings.Group so that its methods can be called.
Parameters:
- args[0] - Byte representation of the bindings.Group (Uint8Array).
Returns:
- Javascript representation of the GroupChat object.
- Throws a TypeError if getting the group fails.
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.
Parameters:
- args[0] - The URL to download from (string).
- args[1] - The NDF certificate (string).
Returns a promise:
- Resolves to the JSON of the NDF (ndf.NetworkDefinition) (Uint8Array).
- Rejected with an error if downloading fails.
func EnableGrpcLogs ¶
EnableGrpcLogs sets GRPC trace logging.
Parameters:
- args[0] - a function that accepts a string and writes to a log. It must be of the form func(string).
func GenerateChannel ¶
GenerateChannel is used to create a channel a new channel of which you are the admin. It is only for making new channels, not joining existing ones.
It returns a pretty print of the channel and the private key.
The name cannot be longer that __ characters. The description cannot be longer than __ and can only use ______ characters.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - The name of the new channel (string). The name must be between 3 and 24 characters inclusive. It can only include upper and lowercase unicode letters, digits 0 through 9, and underscores (_). It cannot be changed once a channel is created.
- args[2] - The description of a channel (string). The description is optional but cannot be longer than 144 characters and can include all unicode characters. It cannot be changed once a channel is created.
- args[3] - The broadcast.PrivacyLevel of the channel (int). 0 = public, 1 = private, and 2 = secret. Refer to the comment below for more information.
Returns:
- JSON of bindings.ChannelGeneration, which describes a generated channel. It contains both the public channel info and the private key for the channel in PEM format (Uint8Array).
- Throws a TypeError if generating the channel fails.
The broadcast.PrivacyLevel of a channel indicates the level of channel information revealed when sharing it via URL. For any channel besides public channels, the secret information is encrypted and a password is required to share and join a channel.
- A privacy level of broadcast.Public reveals all the information including the name, description, privacy level, public key and salt.
- A privacy level of broadcast.Private reveals only the name and description.
- A privacy level of broadcast.Secret reveals nothing.
func GenerateChannelIdentity ¶
GenerateChannelIdentity creates a new private channel identity (channel.PrivateIdentity). The public component can be retrieved as JSON via GetPublicChannelIdentityFromPrivate.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
Returns:
- Marshalled bytes of channel.PrivateIdentity (Uint8Array).
- Throws a TypeError if generating the identity fails.
func GenerateSecret ¶
GenerateSecret creates a secret password using a system-based pseudorandom number generator.
Parameters:
- args[0] - The size of secret. It should be set to 32, but can be set higher in certain cases, but not lower (int).
Returns:
- Secret password (Uint8Array).
func GetChannelInfo ¶
GetChannelInfo returns the info about a channel from its public description.
Parameters:
- args[0] - The pretty print of the channel (string).
The pretty print will be of the format:
<Speakeasy-v3:Test_Channel|description:Channel description.|level:Public|created:1666718081766741100|secrets:+oHcqDbJPZaT3xD5NcdLY8OjOMtSQNKdKgLPmr7ugdU=|rCI0wr01dHFStjSFMvsBzFZClvDIrHLL5xbCOPaUOJ0=|493|1|7cBhJxVfQxWo+DypOISRpeWdQBhuQpAZtUbQHjBm8NQ=>
Returns:
- JSON of bindings.ChannelInfo, which describes all relevant channel info (Uint8Array).
- Throws a TypeError if getting the channel info fails.
func GetChannelJSON ¶
GetChannelJSON returns the JSON of the channel for the given pretty print.
Parameters:
- args[0] - The pretty print of the channel (string).
Returns:
- JSON of the broadcast.Channel object (Uint8Array).
Example JSON of broadcast.Channel:
{ "ReceptionID": "Ja/+Jh+1IXZYUOn+IzE3Fw/VqHOscomD0Q35p4Ai//kD", "Name": "My_Channel", "Description": "Here is information about my channel.", "Salt": "+tlrU/htO6rrV3UFDfpQALUiuelFZ+Cw9eZCwqRHk+g=", "RsaPubKeyHash": "PViT1mYkGBj6AYmE803O2RpA7BX24EjgBdldu3pIm4o=", "RsaPubKeyLength": 5, "RSASubPayloads": 1, "Secret": "JxZt/wPx2luoPdHY6jwbXqNlKnixVU/oa9DgypZOuyI=", "Level": 0 }
func GetClientDependencies ¶
GetClientDependencies returns the client's dependencies (xxdk.DEPENDENCIES).
Returns:
- Dependency list (string).
func GetClientGitVersion ¶
GetClientGitVersion returns the current client xxDK git version (xxdk.GITVERSION).
Returns:
- Git version (string).
func GetClientVersion ¶
GetClientVersion returns the current client xxDK semantic version (xxdk.SEMVER).
Returns:
- Current version (string).
func GetContactFromReceptionIdentity ¶
GetContactFromReceptionIdentity returns the contact.Contact object from the xxdk.ReceptionIdentity.
Parameters:
- args[0] - JSON of xxdk.ReceptionIdentity (Uint8Array).
Returns:
- Marshalled bytes of contact.Contact (string).
- Throws a TypeError if unmarshalling the identity fails.
func GetDefaultCMixParams ¶
GetDefaultCMixParams returns a JSON serialized object with all of the cMix parameters and their default values. Call this function and modify the JSON to change cMix settings.
Returns:
- JSON of xxdk.CMIXParams (Uint8Array).
func GetDefaultE2EParams ¶
GetDefaultE2EParams returns a JSON serialized object with all of the E2E parameters and their default values. Call this function and modify the JSON to change E2E settings.
Returns:
- JSON of xxdk.E2EParams (Uint8Array).
func GetDefaultE2eFileTransferParams ¶
GetDefaultE2eFileTransferParams returns a JSON serialized object with all the E2E file transfer parameters and their default values. Call this function and modify the JSON to change single use settings.
Returns:
- JSON of gitlab.com/elixxir/client/v4/fileTransfer/e2e.Params (Uint8Array).
func GetDefaultFileTransferParams ¶
GetDefaultFileTransferParams returns a JSON serialized object with all the file transfer parameters and their default values. Call this function and modify the JSON to change file transfer settings.
Returns:
- JSON of fileTransfer.Params (Uint8Array).
func GetDefaultSingleUseParams ¶
GetDefaultSingleUseParams returns a JSON serialized object with all the single-use parameters and their default values. Call this function and modify the JSON to change single use settings.
Returns:
- JSON of single.RequestParams (Uint8Array).
func GetFactsFromContact ¶
GetFactsFromContact returns the fact list in the contact.Contact object.
Parameters:
- args[0] - Marshalled bytes of contact.Contact (Uint8Array).
Returns:
- JSON of fact.FactList (Uint8Array).
- Throws a TypeError if loading the contact fails.
func GetIDFromContact ¶
GetIDFromContact returns the ID in the contact.Contact object.
Parameters:
- args[0] - Marshalled bytes of contact.Contact (Uint8Array).
Returns:
- Marshalled bytes of id.ID (Uint8Array).
- Throws a TypeError if loading the ID from the contact file fails.
func GetPubkeyFromContact ¶
GetPubkeyFromContact returns the DH public key in the contact.Contact object.
Parameters:
- args[0] - Marshalled contact.Contact (string).
Returns:
- Bytes of the cyclic.Int object (Uint8Array).
- Throws a TypeError if loading the public key from the contact file fails.
func GetPublicChannelIdentity ¶
GetPublicChannelIdentity constructs a public identity (channel.Identity) from a bytes version and returns it JSON marshaled.
Parameters:
- args[0] - Bytes of the public identity (channel.Identity) (Uint8Array).
Returns:
- JSON of the constructed channel.Identity (Uint8Array).
- Throws a TypeError if unmarshalling the bytes or marshalling the identity fails.
func GetPublicChannelIdentityFromPrivate ¶
GetPublicChannelIdentityFromPrivate returns the public identity (channel.Identity) contained in the given private identity (channel.PrivateIdentity).
Parameters:
- args[0] - Bytes of the private identity (channel.PrivateIdentity]) (Uint8Array).
Returns:
- JSON of the public identity (channel.Identity) (Uint8Array).
- Throws a TypeError if unmarshalling the bytes or marshalling the identity fails.
func GetSavedChannelPrivateKeyUNSAFE ¶
GetSavedChannelPrivateKeyUNSAFE loads the private key from storage for the given channel ID.
NOTE: This function is unsafe and only for debugging purposes only.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - The id.ID of the channel in base 64 encoding (string).
Returns:
- The PEM file of the private key (string).
- Throws a TypeError if retrieving the Cmix object or the private key fails.
func GetShareUrlType ¶
GetShareUrlType determines the broadcast.PrivacyLevel of the channel URL. If the URL is an invalid channel URL, an error is returned.
Parameters:
- args[0] - The channel share URL (string).
Returns:
- An int that corresponds to the broadcast.PrivacyLevel as outlined below.
- Throws a TypeError if parsing the URL fails.
Possible returns:
0 = public channel 1 = private channel 2 = secret channel
func GetVersion ¶
GetVersion returns the current xxDK WASM semantic version.
Returns:
- Current version (string).
func ImportPrivateIdentity ¶
ImportPrivateIdentity generates a new channel.PrivateIdentity from exported data.
Parameters:
- args[0] - The password used to encrypt the identity (string).
- args[2] - The encrypted data (Uint8Array).
Returns:
- JSON of channel.PrivateIdentity (Uint8Array).
- Throws a TypeError if importing the identity fails.
func InitFileTransfer ¶
InitFileTransfer creates a bindings-level file transfer manager.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.ReceiveFileCallback interface.
- args[2] - JSON of gitlab.com/elixxir/client/v4/fileTransfer/e2e.Params (Uint8Array).
- args[3] - JSON of fileTransfer.Params (Uint8Array).
Returns:
- Javascript representation of the FileTransfer object.
- Throws a TypeError initialising the file transfer manager fails.
func InitializeBackup ¶
InitializeBackup creates a bindings-layer Backup object.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - ID of UserDiscovery object in tracker (int).
- args[2] - Backup passphrase provided by the user (string). Used to decrypt the backup.
- args[3] - The callback to be called when a backup is triggered. Must be Javascript object that has functions that implement the bindings.UpdateBackupFunc interface.
Returns:
func IsNicknameValid ¶
IsNicknameValid checks if a nickname is valid.
Rules:
- A nickname must not be longer than 24 characters.
- A nickname must not be shorter than 1 character.
Parameters:
- args[0] - Nickname to check (string).
Returns:
- A Javascript Error object if the nickname is invalid with the reason why.
- Null if the nickname is valid.
func Listen ¶
Listen starts a single-use listener on a given tag using the passed in E2e object and SingleUseCallback func.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Tag that identifies the single-use message (string).
- args[2] - The callback that will be called when a response is received. It is a Javascript object that has functions that implement the bindings.SingleUseCallback interface.
Returns:
- Javascript representation of the Stopper object, an interface containing a function used to stop the listener.
- Throws a TypeError if listening fails.
func LoadChannelsManager ¶
LoadChannelsManager loads an existing ChannelsManager.
This is for loading a manager for an identity that has already been created. The channel manager should have previously been created with NewChannelsManager and the storage is retrievable with ChannelsManager.GetStorageTag.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - The storage tag associated with the previously created channel manager and retrieved with ChannelsManager.GetStorageTag (string).
- args[2] - A function that initialises and returns a Javascript object that matches the bindings.EventModel interface. The function must match the Build function in bindings.EventModelBuilder.
Returns:
- Javascript representation of the ChannelsManager object.
- Throws a TypeError if loading the manager fails.
func LoadChannelsManagerWithIndexedDb ¶
LoadChannelsManagerWithIndexedDb loads an existing ChannelsManager using an existing indexedDb database as a backend to manage the event model.
This is for loading a manager for an identity that has already been created. The channel manager should have previously been created with NewChannelsManagerWithIndexedDb and the storage is retrievable with ChannelsManager.GetStorageTag.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - The storage tag associated with the previously created channel manager and retrieved with ChannelsManager.GetStorageTag (string).
- args[2] - Function that takes in the same parameters as [indexedDb.MessageReceivedCallback]. On the Javascript side, the UUID is returned as an int and the channelID as a Uint8Array. The row in the database that was updated can be found using the UUID. The channel ID is provided so that the recipient can filter if they want to the processes the update now or not. An "update" bool is present which tells you if the row is new or if it is an edited old row.
- args[3] - ID of ChannelDbCipher object in tracker (int). Create this object with NewChannelsDatabaseCipher and get its id with ChannelDbCipher.GetID.
Returns a promise:
- Resolves to a Javascript representation of the ChannelsManager object.
- Rejected with an error if loading indexedDb or the manager fails.
- Throws a TypeError if the cipher ID does not correspond to a cipher.
func LoadChannelsManagerWithIndexedDbUnsafe ¶
LoadChannelsManagerWithIndexedDbUnsafe loads an existing ChannelsManager using an existing indexedDb database as a backend to manage the event model. This should only be used to load unsafe channel managers created by NewChannelsManagerWithIndexedDbUnsafe.
This is for loading a manager for an identity that has already been created. The channel manager should have previously been created with NewChannelsManagerWithIndexedDb and the storage is retrievable with ChannelsManager.GetStorageTag.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - The storage tag associated with the previously created channel manager and retrieved with ChannelsManager.GetStorageTag (string).
- args[2] - Function that takes in the same parameters as [indexedDb.MessageReceivedCallback]. On the Javascript side, the UUID is returned as an int and the channelID as a Uint8Array. The row in the database that was updated can be found using the UUID. The channel ID is provided so that the recipient can filter if they want to the processes the update now or not. An "update" bool is present which tells you if the row is new or if it is an edited old row
Returns a promise:
- Resolves to a Javascript representation of the ChannelsManager object.
- Rejected with an error if loading indexedDb or the manager fails.
func LoadCmix ¶
LoadCmix will load an existing user storage from the storageDir using the password. This will fail if the user storage does not exist or the password is incorrect.
The password is passed as a byte array so that it can be cleared from memory and stored as securely as possible using the MemGuard library.
LoadCmix does not block on network connection and instead loads and starts subprocesses to perform network operations.
Parameters:
- args[0] - Storage directory path (string).
- args[1] - Password used for storage (Uint8Array).
- args[2] - JSON of xxdk.CMIXParams (Uint8Array).
Returns a promise:
func LoadReceptionIdentity ¶
LoadReceptionIdentity loads the given identity in Cmix storage with the given key.
Parameters:
- args[0] - Storage key (string).
- args[1] - ID of Cmix object in tracker (int).
Returns:
- JSON of the stored xxdk.ReceptionIdentity object (Uint8Array).
- Throws a TypeError if the identity cannot be retrieved from storage.
func LogLevel ¶
LogLevel sets level of logging. All logs at the set level and below will be displayed (e.g., when log level is ERROR, only ERROR, CRITICAL, and FATAL messages will be printed).
Log level options:
TRACE - 0 DEBUG - 1 INFO - 2 WARN - 3 ERROR - 4 CRITICAL - 5 FATAL - 6
The default log level without updates is INFO.
Parameters:
- args[0] - Log level (int).
Returns:
- Throws TypeError if the log level is invalid.
func LogToFile ¶
LogToFile enables logging to a file that can be downloaded.
Parameters:
- args[0] - Log level (int).
- args[1] - Log file name (string).
- args[2] - Max log file size, in bytes (int).
Returns:
- A Javascript representation of the LogFile object, which allows accessing the contents of the log file and other metadata.
func Login ¶
Login creates and returns a new E2e object and adds it to the e2eTrackerSingleton. Identity should be created via Cmix.MakeReceptionIdentity and passed in here. If callbacks is left nil, a default auth.Callbacks will be used.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.AuthCallbacks interface.
- args[2] - JSON of the xxdk.ReceptionIdentity (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns:
- Javascript representation of the E2e object.
- Throws a TypeError if logging in fails.
func LoginEphemeral ¶
LoginEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton. Identity should be created via Cmix.MakeReceptionIdentity or Cmix.MakeLegacyReceptionIdentity and passed in here. If callbacks is left nil, a default auth.Callbacks will be used.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.AuthCallbacks interface.
- args[2] - JSON of the xxdk.ReceptionIdentity object (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns:
- Javascript representation of the E2e object.
- Throws a TypeError if logging in fails.
func LookupUD ¶
LookupUD returns the public key of the passed ID as known by the user discovery system or returns by the timeout.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the User Discovery's contact.Contact (Uint8Array).
- args[2] - Javascript object that has functions that implement the bindings.UdLookupCallback interface.
- args[3] - Marshalled bytes of the id.ID for the user to look up (Uint8Array).
- args[4] - JSON of single.RequestParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.SingleUseSendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if the lookup fails.
func NewChannelsDatabaseCipher ¶
NewChannelsDatabaseCipher constructs a ChannelDbCipher object.
Parameters:
- args[0] - The tracked Cmix object ID (int).
- args[1] - The password for storage. This should be the same password passed into NewCmix (Uint8Array).
- args[2] - The maximum size of a payload to be encrypted. A payload passed into ChannelDbCipher.Encrypt that is larger than this value will result in an error (int).
Returns:
- JavaScript representation of the ChannelDbCipher object.
- Throws a TypeError if creating the cipher fails.
func NewChannelsManager ¶
NewChannelsManager creates a new ChannelsManager from a new private identity (channel.PrivateIdentity).
This is for creating a manager for an identity for the first time. For generating a new one channel identity, use GenerateChannelIdentity. To reload this channel manager, use LoadChannelsManager, passing in the storage tag retrieved by ChannelsManager.GetStorageTag.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - Bytes of a private identity (channel.PrivateIdentity) that is generated by GenerateChannelIdentity (Uint8Array).
- args[2] - A function that initialises and returns a Javascript object that matches the bindings.EventModel interface. The function must match the Build function in bindings.EventModelBuilder.
Returns:
- Javascript representation of the ChannelsManager object.
- Throws a TypeError if creating the manager fails.
func NewChannelsManagerWithIndexedDb ¶
NewChannelsManagerWithIndexedDb creates a new ChannelsManager from a new private identity (channel.PrivateIdentity) and using indexedDb as a backend to manage the event model.
This is for creating a manager for an identity for the first time. For generating a new one channel identity, use GenerateChannelIdentity. To reload this channel manager, use LoadChannelsManagerWithIndexedDb, passing in the storage tag retrieved by ChannelsManager.GetStorageTag.
This function initialises an indexedDb database.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - Bytes of a private identity (channel.PrivateIdentity) that is generated by GenerateChannelIdentity (Uint8Array).
- args[2] - Function that takes in the same parameters as [indexedDb.MessageReceivedCallback]. On the Javascript side, the UUID is returned as an int and the channelID as a Uint8Array. The row in the database that was updated can be found using the UUID. The channel ID is provided so that the recipient can filter if they want to the processes the update now or not. An "update" bool is present which tells you if the row is new or if it is an edited old row.
- args[3] - ID of ChannelDbCipher object in tracker (int). Create this object with NewChannelsDatabaseCipher and get its id with ChannelDbCipher.GetID.
Returns a promise:
- Resolves to a Javascript representation of the ChannelsManager object.
- Rejected with an error if loading indexedDb or the manager fails.
- Throws a TypeError if the cipher ID does not correspond to a cipher.
func NewChannelsManagerWithIndexedDbUnsafe ¶
NewChannelsManagerWithIndexedDbUnsafe creates a new ChannelsManager from a new private identity (channel.PrivateIdentity) and using indexedDb as a backend to manage the event model. However, the data is written in plain text and not encrypted. It is recommended that you do not use this in production.
This is for creating a manager for an identity for the first time. For generating a new one channel identity, use GenerateChannelIdentity. To reload this channel manager, use LoadChannelsManagerWithIndexedDbUnsafe, passing in the storage tag retrieved by ChannelsManager.GetStorageTag.
This function initialises an indexedDb database.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - Bytes of a private identity (channel.PrivateIdentity) that is generated by GenerateChannelIdentity (Uint8Array).
- args[2] - Function that takes in the same parameters as [indexedDb.MessageReceivedCallback]. On the Javascript side, the UUID is returned as an int and the channelID as a Uint8Array. The row in the database that was updated can be found using the UUID. The channel ID is provided so that the recipient can filter if they want to the processes the update now or not. An "update" bool is present which tells you if the row is new or if it is an edited old row
Returns a promise:
- Resolves to a Javascript representation of the ChannelsManager object.
- Rejected with an error if loading indexedDb or the manager fails.
func NewCmix ¶
NewCmix creates user 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.
Users of this function should delete the storage directory on error.
Parameters:
- args[0] - NDF JSON (ndf.NetworkDefinition) (string).
- args[1] - Storage directory path (string).
- args[2] - Password used for storage (Uint8Array).
- args[3] - Registration code (string).
Returns:
- Throws a TypeError if creating new Cmix fails.
func NewCmixFromBackup ¶
NewCmixFromBackup initializes a new e2e storage from an encrypted backup. Users of this function should delete the storage directory on error. Users of this function should call LoadCmix as normal once this call succeeds.
Parameters:
- args[0] - JSON of the NDF (ndf.NetworkDefinition) (string).
- args[1] - Storage directory (string).
- args[2] - Backup passphrase (string).
- args[3] - Session password (Uint8Array).
- args[4] - Backup file contents (Uint8Array).
Returns:
- JSON of bindings.BackupReport (Uint8Array).
- Throws a TypeError if creating Cmix from backup fails.
func NewDummyTrafficManager ¶
NewDummyTrafficManager creates a DummyTraffic manager and initialises the dummy traffic sending thread. Note that the manager does not start sending dummy traffic until true is passed into DummyTraffic.SetStatus. The time duration between each sending operation and the amount of messages sent each interval are randomly generated values with bounds defined by the given parameters below.
Parameters:
- args[0] - A Cmix object ID in the tracker (int).
- args[1] - The maximum number of the random number of messages sent each sending cycle (int).
- args[2] - The average duration, in milliseconds, to wait between sends (int).
- args[3] - The upper bound of the interval between sending cycles, in milliseconds. Sends occur every average send (args[2]) +/- a random duration with an upper bound of args[3] (int).
Returns:
- Javascript representation of the DummyTraffic object.
- Throws a TypeError if creating the manager fails.
func NewGroupChat ¶
NewGroupChat creates a bindings-layer group chat manager.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.GroupRequest interface.
- args[2] - Javascript object that has functions that implement the bindings.GroupChatProcessor interface.
Returns:
func NewOrLoadUd ¶
NewOrLoadUd loads an existing Manager from storage or creates a new one if there is no extant storage information. Parameters need be provided to specify how to connect to the User Discovery service. These parameters may be used to contact either the UD server hosted by the xx network team or a custom third-party operated server. For the former, all the information may be pulled from the NDF using the bindings.
Params
- args[0] - ID of E2e object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.UdNetworkStatus interface. This is the network follower function wrapped in bindings.UdNetworkStatus.
- args[2] - The username the user wants to register with UD. If the user is already registered, this field may be blank (string).
- args[3] - The registration validation signature; a signature provided by the network (i.e., the client registrar). This may be nil; however, UD may return an error in some cases (e.g., in a production level environment) (Uint8Array).
- args[4] - The TLS certificate for the UD server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdCertFromNdf (Uint8Array).
- args[5] - Marshalled bytes of the contact.Contact of the server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdContactFromNdf (Uint8Array).
- args[6] - the IP address of the UD server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdAddressFromNdf (string).
Returns:
- Javascript representation of the UserDiscovery object that is registered to the specified UD service.
- Throws a TypeError if creating or loading fails.
func NewUdManagerFromBackup ¶
NewUdManagerFromBackup builds a new user discover manager from a backup. It will construct a manager that is already registered and restore already registered facts into store.
Note that it can take in both ane email address and a phone number or both. However, at least one fact must be specified; providing no facts will return an error.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.UdNetworkStatus interface. This is the network follower function wrapped in bindings.UdNetworkStatus.
- args[2] - The TLS certificate for the UD server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdCertFromNdf (Uint8Array).
- args[3] - Marshalled bytes of the contact.Contact of the server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdContactFromNdf (Uint8Array).
- args[4] - The IP address of the UD server this call will connect with. You may use the UD server run by the xx network team by using E2e.GetUdAddressFromNdf (string).
Returns:
- Javascript representation of the UserDiscovery object that is loaded from backup.
- Throws a TypeError if getting UD from backup fails.
func RegisterLogWriter ¶
RegisterLogWriter registers a callback on which logs are written.
Parameters:
- args[0] - a function that accepts a string and writes to a log. It must be of the form func(string).
func RequestRestLike ¶
RequestRestLike sends a restlike request to a given contact.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the recipient contact.Contact (Uint8Array).
- args[2] - JSON of bindings.RestlikeMessage (Uint8Array).
- args[3] - JSON of single.RequestParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.Message, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if parsing the parameters or making the request fails.
func RestlikeRequest ¶
RestlikeRequest performs a normal restlike request.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - ID of Connection object in tracker (int).
- args[2] - JSON of bindings.RestlikeMessage (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.RestlikeMessage, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if parsing the parameters or making the request fails.
func RestlikeRequestAuth ¶
RestlikeRequestAuth performs an authenticated restlike request.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - ID of AuthenticatedConnection object in tracker (int).
- args[2] - JSON of bindings.RestlikeMessage (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.RestlikeMessage, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if parsing the parameters or making the request fails.
func ResumeBackup ¶
ResumeBackup resumes the backup processes with a new callback. Call this function only when resuming a backup that has already been initialized or to replace the callback. To start the backup for the first time or to use a new password, use InitializeBackup.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - ID of UserDiscovery object in tracker (int).
- args[2] - The callback to be called when a backup is triggered. Must be Javascript object that has functions that implement the bindings.UpdateBackupFunc interface. This will replace any callback that has been passed into InitializeBackup.
Returns:
func SearchUD ¶
SearchUD searches user discovery for the passed Facts. The searchCallback will return a list of contacts, each having the facts it hit against. This is NOT intended to be used to search for multiple users at once; that can have a privacy reduction. Instead, it is intended to be used to search for a user where multiple pieces of information is known.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the User Discovery's contact.Contact (Uint8Array).
- args[2] - JSON of fact.FactList (Uint8Array).
- args[4] - JSON of single.RequestParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.SingleUseSendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if the search fails.
func SetDashboardURL ¶
SetDashboardURL is a function which modifies the base dashboard URL that is returned as part of any send report. Internally, this is defaulted to "https://dashboard.xx.network". This should only be called if the user explicitly wants to modify the dashboard URL. This function is not thread-safe, and as such should only be called on setup.
Parameters:
- args[0] - A valid URL that will be used for round look up on any send report (string).
func SetFactsOnContact ¶
SetFactsOnContact replaces the facts on the contact with the passed in facts pass in empty facts in order to clear the facts.
Parameters:
- args[0] - Marshalled bytes of contact.Contact (Uint8Array).
- args[1] - JSON of fact.FactList (Uint8Array).
Returns:
- Marshalled bytes of the modified contact.Contact (string).
- Throws a TypeError if loading or modifying the contact fails.
func SetOffset ¶
SetOffset will set an internal offset variable. All calls to netTime.Now will have this offset applied to this value.
Parameters:
- args[0] - a time by which netTime.Now will be offset. This value may be negative or positive. This expects a 64-bit integer value which will represent the number in microseconds this offset will be (int).
func SetTimeSource ¶
SetTimeSource will set the time source that will be used when retrieving the current time using netTime.Now. This should be called BEFORE Login() and only be called once. Using this after Login is undefined behavior that may result in a crash.
Parameters:
- timeNow is an object which adheres to netTime.TimeSource. Specifically, this object should a NowMs() method which return a 64-bit integer value.
func StoreReceptionIdentity ¶
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.
Parameters:
- args[0] - Storage key (string).
- args[1] - JSON of the xxdk.ReceptionIdentity object (Uint8Array).
- args[2] - ID of Cmix object in tracker (int).
Returns:
- Throws a TypeError if the identity cannot be stored in storage.
func TransmitSingleUse ¶
TransmitSingleUse transmits payload to recipient via single-use.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the recipient contact.Contact (Uint8Array).
- args[2] - Tag that identifies the single-use message (string).
- args[3] - Message contents (Uint8Array).
- args[4] - JSON of single.RequestParams (Uint8Array).
- args[5] - The callback that will be called when a response is received. It is a Javascript object that has functions that implement the bindings.SingleUseResponse interface.
Returns a promise:
- Resolves to the JSON of the bindings.SingleUseSendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if transmission fails.
func UpdateCommonErrors ¶
UpdateCommonErrors updates the internal error mapping database. This internal database maps errors returned from the backend to user-friendly error messages.
Parameters:
- args[0] - Contents of a JSON file whose format conforms to the example below (string).
Example Input:
{ "Failed to Unmarshal Conversation": "Could not retrieve conversation", "Failed to unmarshal SentRequestMap": "Failed to pull up friend requests", "cannot create username when network is not health": "Cannot create username, unable to connect to network", }
Returns:
- Throws a TypeError if the JSON cannot be unmarshalled.
Types ¶
type AuthenticatedConnection ¶
type AuthenticatedConnection struct {
// contains filtered or unexported fields
}
AuthenticatedConnection wraps the bindings.AuthenticatedConnection object so its methods can be wrapped to be Javascript compatible.
func (*AuthenticatedConnection) Close ¶
Close deletes this AuthenticatedConnection's partner.Manager and releases resources.
Returns:
- Throws a TypeError if closing fails.
func (*AuthenticatedConnection) GetId ¶
GetId returns the ID for this bindings.AuthenticatedConnection in the authenticatedConnectionTracker.
Returns:
- Tracker ID (int).
func (*AuthenticatedConnection) GetPartner ¶
GetPartner returns the partner.Manager for this AuthenticatedConnection.
Returns:
- Marshalled bytes of the partner's id.ID (Uint8Array).
func (*AuthenticatedConnection) IsAuthenticated ¶
IsAuthenticated returns true.
Returns:
- True (boolean).
func (*AuthenticatedConnection) RegisterListener ¶
RegisterListener is used for E2E reception and allows for reading data sent from the partner.Manager.
Parameters:
- args[0] - Message type from catalog.MessageType (int).
- args[1] - Javascript object that has functions that implement the bindings.Listener interface.
Returns:
- Throws a TypeError is registering the listener fails.
func (*AuthenticatedConnection) SendE2E ¶
SendE2E is a wrapper for sending specifically to the AuthenticatedConnection's partner.Manager.
Parameters:
- args[0] - Message type from catalog.MessageType (int).
- args[1] - Message payload (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.E2ESendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if sending fails.
type Backup ¶
type Backup struct {
// contains filtered or unexported fields
}
Backup wraps the bindings.Backup object so its methods can be wrapped to be Javascript compatible.
func (*Backup) AddJson ¶
AddJson stores the argument within the Backup structure.
Parameters:
- args[0] - JSON to store (string).
func (*Backup) IsBackupRunning ¶
IsBackupRunning returns true if the backup has been initialized and is running. Returns false if it has been stopped.
Returns:
- If the backup is running (boolean).
func (*Backup) StopBackup ¶
StopBackup stops the backup processes and deletes the user's password from storage. To enable backups again, call InitializeBackup.
Returns:
- Throws a TypeError if stopping the backup fails.
type ChannelDbCipher ¶
type ChannelDbCipher struct {
// contains filtered or unexported fields
}
ChannelDbCipher wraps the bindings.ChannelDbCipher object so its methods can be wrapped to be Javascript compatible.
func (*ChannelDbCipher) Decrypt ¶
Decrypt will decrypt the passed in encrypted value. The plaintext will be returned by this function. Any padding will be discarded within this function.
Parameters:
- args[0] - the encrypted data returned by ChannelDbCipher.Encrypt (Uint8Array).
Returns:
- The plaintext of the ciphertext passed in (Uint8Array).
- Throws a TypeError if it fails to encrypt the plaintext.
func (*ChannelDbCipher) Encrypt ¶
Encrypt will encrypt the raw data. It will return a ciphertext. Padding is done on the plaintext so all encrypted data looks uniform at rest.
Parameters:
- args[0] - The data to be encrypted (Uint8Array). This must be smaller than the block size passed into NewChannelsDatabaseCipher. If it is larger, this will return an error.
Returns:
- The ciphertext of the plaintext passed in (Uint8Array).
- Throws a TypeError if it fails to encrypt the plaintext.
func (*ChannelDbCipher) GetID ¶
GetID returns the ID for this bindings.ChannelDbCipher in the channelDbCipherTracker.
Returns:
- Tracker ID (int).
func (*ChannelDbCipher) MarshalJSON ¶ added in v0.1.10
MarshalJSON marshals the cipher into valid JSON.
Returns:
- JSON of the cipher (Uint8Array).
- Throws a TypeError if marshalling fails.
func (*ChannelDbCipher) UnmarshalJSON ¶ added in v0.1.10
UnmarshalJSON unmarshalls JSON into the cipher. This function adheres to the json.Unmarshaler interface.
Note that this function does not transfer the internal RNG. Use channel.NewCipherFromJSON to properly reconstruct a cipher from JSON.
Parameters:
- args[0] - JSON data to unmarshal (Uint8Array).
Returns:
- JSON of the cipher (Uint8Array).
- Throws a TypeError if marshalling fails.
type ChannelsManager ¶
type ChannelsManager struct {
// contains filtered or unexported fields
}
ChannelsManager wraps the bindings.ChannelsManager object so its methods can be wrapped to be Javascript compatible.
func (*ChannelsManager) DeleteNickname ¶
DeleteNickname deletes the nickname for a given channel.
Parameters:
- args[0] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- Throws TypeError if deleting the nickname fails.
func (*ChannelsManager) ExportPrivateIdentity ¶
ExportPrivateIdentity encrypts and exports the private identity to a portable string.
Parameters:
- args[0] - Password to encrypt the identity with (string).
Returns:
- JSON of the encrypted private identity (Uint8Array).
- Throws TypeError if exporting the identity fails.
func (*ChannelsManager) GetChannels ¶
GetChannels returns the IDs of all channels that have been joined.
Returns:
- JSON of an array of marshalled id.ID (Uint8Array).
- Throws a TypeError if getting the channels fails.
JSON Example:
{ "U4x/lrFkvxuXu59LtHLon1sUhPJSCcnZND6SugndnVID", "15tNdkKbYXoMn58NO6VbDMDWFEyIhTWEGsvgcJsHWAgD" }
func (*ChannelsManager) GetID ¶
GetID returns the ID for this ChannelsManager in the ChannelsManager tracker.
Returns:
- Tracker ID (int).
func (*ChannelsManager) GetIdentity ¶
GetIdentity returns the marshaled public identity (channel.Identity) that the channel is using.
Returns:
- JSON of the channel.Identity (Uint8Array).
- Throws TypeError if marshalling the identity fails.
func (*ChannelsManager) GetNickname ¶
GetNickname returns the nickname set for a given channel. Returns an error if there is no nickname set.
Parameters:
- args[0] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- The nickname (string).
- Throws TypeError if the channel has no nickname set.
func (*ChannelsManager) GetShareURL ¶
GetShareURL generates a URL that can be used to share this channel with others on the given host.
A URL comes in one of three forms based on the privacy level set when generating the channel. Each privacy level hides more information than the last with the lowest level revealing everything and the highest level revealing nothing. For any level above the lowest, a password is returned, which will be required when decoding the URL.
The maxUses is the maximum number of times this URL can be used to join a channel. If it is set to 0, then it can be shared unlimited times. The max uses is set as a URL parameter using the key broadcast.MaxUsesKey. Note that this number is also encoded in the secret data for private and secret URLs, so if the number is changed in the URL, is will be verified when calling DecodePublicURL or DecodePrivateURL. There is no enforcement for public URLs.
Parameters:
- args[0] - ID of Cmix object in tracker (int).
- args[1] - The URL to append the channel info to (string).
- args[2] - The maximum number of uses the link can be used (0 for unlimited) (int).
- args[3] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- JSON of bindings.ShareURL (Uint8Array).
- Throws a TypeError if generating the URL fails.
func (*ChannelsManager) GetStorageTag ¶
GetStorageTag returns the storage tag needed to reload the manager.
Returns:
- Storage tag (string).
func (*ChannelsManager) JoinChannel ¶
JoinChannel joins the given channel. It will fail if the channel has already been joined.
Parameters:
- args[0] - A portable channel string. Should be received from another user or generated via GenerateChannel (string).
The pretty print will be of the format:
<Speakeasy-v3:Test_Channel|description:Channel description.|level:Public|created:1666718081766741100|secrets:+oHcqDbJPZaT3xD5NcdLY8OjOMtSQNKdKgLPmr7ugdU=|rCI0wr01dHFStjSFMvsBzFZClvDIrHLL5xbCOPaUOJ0=|493|1|7cBhJxVfQxWo+DypOISRpeWdQBhuQpAZtUbQHjBm8NQ=>
Returns:
- JSON of bindings.ChannelInfo, which describes all relevant channel info (Uint8Array).
- Throws a TypeError if joining the channel fails.
func (*ChannelsManager) LeaveChannel ¶
LeaveChannel leaves the given channel. It will return an error if the channel was not previously joined.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- Throws a TypeError if the channel does not exist.
func (*ChannelsManager) RegisterReceiveHandler ¶
RegisterReceiveHandler is used to register handlers for non-default message types. They can be processed by modules. It is important that such modules sync up with the event model implementation.
There can only be one handler per [channels.MessageType], and this will return an error on any re-registration.
Parameters:
- args[0] - The message type of the message. This will be a valid [channels.MessageType] (int).
- args[1] - Javascript object that has functions that implement the bindings.ChannelMessageReceptionCallback interface. This callback will be executed when a channel message of the messageType is received.
Returns:
- Throws a TypeError if registering the handler fails.
func (*ChannelsManager) ReplayChannel ¶
ReplayChannel replays all messages from the channel within the network's memory (~3 weeks) over the event model.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- Throws a TypeError if the replay fails.
func (*ChannelsManager) SendAdminGeneric ¶
SendAdminGeneric is used to send a raw message over a channel encrypted with admin keys, identifying it as sent by the admin. In general, it should be wrapped in a function that defines the wire protocol. If the final message, before being sent over the wire, is too long, this will return an error. The message must be at most 510 bytes long.
Parameters:
- args[0] - The PEM-encode admin RSA private key (Uint8Array).
- args[1] - Marshalled bytes of the channel id.ID (Uint8Array).
- args[2] - The message type of the message. This will be a valid [channels.MessageType] (int).
- args[3] - The contents of the message (Uint8Array).
- args[4] - The lease of the message. This will be how long the message is valid until, in milliseconds. As per the [channels.Manager] documentation, this has different meanings depending on the use case. These use cases may be generic enough that they will not be enumerated here (int).
- args[5] - JSON of xxdk.CMIXParams. If left empty bindings.GetDefaultCMixParams will be used internally (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.ChannelSendReport (Uint8Array).
- Rejected with an error if sending fails.
func (*ChannelsManager) SendGeneric ¶
SendGeneric is used to send a raw message over a channel. In general, it should be wrapped in a function which defines the wire protocol. If the final message, before being sent over the wire, is too long, this will return an error. Due to the underlying encoding using compression, it isn't possible to define the largest payload that can be sent, but it will always be possible to send a payload of 802 bytes at minimum. The meaning of validUntil depends on the use case.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
- args[1] - The message type of the message. This will be a valid [channels.MessageType] (int).
- args[2] - The contents of the message (Uint8Array).
- args[3] - The lease of the message. This will be how long the message is valid until, in milliseconds. As per the [channels.Manager] documentation, this has different meanings depending on the use case. These use cases may be generic enough that they will not be enumerated here (int).
- args[4] - JSON of xxdk.CMIXParams. If left empty bindings.GetDefaultCMixParams will be used internally (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.ChannelSendReport (Uint8Array).
- Rejected with an error if sending fails.
func (*ChannelsManager) SendMessage ¶
SendMessage is used to send a formatted message over a channel. Due to the underlying encoding using compression, it isn't possible to define the largest payload that can be sent, but it will always be possible to send a payload of 798 bytes at minimum.
The message will auto delete validUntil after the round it is sent in, lasting forever if [channels.ValidForever] is used.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
- args[1] - The contents of the message (string).
- args[2] - The lease of the message. This will be how long the message is valid until, in milliseconds. As per the [channels.Manager] documentation, this has different meanings depending on the use case. These use cases may be generic enough that they will not be enumerated here (int).
- args[3] - JSON of xxdk.CMIXParams. If left empty bindings.GetDefaultCMixParams will be used internally (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.ChannelSendReport (Uint8Array).
- Rejected with an error if sending fails.
func (*ChannelsManager) SendReaction ¶
SendReaction is used to send a reaction to a message over a channel. The reaction must be a single emoji with no other characters, and will be rejected otherwise. Users will drop the reaction if they do not recognize the reactTo message.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
- args[1] - The user's reaction. This should be a single emoji with no other characters. As such, a Unicode string is expected (string).
- args[2] - JSON of channel.MessageID of the message you wish to reply to. This may be found in the bindings.ChannelSendReport if replying to your own. Alternatively, if reacting to another user's message, you may retrieve it via the ChannelMessageReceptionCallback registered using RegisterReceiveHandler (Uint8Array).
- args[3] - JSON of xxdk.CMIXParams. If left empty bindings.GetDefaultCMixParams will be used internally (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.ChannelSendReport (Uint8Array).
- Rejected with an error if sending fails.
func (*ChannelsManager) SendReply ¶
SendReply is used to send a formatted message over a channel. Due to the underlying encoding using compression, it isn't possible to define the largest payload that can be sent, but it will always be possible to send a payload of 766 bytes at minimum.
If the message ID the reply is sent to is nonexistent, the other side will post the message as a normal message and not a reply. The message will auto delete validUntil after the round it is sent in, lasting forever if [channels.ValidForever] is used.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
- args[1] - The contents of the message. The message should be at most 510 bytes. This is expected to be Unicode, and thus a string data type is expected (string).
- args[2] - JSON of channel.MessageID of the message you wish to reply to. This may be found in the bindings.ChannelSendReport if replying to your own. Alternatively, if reacting to another user's message, you may retrieve it via the bindings.ChannelMessageReceptionCallback registered using RegisterReceiveHandler (Uint8Array).
- args[3] - The lease of the message. This will be how long the message is valid until, in milliseconds. As per the [channels.Manager] documentation, this has different meanings depending on the use case. These use cases may be generic enough that they will not be enumerated here (int).
- args[4] - JSON of xxdk.CMIXParams. If left empty bindings.GetDefaultCMixParams will be used internally (Uint8Array).
Returns a promise:
- Resolves to the JSON of bindings.ChannelSendReport (Uint8Array).
- Rejected with an error if sending fails.
func (*ChannelsManager) SetNickname ¶
SetNickname sets the nickname for a given channel. The nickname must be valid according to IsNicknameValid.
Parameters:
- args[0] - The nickname to set (string).
- args[1] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- Throws TypeError if unmarshalling the ID fails or the nickname is invalid.
type Cmix ¶
type Cmix struct {
// contains filtered or unexported fields
}
Cmix wraps the bindings.Cmix object so its methods can be wrapped to be Javascript compatible.
func (*Cmix) AddHealthCallback ¶
AddHealthCallback adds a callback that gets called whenever the network health changes. Returns a registration ID that can be used to unregister.
Parameters:
- args[0] - Javascript object that has functions that implement the bindings.NetworkHealthCallback interface.
Returns:
- A registration ID that can be used to unregister the callback (int).
func (*Cmix) ChangeNumberOfNodeRegistrations ¶
ChangeNumberOfNodeRegistrations changes the number of parallel node registrations up to the initialized maximum.
Parameters:
- args[0] - The number of parallel node registrations (int).
- args[1] - The timeout, in milliseconds, to wait when changing node registrations before failing (int).
Returns:
- Throws TypeError if changing registrations fails.
func (*Cmix) Connect ¶
Connect performs auth key negotiation with the given recipient and returns a Connection object for the newly created partner.Manager.
This function is to be used sender-side and will block until the partner.Manager is confirmed.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the recipient contact.Contact (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns a promise:
- Resolves to a Javascript representation of the Connection object.
- Rejected with an error if loading the parameters or connecting fails.
func (*Cmix) ConnectWithAuthentication ¶
ConnectWithAuthentication is called by the client (i.e., the one establishing connection with the server). Once a connect.Connection has been established with the server, it then authenticates their identity to the server.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Marshalled bytes of the recipient contact.Contact (Uint8Array).
- args[3] - JSON of xxdk.E2EParams (Uint8Array).
Returns a promise:
- Resolves to a Javascript representation of the Connection object.
- Rejected with an error if loading the parameters or connecting fails.
func (*Cmix) GetID ¶
GetID returns the ID for this bindings.Cmix in the cmixTracker.
Returns:
- Tracker ID (int).
func (*Cmix) GetNodeRegistrationStatus ¶
GetNodeRegistrationStatus returns the current state of node registration.
Returns:
- JSON of bindings.NodeRegistrationReport containing the number of nodes that the user is registered with and the number of nodes present in the NDF.
- An error if it cannot get the node registration status. The most likely cause is that the network is unhealthy.
func (*Cmix) GetReceptionRegistrationValidationSignature ¶
GetReceptionRegistrationValidationSignature returns the signature provided by the xx network.
Returns:
- Reception registration validation signature (Uint8Array).
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.
Returns:
- JSON of strings (Uint8Array).
- Throws TypeError if getting the processes fails.
JSON Example:
{ "FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}", "MessageReception Worker 0" }
func (*Cmix) HasRunningProcessies ¶
HasRunningProcessies checks if any background threads are running and returns true if one or more are.
This is meant to be used when Cmix.NetworkFollowerStatus returns Stopping. Due to the handling of comms on iOS, where the OS can block indefinitely, it may not enter the stopped state appropriately. This can be used instead.
Returns:
- True if there are running processes (boolean).
func (*Cmix) IsHealthy ¶
IsHealthy returns true if the network is read to be in a healthy state where messages can be sent.
Returns:
- True if the network is healthy (boolean).
func (*Cmix) IsReady ¶
IsReady returns true if at least the given percent of node registrations have completed. If not all have completed, then it returns false and howClose will be a percent (0-1) of node registrations completed.
Parameters:
- args[0] - The percentage of nodes required to be registered with to be ready. This is a number between 0 and 1 (float64).
Returns:
- JSON of bindings.IsReadyInfo (Uint8Array).
- Throws TypeError if getting the information fails.
func (*Cmix) MakeLegacyReceptionIdentity ¶
MakeLegacyReceptionIdentity generates the legacy identity for receiving messages.
Returns a promise:
- Resolves to the JSON of the xxdk.ReceptionIdentity object (Uint8Array).
- Rejected with an error if creating a new legacy identity fails.
func (*Cmix) MakeReceptionIdentity ¶
MakeReceptionIdentity generates a new cryptographic identity for receiving messages.
Returns a promise:
- Resolves to the JSON of the xxdk.ReceptionIdentity object (Uint8Array).
- Rejected with an error if creating a new identity fails.
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
Returns:
- Network status code (int).
func (*Cmix) PauseNodeRegistrations ¶
PauseNodeRegistrations stops all node registrations and returns a function to resume them.
Parameters:
- args[0] - The timeout, in milliseconds, to wait when stopping threads before failing (int).
Returns:
- Throws TypeError if pausing fails.
func (*Cmix) ReadyToSend ¶
ReadyToSend determines if the network is ready to send messages on. It returns true if the network is healthy and if the client has registered with at least 70% of the nodes. Returns false otherwise.
Returns:
- Returns true if network is ready to send on (boolean).
func (*Cmix) RegisterClientErrorCallback ¶
RegisterClientErrorCallback registers the callback to handle errors from the long-running threads controlled by StartNetworkFollower and StopNetworkFollower.
Parameters:
- args[0] - Javascript object that has functions that implement the bindings.ClientError interface.
func (*Cmix) RemoveHealthCallback ¶
RemoveHealthCallback removes a health callback using its registration ID.
Parameters:
- args[0] - Callback registration ID (int).
func (*Cmix) StartNetworkFollower ¶
StartNetworkFollower kicks off the tracking of the network. It starts long- running network 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.
Parameters:
- args[0] - Timeout when stopping threads in milliseconds (int).
Returns:
- Throws a TypeError if starting the network follower fails.
func (*Cmix) StopNetworkFollower ¶
StopNetworkFollower stops the network follower if it is running.
If the network follower is running and this fails, the Cmix object will most likely be in an unrecoverable state and need to be trashed.
Returns:
- Throws a TypeError if the follower is in the wrong state to stop or if it fails to stop.
func (*Cmix) TrackServices ¶
TrackServices will return, via a callback, the list of services that the backend keeps track of, which is formally referred to as a message.ServiceList. This may be passed into other bindings call that may need context on the available services for this client.
Parameters:
- args[0] - Javascript object that has functions that implement the bindings.TrackServicesCallback interface.
func (*Cmix) TrackServicesWithIdentity ¶ added in v0.1.10
TrackServicesWithIdentity will return via a callback the list of services the backend keeps track of for the provided identity. This may be passed into other bindings call which may need context on the available services for this single identity. This will only return services for the given identity.
Parameters:
- args[0] - ID of E2e object in tracker (int).
- args[1] - Javascript object that has functions that implement the bindings.ClientError interface.
Returns:
- Throws TypeError if the E2e ID is invalid.
func (*Cmix) WaitForNetwork ¶
WaitForNetwork will block until either the network is healthy or the passed timeout is reached. It will return true if the network is healthy.
Parameters:
- args[0] - Timeout when stopping threads in milliseconds (int).
Returns a promise:
- A promise that resolves if the network is healthy and rejects if the network is not healthy.
func (*Cmix) WaitForRoundResult ¶
WaitForRoundResult allows the caller to get notified if the rounds a message was sent in successfully completed. Under the hood, this uses an API that uses the internal round data, network historical round lookup, and waiting on network events to determine what has (or will) occur.
This function takes the marshaled send report to ensure a memory leak does not occur as a result of both sides of the bindings holding a reference to the same pointer.
roundList is a JSON marshalled bindings.RoundsList or any JSON marshalled send report that inherits a bindings.RoundsList object.
Parameters:
- args[0] - JSON of bindings.RoundsList or JSON of any send report that inherits a bindings.RoundsList object (Uint8Array).
- args[1] - Javascript object that has functions that implement the bindings.MessageDeliveryCallback interface.
- args[2] - Timeout when the callback will return if no state update occurs, in milliseconds (int).
Returns:
- Throws a TypeError if the parameters are invalid or getting round results fails.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection wraps the bindings.Connection object so its methods can be wrapped to be Javascript compatible.
func (*Connection) Close ¶
Close deletes this Connection's partner.Manager and releases resources.
Returns:
- Throws a TypeError if closing fails.
func (*Connection) GetId ¶
GetId returns the ID for this bindings.Connection in the connectionTracker.
Returns:
- Tracker ID (int).
func (*Connection) GetPartner ¶
GetPartner returns the partner.Manager for this Connection.
Returns:
- Marshalled bytes of the partner's id.ID (Uint8Array).
func (*Connection) RegisterListener ¶
RegisterListener is used for E2E reception and allows for reading data sent from the partner.Manager.
Parameters:
- args[0] - message type from catalog.MessageType (int).
- args[1] - Javascript object that has functions that implement the bindings.Listener interface.
Returns:
- Throws a TypeError is registering the listener fails.
func (*Connection) SendE2E ¶
SendE2E is a wrapper for sending specifically to the Connection's partner.Manager.
Returns:
- []byte - the JSON marshalled bytes of the E2ESendReport object, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded.
Parameters:
- args[0] - Message type from catalog.MessageType (int).
- args[1] - Message payload (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.E2ESendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if sending fails.
type DummyTraffic ¶
type DummyTraffic struct {
// contains filtered or unexported fields
}
DummyTraffic wraps the bindings.DummyTraffic object so its methods can be wrapped to be Javascript compatible.
func (*DummyTraffic) GetStatus ¶
GetStatus returns the current state of the DummyTraffic manager's sending thread. Note that this function does not return the status set by the most recent call to DummyTraffic.SetStatus. Instead, this call returns the current status of the sending thread. This is due to the small delay that may occur between calling DummyTraffic.SetStatus and the sending thread taking into effect that status change.
Returns:
- Returns true if sending thread is sending dummy messages and false if sending thread is paused/stopped and is not sending dummy messages (boolean).
func (*DummyTraffic) SetStatus ¶
SetStatus sets the state of the DummyTraffic manager's send thread by passing in a boolean parameter. There may be a small delay in between this call and the status of the sending thread to change accordingly. For example, passing false into this call while the sending thread is currently sending messages will not cancel nor halt the sending operation, but will pause the thread once that operation has completed.
Parameters:
- args[0] - Input should be true if you want to send dummy messages and false if you want to pause dummy messages (boolean).
Returns:
- Throws a TypeError if the DummyTraffic.SetStatus is called too frequently, causing the internal status channel to fill.
type E2e ¶
type E2e struct {
// contains filtered or unexported fields
}
E2e wraps the bindings.E2e object so its methods can be wrapped to be Javascript compatible.
func (*E2e) AddPartnerCallback ¶
AddPartnerCallback adds a new callback that overrides the generic auth callback for the given partner ID.
Parameters:
- args[0] - Marshalled bytes of the partner id.ID (Uint8Array).
- args[1] - Javascript object that has functions that implement the bindings.AuthCallbacks interface.
Returns:
- Throws TypeError if the id.ID cannot be unmarshalled.
func (*E2e) AddService ¶
AddService adds a service for all partners of the given tag, which will call back on the given processor. These can be sent to using the tag fields in the Params object.
Passing nil for the processor allows you to create a service that is never called but will be visible by notifications. Processes added this way are generally not end-to-end encrypted messages themselves, but other protocols that piggyback on e2e relationships to start communication.
Parameters:
- args[0] - tag for the service (string).
- args[1] - Javascript object that has functions that implement the bindings.Processor interface.
Returns:
- Throws TypeError if registering the service fails.
func (*E2e) CallAllReceivedRequests ¶
CallAllReceivedRequests will iterate through all pending contact requests and replay them on the callbacks.
func (*E2e) Confirm ¶
Confirm sends a confirmation for a received request. It can only be called once. This both sends keying material to the other party and creates a channel in the e2e handler, after which e2e messages can be sent to the partner using E2e.SendE2E.
The round the request is initially sent on will be returned, but the request will be listed as a critical message, so the underlying cMix client will auto resend it in the event of failure.
A confirmation cannot be sent for a contact who has not sent a request or who is already a partner. This can only be called once for a specific contact. The confirmation sends as a critical message; if the round it sends on fails, it will be auto resent by the cMix client.
If the confirmation must be resent, use E2e.ReplayConfirm.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
Returns a promise:
- Resolves to the ID of the round (int).
- Rejected with an error if sending the confirmation fails.
func (*E2e) DeleteAllRequests ¶
DeleteAllRequests clears all requests from auth storage.
Returns:
- Throws TypeError if the deletion fails.
func (*E2e) DeleteContact ¶
DeleteContact removes a partner from E2e's storage.
Parameters:
- args[0] - Marshalled bytes of the partner id.ID (Uint8Array).
Returns:
- Throws TypeError if deleting the partner fails.
func (*E2e) DeletePartnerCallback ¶
DeletePartnerCallback deletes the callback that overrides the generic auth callback for the given partner ID.
Parameters:
- args[0] - Marshalled bytes of the partner id.ID (Uint8Array).
Returns:
- Throws TypeError if the id.ID cannot be unmarshalled.
func (*E2e) DeleteReceiveRequests ¶
DeleteReceiveRequests clears all received requests from auth storage.
Returns:
- Throws TypeError if the deletion fails.
func (*E2e) DeleteRequest ¶
DeleteRequest deletes sent or received requests for a specific partner ID.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
Returns:
- Throws TypeError if the deletion fails.
func (*E2e) DeleteSentRequests ¶
DeleteSentRequests clears all sent requests from auth storage.
Returns:
- Throws TypeError if the deletion fails.
func (*E2e) FirstPartitionSize ¶
FirstPartitionSize returns the max partition payload size for the first payload.
Returns:
- Max partition payload size (int).
func (*E2e) GetAllPartnerIDs ¶
GetAllPartnerIDs returns a list of all partner IDs that the user has an E2E relationship with.
Returns:
- JSON of array of id.ID (Uint8Array).
- Throws TypeError if getting partner IDs fails.
func (*E2e) GetContact ¶
GetContact returns a contact.Contact object for the E2e bindings.ReceptionIdentity.
Returns:
- Marshalled bytes of contact.Contact (Uint8Array).
func (*E2e) GetHistoricalDHPrivkey ¶
GetHistoricalDHPrivkey returns the user's marshalled historical DH private key.
Returns:
- JSON of cyclic.Int (Uint8Array).
- Throws TypeError if getting the key fails.
func (*E2e) GetHistoricalDHPubkey ¶
GetHistoricalDHPubkey returns the user's marshalled historical DH public key. key.
Returns:
- JSON of cyclic.Int (Uint8Array).
- Throws TypeError if getting the key fails.
func (*E2e) GetID ¶
GetID returns the ID for this E2e in the E2e tracker.
Returns:
- Tracker ID (int).
func (*E2e) GetReceivedRequest ¶
GetReceivedRequest returns a contact if there is a received request for it.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
Returns:
- Marshalled bytes of contact.Contact (Uint8Array).
- Throws TypeError if getting the received request fails.
func (*E2e) GetReceptionID ¶
GetReceptionID returns the marshalled default IDs.
Returns:
- Marshalled bytes of id.ID (Uint8Array).
func (*E2e) GetUdAddressFromNdf ¶
GetUdAddressFromNdf retrieve the User Discovery's network address fom the NDF.
Returns:
- User Discovery's address (string).
func (*E2e) GetUdCertFromNdf ¶
GetUdCertFromNdf retrieves the User Discovery's TLS certificate from the NDF.
Returns:
- Public certificate in PEM format (Uint8Array).
func (*E2e) GetUdContactFromNdf ¶
GetUdContactFromNdf assembles the User Discovery's contact file from the data within the NDF.
Returns
- Marshalled bytes of contact.Contact (Uint8Array).
- Throws a TypeError if the contact file cannot be loaded.
func (*E2e) HasAuthenticatedChannel ¶
HasAuthenticatedChannel returns true if an authenticated channel with the partner exists, otherwise returns false.
Parameters:
- args[0] - Marshalled bytes of id.ID (Uint8Array).
Returns:
- Existence of authenticated channel (boolean).
- Throws TypeError if unmarshalling the ID or getting the channel fails.
func (*E2e) PartitionSize ¶
PartitionSize returns the partition payload size for the given payload index. The first payload is index 0.
Parameters:
- args[0] - Payload index (int).
Returns:
- Partition payload size (int).
func (*E2e) PayloadSize ¶
PayloadSize returns the max payload size for a partitionable E2E message.
Returns:
- Max payload size (int).
func (*E2e) RegisterListener ¶
RegisterListener registers a new listener.
Parameters:
- args[0] - Marshalled byte of the user id.ID who sends messages to this user that this function will register a listener for (Uint8Array).
- args[1] - Message type from catalog.MessageType you want to listen for (int).
- args[2] - Javascript object that has functions that implement the bindings.Listener interface; do not pass nil as the listener.
Returns:
- Throws TypeError if registering the service fails.
func (*E2e) RemoveService ¶
RemoveService removes all services for the given tag.
Parameters:
- args[0] - Tag of services to remove (string).
Returns:
- Throws TypeError if removing the services fails.
func (*E2e) ReplayConfirm ¶
ReplayConfirm resends a confirmation to the partner. It will fail to send if the send relationship with the partner has already ratcheted.
The confirmation sends as a critical message; if the round it sends on fails, it will be auto resent by the cMix client.
This will not be useful if either side has ratcheted.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
Returns a promise:
- Resolves to the ID of the round (int).
- Rejected with an error if resending the confirmation fails.
func (*E2e) Request ¶
Request sends a contact request from the user identity in the imported E2e structure to the passed contact, as well as the passed facts (it will error if they are too long).
The other party must accept the request by calling E2e.Confirm to be able to send messages using E2e.SendE2E. When the other party does so, the "confirm" callback will get called.
The round the request is initially sent on will be returned, but the request will be listed as a critical message, so the underlying cMix client will auto resend it in the event of failure.
A request cannot be sent for a contact who has already received a request or who is already a partner.
The request sends as a critical message, if the round it sends on fails, it will be auto resent by the cMix client.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
- args[1] - JSON of fact.FactList (Uint8Array).
Returns a promise:
- Resolves to the ID of the round (int).
- Rejected with an error if sending the request fails.
func (*E2e) Reset ¶
Reset sends a contact reset request from the user identity in the imported e2e structure to the passed contact, as well as the passed facts (it will error if they are too long).
This deletes all traces of the relationship with the partner from e2e and create a new relationship from scratch.
The round the reset is initially sent on will be returned, but the request will be listed as a critical message, so the underlying cMix client will auto resend it in the event of failure.
A request cannot be sent for a contact who has already received a request or who is already a partner.
Parameters:
- args[0] - Marshalled bytes of the partner contact.Contact (Uint8Array).
Returns a promise:
- Resolves to the ID of the round (int).
- Rejected with an error if sending the reset fails.
func (*E2e) SecondPartitionSize ¶
SecondPartitionSize returns the max partition payload size for all payloads after the first payload.
Returns:
- Max payload size (int).
func (*E2e) SendE2E ¶
SendE2E send a message containing the payload to the recipient of the passed message type, per the given parameters--encrypted with end-to-end encryption.
Parameters:
- args[0] - Message type from catalog.MessageType (int).
- args[1] - Marshalled bytes of id.ID (Uint8Array).
- args[2] - Message payload (Uint8Array).
- args[3] - JSON xxdk.E2EParams (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.E2ESendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if sending fails.
func (*E2e) VerifyOwnership ¶
VerifyOwnership checks if the received ownership proof is valid.
Parameters:
- args[0] - Marshalled bytes of the received contact.Contact (Uint8Array).
- args[1] - Marshalled bytes of the verified contact.Contact (Uint8Array).
- args[2] - ID of E2e object in tracker (int).
Returns:
- Returns true if the ownership is valid (boolean).
- Throws TypeError if loading the parameters fails.
type FilePartTracker ¶
type FilePartTracker struct {
// contains filtered or unexported fields
}
FilePartTracker wraps the bindings.FilePartTracker object so its methods can be wrapped to be Javascript compatible.
func (*FilePartTracker) GetNumParts ¶
GetNumParts returns the total number of file parts in the transfer.
Returns:
- Number of parts (int).
func (*FilePartTracker) GetPartStatus ¶
GetPartStatus returns the status of the file part with the given part number.
The possible values for the status are:
- 0 < Part does not exist
- 0 = unsent
- 1 = arrived (sender has sent a part, and it has arrived)
- 2 = received (receiver has received a part)
Parameters:
- args[0] - Index of part (int).
Returns:
- Part status (int).
type FileTransfer ¶
type FileTransfer struct {
// contains filtered or unexported fields
}
FileTransfer wraps the bindings.FileTransfer object so its methods can be wrapped to be Javascript compatible.
func (*FileTransfer) CloseSend ¶
CloseSend deletes a file from the internal storage once a transfer has completed or reached the retry limit. Returns an error if the transfer has not run out of retries.
This function should be called once a transfer completes or errors out (as reported by the progress callback).
Parameters:
- args[0] - File transfer fileTransfer.TransferID (Uint8Array).
Returns:
- Throws a TypeError if the file transfer is incomplete.
func (*FileTransfer) MaxFileNameLen ¶
MaxFileNameLen returns the max number of bytes allowed for a file name.
Returns:
- Max file name length (int).
func (*FileTransfer) MaxFileSize ¶
MaxFileSize returns the max number of bytes allowed for a file.
Returns:
- Max file size (int).
func (*FileTransfer) MaxFileTypeLen ¶
MaxFileTypeLen returns the max number of bytes allowed for a file type.
Returns:
- Max file type length (int).
func (*FileTransfer) MaxPreviewSize ¶
MaxPreviewSize returns the max number of bytes allowed for a file preview.
Returns:
- Max preview size (int).
func (*FileTransfer) Receive ¶
Receive returns the full file on the completion of the transfer. It deletes internal references to the data and unregisters any attached progress callbacks. Returns an error if the transfer is not complete, the full file cannot be verified, or if the transfer cannot be found.
Receive can only be called once the progress callback returns that the file transfer is complete.
Parameters:
- args[0] - File transfer fileTransfer.TransferID (Uint8Array).
Returns:
- File contents (Uint8Array).
- Throws a TypeError the file transfer is incomplete or Receive has already been called.
func (*FileTransfer) RegisterReceivedProgressCallback ¶
RegisterReceivedProgressCallback allows for the registration of a callback to track the progress of an individual received file transfer.
This should be done when a new transfer is received on the ReceiveCallback.
Parameters:
- args[0] - File transfer fileTransfer.TransferID (Uint8Array).
- args[1] - Javascript object that has functions that implement the bindings.FileTransferReceiveProgressCallback interface.
- args[2] - Duration, in milliseconds, to wait between progress callbacks triggering (int).
Returns:
- Throws a TypeError if registering the callback fails.
func (*FileTransfer) RegisterSentProgressCallback ¶
RegisterSentProgressCallback allows for the registration of a callback to track the progress of an individual sent file transfer.
SentProgressCallback is auto registered on Send; this function should be called when resuming clients or registering extra callbacks.
Parameters:
- args[0] - File transfer fileTransfer.TransferID (Uint8Array).
- args[1] - Javascript object that has functions that implement the bindings.FileTransferSentProgressCallback interface.
- args[2] - Duration, in milliseconds, to wait between progress callbacks triggering (int).
Returns:
- Throws a TypeError if registering the callback fails.
func (*FileTransfer) Send ¶
Send is the bindings-level function for sending a file.
Parameters:
- args[0] - JSON of bindings.FileSend (Uint8Array).
- args[1] - Marshalled bytes of the recipient id.ID (Uint8Array).
- args[2] - Number of retries allowed (float).
- args[3] - Javascript object that has functions that implement the bindings.FileTransferSentProgressCallback interface.
- args[4] - Duration, in milliseconds, to wait between progress callbacks triggering (int).
Returns a promise:
- Resolves to a unique ID for this file transfer (Uint8Array).
- Rejected with an error if sending fails.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group wraps the bindings.Group object so its methods can be wrapped to be Javascript compatible.
func (*Group) GetCreatedMS ¶
GetCreatedMS returns the time the group was created in milliseconds. This is also the time the group requests were sent.
Returns:
- The time the group was created, in milliseconds (int).
func (*Group) GetCreatedNano ¶
GetCreatedNano returns the time the group was created in nanoseconds. This is also the time the group requests were sent.
Returns:
- The time the group was created, in nanoseconds (int).
func (*Group) GetID ¶
GetID return the 33-byte unique group ID. This represents the id.ID object.
Returns:
- Marshalled bytes of the group id.ID (Uint8Array).
func (*Group) GetInitMessage ¶
GetInitMessage returns initial message sent with the group request.
Returns:
- Initial group message contents (Uint8Array).
func (*Group) GetMembership ¶
GetMembership retrieves a list of group members. The list is in order; the first contact is the leader/creator of the group. All subsequent members are ordered by their ID.
Returns:
- JSON of group.Membership (Uint8Array).
- Throws a TypeError if marshalling fails.
type GroupChat ¶
type GroupChat struct {
// contains filtered or unexported fields
}
GroupChat wraps the bindings.GroupChat object so its methods can be wrapped to be Javascript compatible.
func (*GroupChat) GetGroup ¶
GetGroup returns the group with the group ID. If no group exists, then the error "failed to find group" is returned.
Parameters:
- args[0] - The marshalled bytes of the group id.ID (Uint8Array). This can be found in the report returned by GroupChat.MakeGroup.
Returns:
- Javascript representation of the GroupChat object.
- Throws a TypeError if getting the group fails.
func (*GroupChat) GetGroups ¶
GetGroups returns a list of group IDs that the user is a member of.
Returns:
- JSON of array of id.ID representing all group ID's (Uint8Array).
- Throws a TypeError if getting the groups fails.
func (*GroupChat) JoinGroup ¶
JoinGroup allows a user to join a group when a request is received. If an error is returned, handle it properly first; you may then retry later with the same trackedGroupId.
Parameters:
- args[0] - The result of calling Group.Serialize on any bindings.Group object returned over the bindings (Uint8Array).
Returns:
- Throws a TypeError if joining the group fails.
func (*GroupChat) LeaveGroup ¶
LeaveGroup deletes a group so a user no longer has access.
Parameters:
- args[0] - The marshalled bytes of the group id.ID (Uint8Array). This can be found in the report returned by GroupChat.MakeGroup.
Returns:
- Throws a TypeError if leaving the group fails.
func (*GroupChat) MakeGroup ¶
MakeGroup creates a new group and sends a group request to all members in the group.
Parameters:
- args[0] - JSON of array of id.ID; it contains the IDs of members the user wants to add to the group (Uint8Array).
- args[1] - The initial message sent to all members in the group. This is an optional parameter and may be nil (Uint8Array).
- args[2] - The name of the group decided by the creator. This is an optional parameter and may be nil. If nil the group will be assigned the default name (Uint8Array).
Returns a promise:
- Resolves to the JSON of the bindings.GroupReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if making the group fails.
func (*GroupChat) NumGroups ¶
NumGroups returns the number of groups the user is a part of.
Returns:
- Number of groups (int).
func (*GroupChat) ResendRequest ¶
ResendRequest resends a group request to all members in the group.
Parameters:
- args[0] - The marshalled bytes of the group id.ID (Uint8Array). This can be found in the report returned by GroupChat.MakeGroup.
Returns a promise:
- Resolves to the JSON of the bindings.GroupReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if resending the request fails.
func (*GroupChat) Send ¶
Send is the bindings-level function for sending to a group.
Parameters:
- args[0] - The marshalled bytes of the group id.ID (Uint8Array). This can be found in the report returned by GroupChat.MakeGroup.
- args[1] - The message that the user wishes to send to the group (Uint8Array).
- args[2] - The tag associated with the message (string). This tag may be empty.
Returns a promise:
- Resolves to the JSON of the bindings.GroupSendReport, which can be passed into Cmix.WaitForRoundResult to see if the send succeeded (Uint8Array).
- Rejected with an error if sending the message to the group fails.
type JsConsoleLogListener ¶
type JsConsoleLogListener struct { jww.Threshold js.Value // contains filtered or unexported fields }
JsConsoleLogListener redirects log output to the Javascript console.
func NewJsConsoleLogListener ¶
func NewJsConsoleLogListener(threshold jww.Threshold) *JsConsoleLogListener
NewJsConsoleLogListener initialises a new log listener that listener for the specific threshold and prints the logs to the Javascript console.
func (*JsConsoleLogListener) Listen ¶
func (ll *JsConsoleLogListener) Listen(t jww.Threshold) io.Writer
Listen is called for every logging event. This function adheres to the jwalterweatherman.LogListener type.
type LogFile ¶
type LogFile struct {
// contains filtered or unexported fields
}
LogFile represents a virtual log file in memory. It contains a circular buffer that limits the log file, overwriting the oldest logs.
func NewLogFile ¶
NewLogFile initialises a new LogFile for log writing.
func (*LogFile) Listen ¶
Listen is called for every logging event. This function adheres to the jwalterweatherman.LogListener type.
func (*LogFile) MaxSize ¶
MaxSize returns the max size, in bytes, that the log file is allowed to be.
Returns:
- Max file size (int).
type ShareURL ¶
type ShareURL struct {}
ShareURL is returned by GetShareURL containing the sharable URL and a password, if the channel is private.
type Stopper ¶
type Stopper struct {
// contains filtered or unexported fields
}
Stopper wraps the bindings.Stopper interface so its methods can be wrapped to be Javascript compatible.
type UserDiscovery ¶
type UserDiscovery struct {
// contains filtered or unexported fields
}
UserDiscovery wraps the bindings.UserDiscovery object so its methods can be wrapped to be Javascript compatible.
func (*UserDiscovery) ConfirmFact ¶
ConfirmFact confirms a fact first registered via UserDiscovery.SendRegisterFact. The confirmation ID comes from UserDiscovery.SendRegisterFact while the code will come over the associated communications system.
Parameters:
- args[0] - Confirmation ID (string).
- args[1] - Code (string).
Returns:
- Throws TypeError if confirming the fact fails.
func (*UserDiscovery) GetContact ¶
GetContact returns the marshalled bytes of the contact.Contact for UD as retrieved from the NDF.
Returns:
- Marshalled bytes of contact.Contact (Uint8Array).
- Throws TypeError if getting the contact fails.
func (*UserDiscovery) GetFacts ¶
GetFacts returns a JSON marshalled list of fact.Fact objects that exist within the Store's registeredFacts map.
Returns:
- JSON of fact.FactList (Uint8Array).
func (*UserDiscovery) GetID ¶
GetID returns the ID for this UserDiscovery in the UserDiscovery tracker.
Returns:
- Tracker ID (int).
func (*UserDiscovery) PermanentDeleteAccount ¶
PermanentDeleteAccount removes the username associated with this user from the UD service. This will only take a username type fact, and the fact must be associated with this user.
Parameters:
- args[0] - JSON of fact.Fact (Uint8Array).
Returns:
- Throws TypeError if deletion fails.
func (*UserDiscovery) RemoveFact ¶
RemoveFact removes a previously confirmed fact. This will fail if the fact passed in is not UD service does not associate this fact with this user.
Parameters:
- args[0] - JSON of fact.Fact (Uint8Array).
Returns:
- Throws TypeError if removing the fact fails.
func (*UserDiscovery) SendRegisterFact ¶
SendRegisterFact adds a fact for the user to user discovery. Will only succeed if the user is already registered and the system does not have the fact currently registered for any user.
This does not complete the fact registration process, it returns a confirmation ID instead. Over the communications system the fact is associated with, a code will be sent. This confirmation ID needs to be called along with the code to finalize the fact.
Parameters:
- args[0] - JSON of fact.Fact (Uint8Array).
Returns:
- The confirmation ID (string).
- Throws TypeError if sending the fact fails.