diff --git a/Frameworks/Bindings.txt b/Frameworks/Bindings.txt index 3a8cba407a495f4cd0879163424354ad892288a8..4912704fb0efb23f963a877e744986cebfe69643 100644 --- a/Frameworks/Bindings.txt +++ b/Frameworks/Bindings.txt @@ -1,4 +1,4 @@ -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 diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings index 8cdc2383f845d819e27a1ed7588b996dc86a8394..56488f086f23033b2de898f5351a0e51dc20a465 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 0870dbbbb626c1dc4c5e030f6fec29a9e363c6cb..5ef1f9b380057f5619cbfa5de176fb5a956c1ec6 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -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> { } diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings index 25b137a68d2fd1b803cb59e53c6ea09a4e4554d2..00454bc9fb6adb1c34fa4be6528205a8c880ce1a 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 0870dbbbb626c1dc4c5e030f6fec29a9e363c6cb..5ef1f9b380057f5619cbfa5de176fb5a956c1ec6 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -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> { } diff --git a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings index 69d5af972a3011bdbf304b29099ec4389fe5b765..fbea95244b8219950ba9c5424aeaf0a524c32ef4 100644 Binary files a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 0870dbbbb626c1dc4c5e030f6fec29a9e363c6cb..5ef1f9b380057f5619cbfa5de176fb5a956c1ec6 100644 --- a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -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> { } diff --git a/Sources/XXClient/Functions/GetNotificationsReport.swift b/Sources/XXClient/Functions/GetNotificationsReport.swift index 0b5d31f8d5ffb7fc0f9f4cd67d6c2b6a0ec11aa1..81d54a59e298bc8a7f5a597736ca5f494e7f07c4 100644 --- a/Sources/XXClient/Functions/GetNotificationsReport.swift +++ b/Sources/XXClient/Functions/GetNotificationsReport.swift @@ -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) } } diff --git a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerSendFileTests.swift b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerSendFileTests.swift index 2a0b74dcd3fd214c27f0cd138d88a021d5861481..b7606f23e865a35f5537f7e3a82d6959228b1c29 100644 --- a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerSendFileTests.swift +++ b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerSendFileTests.swift @@ -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) }