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 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 GetShareUrlType(_ js.Value, args []js.Value) any
- func GetVersion(js.Value, []js.Value) any
- func GetWasmSemanticVersion(js.Value, []js.Value) any
- func GetXXDKSemanticVersion(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(this 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 NewDMClient(_ js.Value, args []js.Value) any
- func NewDMClientWithIndexedDb(_ js.Value, args []js.Value) any
- func NewDMClientWithIndexedDbUnsafe(_ js.Value, args []js.Value) any
- func NewDMsDatabaseCipher(_ 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 SupportedEmojis(js.Value, []js.Value) any
- func TransmitSingleUse(_ js.Value, args []js.Value) any
- func UpdateCommonErrors(_ js.Value, args []js.Value) any
- func ValidForever(js.Value, []js.Value) any
- func ValidateReaction(_ 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 (cm *ChannelsManager) AreDMsEnabled(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) DeleteChannelAdminKey(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) DeleteMessage(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) DeleteNickname(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) DisableDirectMessages(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) EnableDirectMessages(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) ExportChannelAdminKey(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) ExportPrivateIdentity(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) GenerateChannel(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) GetChannels(js.Value, []js.Value) any
- func (cm *ChannelsManager) GetID(js.Value, []js.Value) any
- func (cm *ChannelsManager) GetIdentity(js.Value, []js.Value) any
- func (cm *ChannelsManager) GetMutedUsers(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) GetNickname(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) GetShareURL(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) GetStorageTag(js.Value, []js.Value) any
- func (cm *ChannelsManager) ImportChannelAdminKey(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) IsChannelAdmin(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) JoinChannel(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) LeaveChannel(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) MuteUser(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) Muted(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) PinMessage(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) RegisterReceiveHandler(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) ReplayChannel(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SendAdminGeneric(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SendGeneric(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SendMessage(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SendReaction(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SendReply(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) SetNickname(_ js.Value, args []js.Value) any
- func (cm *ChannelsManager) VerifyChannelAdminKey(_ 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) SetTrackNetworkPeriod(_ 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 DMClient
- func (dmc *DMClient) ExportPrivateIdentity(_ js.Value, args []js.Value) any
- func (dmc *DMClient) GetDatabaseName(_ js.Value, _ []js.Value) any
- func (dmc *DMClient) GetID(js.Value, []js.Value) any
- func (dmc *DMClient) GetIdentity(js.Value, []js.Value) any
- func (dmc *DMClient) GetNickname(_ js.Value, _ []js.Value) any
- func (dmc *DMClient) GetPublicKey(js.Value, []js.Value) any
- func (dmc *DMClient) GetToken(js.Value, []js.Value) any
- func (dmc *DMClient) Send(_ js.Value, args []js.Value) any
- func (dmc *DMClient) SendReaction(_ js.Value, args []js.Value) any
- func (dmc *DMClient) SendReply(_ js.Value, args []js.Value) any
- func (dmc *DMClient) SendText(_ js.Value, args []js.Value) any
- func (dmc *DMClient) SetNickname(_ js.Value, args []js.Value) any
- type DMDbCipher
- func (c *DMDbCipher) Decrypt(_ js.Value, args []js.Value) any
- func (c *DMDbCipher) Encrypt(_ js.Value, args []js.Value) any
- func (c *DMDbCipher) GetID(js.Value, []js.Value) any
- func (c *DMDbCipher) MarshalJSON(js.Value, []js.Value) any
- func (c *DMDbCipher) UnmarshalJSON(_ js.Value, args []js.Value) any
- 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 MessageAndError
- 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
- type VersionInfo
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 creates a codename in a public [channel.Identity] from an extant identity for a given 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 GenerateChannelIdentity ¶
GenerateChannelIdentity creates a new private channel identity ([channel.PrivateIdentity]) from scratch and assigns it a codename.
The public component can be retrieved as JSON via GetPublicChannelIdentityFromPrivate.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
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 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 (int).
- 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 GetWasmSemanticVersion ¶ added in v0.3.0
GetWasmSemanticVersion returns the current version of the WASM client, it's old version before being updated, and if it has been updated.
Returns:
- JSON of VersionInfo (Uint8Array).
- Throws a TypeError if getting the version failed.
func GetXXDKSemanticVersion ¶ added in v0.3.0
GetXXDKSemanticVersion returns the current version of the xxdk client, it's old version before being updated, and if it has been updated.
Returns:
- JSON of VersionInfo (Uint8Array).
- Throws a TypeError if getting the version failed.
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 from ChannelsManager.ExportPrivateIdentity (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 for the given storage tag.
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] - Path to Javascript file that starts the worker (string).
- args[2] - The storage tag associated with the previously created channel manager and retrieved with ChannelsManager.GetStorageTag (string).
- args[3] - The received message callback, which is called everytime a message is added or changed in the database. It is a 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[4] - The deleted message callback, which is called everytime a message is deleted from the database. It is a function that takes in the same parameters as [indexedDb.DeletedMessageCallback]. On the Javascript side, the message ID is returned as a Uint8Array.
- args[5] - The muted user callback, which is called everytime a user is muted or unmuted. It is a function that takes in the same parameters as [indexedDb.MutedUserCallback]. On the Javascript side, the channel ID and user public key are returned as Uint8Array.
- args[6] - 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] - Path to Javascript file that starts the worker (string).
- args[2] - The storage tag associated with the previously created channel manager and retrieved with ChannelsManager.GetStorageTag (string).
- args[3] - The received message callback, which is called everytime a message is added or changed in the database. It is a 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[4] - The deleted message callback, which is called everytime a message is deleted from the database. It is a function that takes in the same parameters as [indexedDb.DeletedMessageCallback]. On the Javascript side, the message ID is returned as a Uint8Array.
- args[5] - The muted user callback, which is called everytime a user is muted or unmuted. It is a function that takes in the same parameters as [indexedDb.MutedUserCallback]. On the Javascript side, the channel ID and user public key are returned as Uint8Array.
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 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] - Path to Javascript file that starts the worker (string).
- args[2] - Bytes of a private identity ([channel.PrivateIdentity]) that is generated by GenerateChannelIdentity (Uint8Array).
- args[3] - The received message callback, which is called everytime a message is added or changed in the database. It is a 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[4] - The deleted message callback, which is called everytime a message is deleted from the database. It is a function that takes in the same parameters as [indexedDb.DeletedMessageCallback]. On the Javascript side, the message ID is returned as a Uint8Array.
- args[5] - The muted user callback, which is called everytime a user is muted or unmuted. It is a function that takes in the same parameters as [indexedDb.MutedUserCallback]. On the Javascript side, the channel ID and user public key are returned as Uint8Array.
- args[6] - 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] - Path to Javascript file that starts the worker (string).
- args[2] - Bytes of a private identity ([channel.PrivateIdentity]) that is generated by GenerateChannelIdentity (Uint8Array).
- args[3] - The received message callback, which is called everytime a message is added or changed in the database. It is a 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[4] - The deleted message callback, which is called everytime a message is deleted from the database. It is a function that takes in the same parameters as [indexedDb.DeletedMessageCallback]. On the Javascript side, the message ID is returned as a Uint8Array.
- args[5] - The muted user callback, which is called everytime a user is muted or unmuted. It is a function that takes in the same parameters as [indexedDb.MutedUserCallback]. On the Javascript side, the channel ID and user public key are returned as Uint8Array.
Returns a promise:
- Resolves to a Javascript representation of the ChannelsManager object.
- Rejected with an error if loading indexedDb or the manager fails.
FIXME: package names in comments for indexedDb
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 a promise:
- Resolves on success.
- Rejected with an error if creating a new cMix client 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 NewDMClient ¶ added in v0.3.0
NewDMClient creates a new DMClient from a new private identity ([channel.PrivateIdentity]).
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 DMClient object.
- Throws a TypeError if creating the manager fails.
func NewDMClientWithIndexedDb ¶ added in v0.3.0
NewDMClientWithIndexedDb creates a new DMClient from a new private identity ([channel.PrivateIdentity]) and using indexedDbWorker as a backend to manage the event model.
This function initialises an indexedDbWorker database.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - Path to Javascript file that starts the worker (string).
- args[2] - Bytes of a private identity ([channel.PrivateIdentity]) that is generated by GenerateChannelIdentity (Uint8Array).
- args[3] - Function that takes in the same parameters as [indexedDbWorker.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[4] - 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 DMClient object.
- Rejected with an error if loading indexedDbWorker or the manager fails.
- Throws a TypeError if the cipher ID does not correspond to a cipher.
func NewDMClientWithIndexedDbUnsafe ¶ added in v0.3.0
NewDMClientWithIndexedDbUnsafe creates a new DMClient from a new private identity ([channel.PrivateIdentity]) and using indexedDbWorker 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 function initialises an indexedDbWorker database.
Parameters:
- args[0] - ID of Cmix object in tracker (int). This can be retrieved using Cmix.GetID.
- args[1] - Path to Javascript file that starts the worker (string).
- args[2] - Bytes of a private identity ([channel.PrivateIdentity]) that is generated by GenerateChannelIdentity (Uint8Array).
- args[3] - Function that takes in the same parameters as [indexedDbWorker.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. messageUpdate is true if the Message already exists and was edited. conversationUpdate is true if the Conversation was created or modified.
Returns a promise:
- Resolves to a Javascript representation of the DMClient object.
- Rejected with an error if loading indexedDbWorker or the manager fails.
func NewDMsDatabaseCipher ¶ added in v0.3.0
NewDMsDatabaseCipher constructs a DMDbCipher 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 DMDbCipher.Encrypt that is larger than this value will result in an error (int).
Returns:
- JavaScript representation of the DMDbCipher object.
- Throws a TypeError if creating the cipher fails.
func NewDummyTrafficManager ¶
NewDummyTrafficManager creates a DummyTraffic manager and initialises the dummy traffic sending thread. Note that the manager is by default paused, and as such the sending thread must be started by calling DummyTraffic.Start. 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 SupportedEmojis ¶ added in v0.3.0
SupportedEmojis returns a list of emojis that are supported by the backend.
Returns:
- JSON of an array of gomoji.Emoji (Uint8Array).
- Throws a TypeError if marshalling the JSON fails.
Example JSON:
[ { "slug": "smiling-face", "character": "☺️", "unicode_name": "E0.6 smiling face", "code_point": "263A FE0F", "group": "Smileys \u0026 Emotion", "sub_group": "face-affection" }, { "slug": "frowning-face", "character": "☹️", "unicode_name": "E0.7 frowning face", "code_point": "2639 FE0F", "group": "Smileys \u0026 Emotion", "sub_group": "face-concerned" }, { "slug": "banana", "character": "�", "unicode_name": "E0.6 banana", "code_point": "1F34C", "group": "Food \u0026 Drink", "sub_group": "food-fruit" } ]
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.
func ValidForever ¶ added in v0.3.0
ValidForever returns the value to use for validUntil when you want a message to be available for the maximum amount of time.
Returns:
- The maximum amount of time (int).
func ValidateReaction ¶ added in v0.3.0
ValidateReaction checks that the reaction only contains a single emoji.
Parameters:
- args[0] - The reaction emoji to validate (string).
Returns:
- If the reaction is valid, returns null.
- If the reaction is invalid, returns a Javascript Error object containing emoji.InvalidReaction.
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.
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) AreDMsEnabled ¶ added in v0.3.0
AreDMsEnabled returns the status of direct messaging for a given channel.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- enabled (bool) - status of dms for passed in channel ID, true if enabled
- Throws a TypeError if unmarshalling the channel ID
func (*ChannelsManager) DeleteChannelAdminKey ¶ added in v0.3.0
DeleteChannelAdminKey deletes the private key for the given channel.
CAUTION: This will remove admin access. This cannot be undone. If the private key is deleted, it cannot be recovered and the channel can never have another admin.
Parameters:
- args[0] - The marshalled bytes of the channel's id.ID (Uint8Array)
Returns:
- Throws a TypeError if the deletion fails.
func (*ChannelsManager) DeleteMessage ¶ added in v0.3.0
DeleteMessage deletes the targeted message from user's view. Users may delete their own messages but only the channel admin can delete other user's messages. If the user is not an admin of the channel or if they are not the sender of the targetMessage, then the error channels.NotAnAdminErr is returned.
If undoAction is true, then the targeted message is un-deleted.
Clients will drop the deletion if they do not recognize the target message.
Parameters:
- args[0] - Marshalled bytes of channel id.ID (Uint8Array).
- args[1] - The marshalled [channel.MessageID] of the message you want to delete (Uint8Array).
- args[2] - JSON of xxdk.CMIXParams. This may be empty, and 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) DeleteNickname ¶
DeleteNickname removes the nickname for a given channel. The name will revert back to the codename for this channel instead.
Parameters:
- args[0] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- Throws TypeError if deleting the nickname fails.
func (*ChannelsManager) DisableDirectMessages ¶ added in v0.3.0
DisableDirectMessages removes the token for direct messaging for a given channel.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- Throws a TypeError if saving the DM token fails
func (*ChannelsManager) EnableDirectMessages ¶ added in v0.3.0
EnableDirectMessages enables the token for direct messaging for this channel.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns:
- Throws a TypeError if saving the DM token fails.
func (*ChannelsManager) ExportChannelAdminKey ¶ added in v0.3.0
ExportChannelAdminKey gets the private key for the given channel ID, encrypts it with the provided encryptionPassword, and exports it into a portable format. Returns an error if the user is not an admin of the channel.
This key can be provided to other users in a channel to grant them admin access using ChannelsManager.ImportChannelAdminKey.
The private key is encrypted using a key generated from the password using Argon2. Each call to ExportChannelAdminKey produces a different encrypted packet regardless if the same password is used for the same channel. It cannot be determined which channel the payload is for nor that two payloads are for the same channel.
The passwords between each call are not related. They can be the same or different with no adverse impact on the security properties.
Parameters:
- args[0] - Marshalled bytes of the channel's id.ID (Uint8Array).
- args[1] - The password used to encrypt the private key (string). The passwords between each call are not related. They can be the same or different with no adverse impact on the security properties.
Returns:
- Portable string of the channel private key encrypted with the password (Uint8Array).
- Throws a TypeError if the user is not an admin for the channel.
func (*ChannelsManager) ExportPrivateIdentity ¶
ExportPrivateIdentity encrypts the private identity using the password and exports it to a portable string.
Parameters:
- password - The password used to encrypt the private identity (string).
Returns:
- Encrypted portable private identity (Uint8Array).
- Throws TypeError if exporting the identity fails.
func (*ChannelsManager) GenerateChannel ¶ added in v0.3.0
GenerateChannel creates a new channel with the user as the admin and returns the pretty print of the channel. This function only create a channel and does not join it.
The private key is saved to storage and can be accessed with ChannelsManager.ExportChannelAdminKey.
Parameters:
- args[0] - 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[1] - 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[2] - The broadcast.PrivacyLevel of the channel (int). 0 = public, 1 = private, and 2 = secret. Refer to the comment below for more information.
Returns a promise:
- Resolves to the pretty print of the channel (string).
- Rejected with an error 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 (*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 public identity ([channel.Identity]) of the user associated with this channel manager.
Returns:
- JSON of the [channel.Identity] (Uint8Array).
- Throws TypeError if marshalling the identity fails.
func (*ChannelsManager) GetMutedUsers ¶ added in v0.3.0
GetMutedUsers returns the list of the public keys for each muted user in the channel. If there are no muted user or if the channel does not exist, an empty list is returned.
Parameters:
- args[0] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- JSON of an array of ed25519.PublicKey (Uint8Array). Look below for an example.
- Throws a TypeError if the channel ID cannot be unmarshalled.
Example return:
["k2IrybDXjJtqxjS6Tx/6m3bXvT/4zFYOJnACNWTvESE=","ocELv7KyeCskLz4cm0klLWhmFLYvQL2FMDco79GTXYw=","mmxoDgoTEYwaRyEzq5Npa24IIs+3B5LXhll/8K5yCv0="]
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 set for the channel (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, it will be verified when calling DecodePublicURL and 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 tag where this manager is stored. To be used when loading the manager. The storage tag is derived from the public key.
Returns:
- Storage tag (string).
func (*ChannelsManager) ImportChannelAdminKey ¶ added in v0.3.0
ImportChannelAdminKey decrypts and imports the given encrypted private key and grants the user admin access to the channel the private key belongs to. Returns an error if the private key cannot be decrypted or if the private key is for the wrong channel.
Parameters:
- args[0] - Marshalled bytes of the channel's id.ID (Uint8Array).
- args[1] - The password used to encrypt the private key (string)
- args[2] - The encrypted channel private key packet (Uint8Array).
Returns:
- Throws a TypeError if the password is invalid or the private key does not match the channel ID.
- Throws a TypeError with the message channels.WrongPasswordErr for an invalid password.
- Throws a TypeError with the message channels.ChannelDoesNotExistsErr if the channel has not already been joined.
- Throws a TypeError with the message channels.WrongPrivateKeyErr if the private key does not belong to the channel.
func (*ChannelsManager) IsChannelAdmin ¶ added in v0.3.0
IsChannelAdmin returns true if the user is an admin of the channel.
Parameters:
- args[0] - The marshalled bytes of the channel's id.ID (Uint8Array)
Returns:
- True if the user is an admin in the channel and false otherwise (boolean).
- Throws a TypeError if the channel ID cannot be unmarshalled.
func (*ChannelsManager) JoinChannel ¶
JoinChannel joins the given channel. It will return the error channels.ChannelAlreadyExistsErr if the channel has already been joined.
Parameters:
- args[0] - A portable channel string. Should be received from another user or generated via ChannelsManager.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 a promise:
- Resolves to the JSON of bindings.ChannelInfo, which describes all relevant channel information (Uint8Array).
- Rejected with an error if joining the channel fails.
func (*ChannelsManager) LeaveChannel ¶
LeaveChannel leaves the given channel. It will return the error channels.ChannelDoesNotExistsErr if the channel was not previously joined.
Parameters:
- args[0] - Marshalled bytes of the channel id.ID (Uint8Array).
Returns a promise:
- Resolves on success (void).
- Rejected with an error if the channel does not exist.
func (*ChannelsManager) MuteUser ¶ added in v0.3.0
MuteUser is used to mute a user in a channel. Muting a user will cause all future messages from the user being dropped on reception. Muted users are also unable to send messages. Only the channel admin can mute a user; if the user is not an admin of the channel, then the error channels.NotAnAdminErr is returned.
If undoAction is true, then the targeted user will be unmuted.
Parameters:
- args[0] - Marshalled bytes of channel id.ID (Uint8Array).
- args[1] - The ed25519.PublicKey of the user you want to mute (Uint8Array).
- args[2] - Set to true to unmute the message (boolean).
- args[3] - The time, in milliseconds, that the user should be muted (int). To remain muted indefinitely, use ValidForever.
- args[4] - JSON of xxdk.CMIXParams. This may be empty, and 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) Muted ¶ added in v0.3.0
Muted returns true if the user is currently muted in the given channel.
Parameters:
- args[0] - Marshalled bytes if the channel's id.ID (Uint8Array).
Returns:
- Returns true if the user is muted in the channel and false otherwise (boolean).
- Throws a TypeError if the channel ID cannot be unmarshalled.
func (*ChannelsManager) PinMessage ¶ added in v0.3.0
PinMessage pins the target message to the top of a channel view for all users in the specified channel. Only the channel admin can pin user messages; if the user is not an admin of the channel, then the error channels.NotAnAdminErr is returned.
If undoAction is true, then the targeted message is unpinned.
Clients will drop the pin if they do not recognize the target message.
Parameters:
- args[0] - Marshalled bytes of channel id.ID (Uint8Array).
- args[1] - The marshalled [channel.MessageID] of the message you want to pin (Uint8Array).
- args[2] - Set to true to unpin the message (boolean).
- args[3] - The time, in milliseconds, that the message should be pinned (int). To remain pinned indefinitely, use ValidForever.
- args[4] - JSON of xxdk.CMIXParams. This may be empty, and 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) 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.
- args[2] - A name describing what type of messages the listener picks up. This is used for debugging and logging (string).
- args[3] - Set to true if this listener can receive messages from normal users (boolean).
- args[4] - Set to true if this listener can receive messages from admins (boolean).
- args[5] - Set to true if this listener can receive messages from muted users (boolean).
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.
Returns the error channels.ChannelDoesNotExistsErr if the channel was not previously joined.
Parameters:
- args[0] - Marshalled bytes of the channel's 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.
If the user is not an admin of the channel (i.e. does not have a private key for the channel saved to storage), then the error channels.NotAnAdminErr is returned.
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). The message should be at most 510 bytes.
- args[3] - The lease of the message. This will be how long the message is available from the network, in milliseconds (int). 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. Use ValidForever to last the max message life.
- args[4] - Set tracked to true if the message should be tracked in the sendTracker, which allows messages to be shown locally before they are received on the network. In general, all messages that will be displayed to the user should be tracked while all actions should not be (boolean).
- 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 that 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 is not 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.
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 available from the network, in milliseconds (int). 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. Use ValidForever to last the max message life.
- args[4] - Set tracked to true if the message should be tracked in the sendTracker, which allows messages to be shown locally before they are received on the network. In general, all messages that will be displayed to the user should be tracked while all actions should not be (boolean).
- 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) 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 available from the network, in milliseconds (int). 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. Use ValidForever to last the max message life.
- 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.
Clients 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] - The lease of the message. This will be how long the message is available from the network, in milliseconds (int). 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. Use ValidForever to last the max message life.
- 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) SendReply ¶
SendReply is used to send a formatted message over a channel.
Due to the underlying encoding using compression, it is not 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 that the reply is sent to does not exist, then the other side will post the message as a normal message and not as a reply.
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 available from the network, in milliseconds (int). 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. Use ValidForever to last the max message life.
- 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.
func (*ChannelsManager) VerifyChannelAdminKey ¶ added in v0.3.0
VerifyChannelAdminKey verifies that the encrypted private key can be decrypted and that it matches the expected channel. Returns false if private key does not belong to the given channel.
Parameters:
- args[0] - Marshalled bytes of the channel's id.ID (Uint8Array).
- args[1] - The password used to encrypt the private key (string)
- args[2] - The encrypted channel private key packet (Uint8Array).
Returns:
- Returns false if private key does not belong to the given channel ID (boolean).
- Throws a TypeError if the password is invalid.
Returns:
- bool - True if the private key belongs to the channel and false otherwise.
- Throws a TypeError with the message channels.WrongPasswordErr for an invalid password.
- Throws a TypeError with the message channels.ChannelDoesNotExistsErr i the channel has not already been joined.
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) SetTrackNetworkPeriod ¶ added in v0.3.0
SetTrackNetworkPeriod allows changing the frequency that follower threads are started.
Parameters:
- args[0] - The duration of the period, in milliseconds (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.
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 DMClient ¶ added in v0.3.0
type DMClient struct {
// contains filtered or unexported fields
}
DMClient wraps the bindings.DMClient object so its methods can be wrapped to be Javascript compatible.
func (*DMClient) ExportPrivateIdentity ¶ added in v0.3.0
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 (*DMClient) GetDatabaseName ¶ added in v0.3.0
GetDatabaseName returns the storage tag, so users listening to the database can separately listen and read updates there.
Parameters:
Returns:
- The storage tag (string).
func (*DMClient) GetID ¶ added in v0.3.0
GetID returns the ecdh Public Key for this DMClient in the DMClient tracker.
Returns:
- Tracker ID (int).
func (*DMClient) GetIdentity ¶ added in v0.3.0
GetIdentity returns the marshaled public identity (codename.Identity) that the client is using.
Returns:
- JSON of the [channel.Identity] (Uint8Array).
- Throws TypeError if marshalling the identity fails.
func (*DMClient) GetNickname ¶ added in v0.3.0
GetNickname returns the nickname set for this user. Returns an error if there is no nickname set.
Returns:
- The nickname (string).
- Throws TypeError if the channel has no nickname set.
func (*DMClient) GetPublicKey ¶ added in v0.3.0
func (*DMClient) Send ¶ added in v0.3.0
Send 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 (*DMClient) SendReaction ¶ added in v0.3.0
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 (*DMClient) SendReply ¶ added in v0.3.0
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 (*DMClient) SendText ¶ added in v0.3.0
SendText 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 (*DMClient) SetNickname ¶ added in v0.3.0
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 DMDbCipher ¶ added in v0.3.0
type DMDbCipher struct {
// contains filtered or unexported fields
}
DMDbCipher wraps the bindings.DMDbCipher object so its methods can be wrapped to be Javascript compatible.
func (*DMDbCipher) Decrypt ¶ added in v0.3.0
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 DMDbCipher.Encrypt (Uint8Array).
Returns:
- The plaintext of the ciphertext passed in (Uint8Array).
- Throws a TypeError if it fails to encrypt the plaintext.
func (*DMDbCipher) Encrypt ¶ added in v0.3.0
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 NewDMsDatabaseCipher. 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 (*DMDbCipher) GetID ¶ added in v0.3.0
GetID returns the ID for this bindings.DMDbCipher in the channelDbCipherTracker.
Returns:
- Tracker ID (int).
func (*DMDbCipher) MarshalJSON ¶ added in v0.3.0
MarshalJSON marshals the cipher into valid JSON.
Returns:
- JSON of the cipher (Uint8Array).
- Throws a TypeError if marshalling fails.
func (*DMDbCipher) UnmarshalJSON ¶ added in v0.3.0
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 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 the status returned here may lag behind a user's earlier call to pause the sending thread. This is a result of a small delay (see DummyTraffic.Pause for more details)
Returns:
- Returns true ([dummy.Running]) if the sending thread is sending messages and false ([dummy.Paused]) if the sending thread is not sending messages.
func (*DummyTraffic) Pause ¶ added in v0.3.0
Pause will pause the DummyTraffic's sending thread, meaning messages will no longer be sent. After calling Pause, the sending thread may only be resumed by calling Resume.
There may be a small delay between this call and the pause taking effect. This is because Pause will not cancel the thread when it is in the process of sending messages, but will instead wait for that thread to complete. The thread will then be prevented from beginning another round of sending.
Returns:
- Throws a TypeError if it fails to send a pause signal to the sending thread.
func (*DummyTraffic) Start ¶ added in v0.3.0
Start will start up the DummyTraffic's sending thread, meaning messages will be sent. This should be called after calling NewDummyTrafficManager, by default the thread is paused. This may also be called after a call to DummyTraffic.Pause.
This will re-initialize the sending thread with a new randomly generated interval between sending dummy messages. This means that there is zero guarantee that the sending interval prior to pausing will be the same sending interval after a call to Start.
Returns:
- Throws a TypeError if it fails to send a start signal to the sending thread.
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 MessageAndError ¶ added in v0.3.0
type MessageAndError struct { // MessageJSON should contain the JSON of channels.ModelMessage. ModelMessage channels.ModelMessage // Error should only be filled when an error occurs on message lookup. Error string }
MessageAndError contains a message returned by eventModel.GetMessage or any possible error that occurs during lookup. Only one field should be present at a time; if an error occurs, ModelMessage should be empty.
Example JSON:
{ "ModelMessage": { "UUID": 50, "Nickname": "Nickname", "MessageID": "ODg5goFIBvpvqPzuoYGqmvxFYBgj0MMiQxAB51Q2nPs=", "ChannelID": "R+xKJTH6m4YRS4f0JggK3fTu10sANmtahS0Qtc8yi/AD", "ParentMessageID": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", "Timestamp": "1955-11-05T12:01:00-07:00", "Lease": 21600000000000, "Status": 2, "Hidden": false, "Pinned": false, "Content": "VGhpcyBpcyBzb21lIG1lc3NhZ2UgY29udGVudC4=", "Type": 1, "Round": 7, "PubKey": "QyTtpndOf3sDZehVpOBQzQNBe1R2Eae7qlAEDZJ2mLg=", "CodesetVersion": 0 }, "Error": "" }
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.
type VersionInfo ¶ added in v0.3.0
type VersionInfo struct { Current string `json:"current"` Updated bool `json:"updated"` Old string `json:"old"` }
VersionInfo contains information about the current and old version of the API.
Source Files ¶
- authenticatedConnection.go
- backup.go
- channels.go
- cmix.go
- connect.go
- delivery.go
- dm.go
- docs.go
- dummy.go
- e2e.go
- e2eAuth.go
- e2eHandler.go
- emoji.go
- errors.go
- fileTransfer.go
- follow.go
- group.go
- identity.go
- logging.go
- ndf.go
- params.go
- restlike.go
- restlikeSingle.go
- secrets.go
- single.go
- timeNow.go
- ud.go
- version.go