Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mobile/ios/elixxir-dapps-sdk-swift
1 result
Show changes
Commits on Source (4)
Showing
with 379 additions and 329 deletions
https://git.xx.network/elixxir/client/-/commit/bb287e20aef30c7e9714696dd69ca735a56409da
https://git.xx.network/elixxir/client/-/commit/121dc3f34d61e24e23c805c38f2e0c5330f29cb1
go version go1.19.3 darwin/arm64
Xcode 14.1 Build version 14B47b
gomobile bind target: ios,iossimulator,macos
No preview for this file type
......@@ -862,9 +862,9 @@ health changes. Returns a registration ID that can be used to unregister.
registrations up to the initialized maximum.
Parameters:
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
*/
- (BOOL)changeNumberOfNodeRegistrations:(long)toRun timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -889,11 +889,11 @@ Parameters:
* GetNodeRegistrationStatus returns the current state of node registration.
Returns:
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
*/
- (NSData* _Nullable)getNodeRegistrationStatus:(NSError* _Nullable* _Nullable)error;
/**
......@@ -907,13 +907,14 @@ 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:
- []byte - A JSON marshalled list of all running processes.
- []byte - A JSON marshalled list of all running processes.
JSON Example:
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
*/
- (NSData* _Nullable)getRunningProcesses:(NSError* _Nullable* _Nullable)error;
/**
......@@ -936,11 +937,11 @@ completed. If not all have completed, then it returns false and howClose will
be a percent (0-1) of node registrations completed.
Parameters:
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
Returns:
- JSON of [IsReadyInfo].
- JSON of [IsReadyInfo].
*/
- (NSData* _Nullable)isReady:(double)percentReady error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -957,9 +958,10 @@ messages.
/**
* NetworkFollowerStatus gets the state of the network follower. It returns a
status with the following values:
Stopped - 0
Running - 2000
Stopping - 3000
Stopped - 0
Running - 2000
Stopping - 3000
*/
- (long)networkFollowerStatus;
/**
......@@ -967,8 +969,8 @@ status with the following values:
resume them.
Parameters:
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
*/
- (BOOL)pauseNodeRegistrations:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -998,28 +1000,28 @@ 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.
- 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.
*/
- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -1035,13 +1037,26 @@ most likely be in an unrecoverable state and need to be trashed.
* TrackServices will return via a callback the list of services the
backend keeps track of, which is formally referred to as a
[message.ServiceList]. This may be passed into other bindings call which
may need context on the available services for this client.
may need context on the available services for this client. This will
provide services for all identities that the client tracks.
Parameters:
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (void)trackServices:(id<BindingsTrackServicesCallback> _Nullable)cb;
/**
* 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:
- e2eID - e2e object ID in the tracker.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (BOOL)trackServicesWithIdentity:(long)e2eId cb:(id<BindingsTrackServicesCallback> _Nullable)cb error:(NSError* _Nullable* _Nullable)error;
/**
* WaitForNetwork will block until either the network is healthy or the passed
timeout is reached. It will return true if the network is healthy.
......@@ -1970,10 +1985,11 @@ Example GroupSendReport JSON:
is to being ready.
Example JSON:
{
"IsReady": true,
"HowClose": 0.534
}
{
"IsReady": true,
"HowClose": 0.534
}
*/
@interface BindingsIsReadyInfo : NSObject <goSeqRefInterface> {
}
......@@ -2037,27 +2053,28 @@ Cmix.GetNodeRegistrationStatus returns JSON marshalled.
this user.
Example NotificationReport JSON:
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
Given the Type, the Source value will have specific contextual meanings.
Below is a table that will define the contextual meaning of the Source field
given all possible Type fields.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
*/
@interface BindingsNotificationReport : NSObject <goSeqRefInterface> {
}
......@@ -2715,18 +2732,18 @@ notifications are for this user. // This returns the JSON-marshalled
NotificationReports.
Parameters:
- e2eID - e2e object ID in the tracker
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices for information about this.
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices or
Cmix.TrackServicesWithIdentity for information about this.
Returns:
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
*/
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(long e2eId, NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
/**
* GetPubkeyFromContact returns the DH public key in the [contact.Contact]
......@@ -3164,7 +3181,7 @@ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsNewUdManagerFromBacku
The token is a firebase messaging token.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsRegisterForNotifications(long e2eId, NSString* _Nullable token, NSError* _Nullable* _Nullable error);
......@@ -3320,7 +3337,7 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData
* UnregisterForNotifications turns off notifications for this client.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsUnregisterForNotifications(long e2eId, NSError* _Nullable* _Nullable error);
......@@ -3833,33 +3850,34 @@ If there was an error retrieving or marshalling the service list,
there is an error for the second parameter which will be non-null.
Parameters:
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
Example JSON:
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
*/
@interface BindingsTrackServicesCallback : NSObject <goSeqRefInterface, BindingsTrackServicesCallback> {
}
......
......@@ -862,9 +862,9 @@ health changes. Returns a registration ID that can be used to unregister.
registrations up to the initialized maximum.
Parameters:
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
*/
- (BOOL)changeNumberOfNodeRegistrations:(long)toRun timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -889,11 +889,11 @@ Parameters:
* GetNodeRegistrationStatus returns the current state of node registration.
Returns:
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
*/
- (NSData* _Nullable)getNodeRegistrationStatus:(NSError* _Nullable* _Nullable)error;
/**
......@@ -907,13 +907,14 @@ 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:
- []byte - A JSON marshalled list of all running processes.
- []byte - A JSON marshalled list of all running processes.
JSON Example:
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
*/
- (NSData* _Nullable)getRunningProcesses:(NSError* _Nullable* _Nullable)error;
/**
......@@ -936,11 +937,11 @@ completed. If not all have completed, then it returns false and howClose will
be a percent (0-1) of node registrations completed.
Parameters:
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
Returns:
- JSON of [IsReadyInfo].
- JSON of [IsReadyInfo].
*/
- (NSData* _Nullable)isReady:(double)percentReady error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -957,9 +958,10 @@ messages.
/**
* NetworkFollowerStatus gets the state of the network follower. It returns a
status with the following values:
Stopped - 0
Running - 2000
Stopping - 3000
Stopped - 0
Running - 2000
Stopping - 3000
*/
- (long)networkFollowerStatus;
/**
......@@ -967,8 +969,8 @@ status with the following values:
resume them.
Parameters:
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
*/
- (BOOL)pauseNodeRegistrations:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -998,28 +1000,28 @@ 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.
- 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.
*/
- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -1035,13 +1037,26 @@ most likely be in an unrecoverable state and need to be trashed.
* TrackServices will return via a callback the list of services the
backend keeps track of, which is formally referred to as a
[message.ServiceList]. This may be passed into other bindings call which
may need context on the available services for this client.
may need context on the available services for this client. This will
provide services for all identities that the client tracks.
Parameters:
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (void)trackServices:(id<BindingsTrackServicesCallback> _Nullable)cb;
/**
* 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:
- e2eID - e2e object ID in the tracker.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (BOOL)trackServicesWithIdentity:(long)e2eId cb:(id<BindingsTrackServicesCallback> _Nullable)cb error:(NSError* _Nullable* _Nullable)error;
/**
* WaitForNetwork will block until either the network is healthy or the passed
timeout is reached. It will return true if the network is healthy.
......@@ -1970,10 +1985,11 @@ Example GroupSendReport JSON:
is to being ready.
Example JSON:
{
"IsReady": true,
"HowClose": 0.534
}
{
"IsReady": true,
"HowClose": 0.534
}
*/
@interface BindingsIsReadyInfo : NSObject <goSeqRefInterface> {
}
......@@ -2037,27 +2053,28 @@ Cmix.GetNodeRegistrationStatus returns JSON marshalled.
this user.
Example NotificationReport JSON:
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
Given the Type, the Source value will have specific contextual meanings.
Below is a table that will define the contextual meaning of the Source field
given all possible Type fields.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
*/
@interface BindingsNotificationReport : NSObject <goSeqRefInterface> {
}
......@@ -2715,18 +2732,18 @@ notifications are for this user. // This returns the JSON-marshalled
NotificationReports.
Parameters:
- e2eID - e2e object ID in the tracker
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices for information about this.
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices or
Cmix.TrackServicesWithIdentity for information about this.
Returns:
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
*/
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(long e2eId, NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
/**
* GetPubkeyFromContact returns the DH public key in the [contact.Contact]
......@@ -3164,7 +3181,7 @@ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsNewUdManagerFromBacku
The token is a firebase messaging token.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsRegisterForNotifications(long e2eId, NSString* _Nullable token, NSError* _Nullable* _Nullable error);
......@@ -3320,7 +3337,7 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData
* UnregisterForNotifications turns off notifications for this client.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsUnregisterForNotifications(long e2eId, NSError* _Nullable* _Nullable error);
......@@ -3833,33 +3850,34 @@ If there was an error retrieving or marshalling the service list,
there is an error for the second parameter which will be non-null.
Parameters:
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
Example JSON:
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
*/
@interface BindingsTrackServicesCallback : NSObject <goSeqRefInterface, BindingsTrackServicesCallback> {
}
......
......@@ -862,9 +862,9 @@ health changes. Returns a registration ID that can be used to unregister.
registrations up to the initialized maximum.
Parameters:
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
- toRun - The number of parallel node registrations.
- timeoutMS - The timeout, in milliseconds, to wait when changing node
registrations before failing.
*/
- (BOOL)changeNumberOfNodeRegistrations:(long)toRun timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -889,11 +889,11 @@ Parameters:
* GetNodeRegistrationStatus returns the current state of node registration.
Returns:
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
- []byte - A marshalled NodeRegistrationReport containing the number of
nodes 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.
*/
- (NSData* _Nullable)getNodeRegistrationStatus:(NSError* _Nullable* _Nullable)error;
/**
......@@ -907,13 +907,14 @@ 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:
- []byte - A JSON marshalled list of all running processes.
- []byte - A JSON marshalled list of all running processes.
JSON Example:
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
{
"FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
"MessageReception Worker 0"
}
*/
- (NSData* _Nullable)getRunningProcesses:(NSError* _Nullable* _Nullable)error;
/**
......@@ -936,11 +937,11 @@ completed. If not all have completed, then it returns false and howClose will
be a percent (0-1) of node registrations completed.
Parameters:
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
- percentReady - The percentage of nodes required to be registered with to
be ready. This is a number between 0 and 1.
Returns:
- JSON of [IsReadyInfo].
- JSON of [IsReadyInfo].
*/
- (NSData* _Nullable)isReady:(double)percentReady error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -957,9 +958,10 @@ messages.
/**
* NetworkFollowerStatus gets the state of the network follower. It returns a
status with the following values:
Stopped - 0
Running - 2000
Stopping - 3000
Stopped - 0
Running - 2000
Stopping - 3000
*/
- (long)networkFollowerStatus;
/**
......@@ -967,8 +969,8 @@ status with the following values:
resume them.
Parameters:
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
- timeoutMS - The timeout, in milliseconds, to wait when stopping threads
before failing.
*/
- (BOOL)pauseNodeRegistrations:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -998,28 +1000,28 @@ 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.
- 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.
*/
- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error;
/**
......@@ -1035,13 +1037,26 @@ most likely be in an unrecoverable state and need to be trashed.
* TrackServices will return via a callback the list of services the
backend keeps track of, which is formally referred to as a
[message.ServiceList]. This may be passed into other bindings call which
may need context on the available services for this client.
may need context on the available services for this client. This will
provide services for all identities that the client tracks.
Parameters:
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (void)trackServices:(id<BindingsTrackServicesCallback> _Nullable)cb;
/**
* 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:
- e2eID - e2e object ID in the tracker.
- cb - A TrackServicesCallback, which will be passed the marshalled
message.ServiceList.
*/
- (BOOL)trackServicesWithIdentity:(long)e2eId cb:(id<BindingsTrackServicesCallback> _Nullable)cb error:(NSError* _Nullable* _Nullable)error;
/**
* WaitForNetwork will block until either the network is healthy or the passed
timeout is reached. It will return true if the network is healthy.
......@@ -1970,10 +1985,11 @@ Example GroupSendReport JSON:
is to being ready.
Example JSON:
{
"IsReady": true,
"HowClose": 0.534
}
{
"IsReady": true,
"HowClose": 0.534
}
*/
@interface BindingsIsReadyInfo : NSObject <goSeqRefInterface> {
}
......@@ -2037,27 +2053,28 @@ Cmix.GetNodeRegistrationStatus returns JSON marshalled.
this user.
Example NotificationReport JSON:
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
{
"ForMe": true,
"Type": "e2e",
"Source": "dGVzdGVyMTIzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
Given the Type, the Source value will have specific contextual meanings.
Below is a table that will define the contextual meaning of the Source field
given all possible Type fields.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
TYPE | SOURCE | DESCRIPTION
----------+--------------------+--------------------------------------------------------
"default" | recipient user ID | A message with no association.
"request" | sender user ID | A channel request has been received, from Source.
"reset" | sender user ID | A channel reset has been received.
"confirm" | sender user ID | A channel request has been accepted.
"silent" | sender user ID | A message where the user should not be notified.
"e2e" | sender user ID | A reception of an E2E message.
"group" | group ID | A reception of a group chat message.
"endFT" | sender user ID | The last message sent confirming end of file transfer.
"groupRQ" | sender user ID | A request from Source to join a group chat.
*/
@interface BindingsNotificationReport : NSObject <goSeqRefInterface> {
}
......@@ -2715,18 +2732,18 @@ notifications are for this user. // This returns the JSON-marshalled
NotificationReports.
Parameters:
- e2eID - e2e object ID in the tracker
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices for information about this.
- notificationCSV - the notification data received from the
notifications' server.
- marshalledServices - the JSON-marshalled list of services the backend
keeps track of. Refer to Cmix.TrackServices or
Cmix.TrackServicesWithIdentity for information about this.
Returns:
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
- []byte - A JSON marshalled NotificationReports. Some NotificationReport's
within in this structure may have their NotificationReport.ForMe
set to false. These may be ignored.
*/
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(long e2eId, NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable BindingsGetNotificationsReport(NSString* _Nullable notificationCSV, NSData* _Nullable marshalledServices, NSError* _Nullable* _Nullable error);
/**
* GetPubkeyFromContact returns the DH public key in the [contact.Contact]
......@@ -3164,7 +3181,7 @@ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsNewUdManagerFromBacku
The token is a firebase messaging token.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsRegisterForNotifications(long e2eId, NSString* _Nullable token, NSError* _Nullable* _Nullable error);
......@@ -3320,7 +3337,7 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData
* UnregisterForNotifications turns off notifications for this client.
Parameters:
- e2eId - ID of the E2E object in the E2E tracker
- e2eId - ID of the E2E object in the E2E tracker
*/
FOUNDATION_EXPORT BOOL BindingsUnregisterForNotifications(long e2eId, NSError* _Nullable* _Nullable error);
......@@ -3833,33 +3850,34 @@ If there was an error retrieving or marshalling the service list,
there is an error for the second parameter which will be non-null.
Parameters:
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
- marshalData - JSON marshalled bytes of [message.ServiceList], which is an
array of [id.ID] and [message.Service].
- err - JSON unmarshalling error
Example JSON:
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
[
{
"Id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // bytes of id.ID encoded as base64 string
"Services": [
{
"Identifier": "AQID", // bytes encoded as base64 string
"Tag": "TestTag 1", // string
"Metadata": "BAUG" // bytes encoded as base64 string
}
]
},
{
"Id": "AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD",
"Services": [
{
"Identifier": "AQID",
"Tag": "TestTag 2",
"Metadata": "BAUG"
}
]
},
]
*/
@interface BindingsTrackServicesCallback : NSObject <goSeqRefInterface, BindingsTrackServicesCallback> {
}
......
......@@ -2,35 +2,31 @@ import Bindings
import XCTestDynamicOverlay
public struct GetNotificationsReport {
public var run: (Int, String, Data) throws -> NotificationReport
public var run: (String, MessageServiceList) throws -> NotificationReport
public func callAsFunction(
e2eId: Int,
notificationCSV: String,
marshaledServices: Data
services: MessageServiceList
) throws -> NotificationReport {
try run(e2eId, notificationCSV, marshaledServices)
try run(notificationCSV, services)
}
}
extension GetNotificationsReport {
public static func live() -> GetNotificationsReport {
GetNotificationsReport { e2eId, notificationCSV, marshaledServices in
var error: NSError?
let result = BindingsGetNotificationsReport(
e2eId,
notificationCSV,
marshaledServices,
&error
)
if let error = error {
throw error
}
guard let result = result else {
fatalError("BindingsGetNotificationsReport returned nil without providing error")
}
return try NotificationReport.decode(result)
public static let live = GetNotificationsReport { notificationCSV, services in
var error: NSError?
let result = BindingsGetNotificationsReport(
notificationCSV,
try services.encode(),
&error
)
if let error = error {
throw error
}
guard let result = result else {
fatalError("BindingsGetNotificationsReport returned nil without providing error")
}
return try NotificationReport.decode(result)
}
}
......
......@@ -117,7 +117,7 @@ final class MessengerSendFileTests: XCTestCase {
}
let sendFile: MessengerSendFile = .live(env)
let transferId = try sendFile(.stub) { info in
_ = try sendFile(.stub) { info in
didReceiveCallback.append(info)
}
fileTransferProgressCallback.handle(.init(
......@@ -158,7 +158,7 @@ final class MessengerSendFileTests: XCTestCase {
}
let sendFile: MessengerSendFile = .live(env)
let transferId = try sendFile(.stub) { info in
_ = try sendFile(.stub) { info in
didReceiveCallback.append(info)
}
......