diff --git a/Frameworks/Bindings.xcframework/Info.plist b/Frameworks/Bindings.xcframework/Info.plist index 5da456bbdabbf3d610daca4ce17734b523413a53..3c96df61083ca794226526858401b4539235d6ba 100644 --- a/Frameworks/Bindings.xcframework/Info.plist +++ b/Frameworks/Bindings.xcframework/Info.plist @@ -6,30 +6,30 @@ <array> <dict> <key>LibraryIdentifier</key> - <string>ios-arm64</string> + <string>ios-arm64_x86_64-simulator</string> <key>LibraryPath</key> <string>Bindings.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> + <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>ios</string> + <key>SupportedPlatformVariant</key> + <string>simulator</string> </dict> <dict> <key>LibraryIdentifier</key> - <string>ios-arm64_x86_64-simulator</string> + <string>ios-arm64</string> <key>LibraryPath</key> <string>Bindings.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> - <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>ios</string> - <key>SupportedPlatformVariant</key> - <string>simulator</string> </dict> </array> <key>CFBundlePackageType</key> diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings index 551a016dc73fb80d2f4599f71f9741105273633e..7267786097f1d59d877cf3d9be1a9fca83a91afb 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h index a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; 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 551a016dc73fb80d2f4599f71f9741105273633e..7267786097f1d59d877cf3d9be1a9fca83a91afb 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 a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 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 @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings index 551a016dc73fb80d2f4599f71f9741105273633e..7267786097f1d59d877cf3d9be1a9fca83a91afb 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h index a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings index 7463bb58b196e6187b4aee07f15acd218a1e7c6c..c3a97c15db2fd9ff9c08df5a2df1e9d276e783b7 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h index a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; 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 7463bb58b196e6187b4aee07f15acd218a1e7c6c..c3a97c15db2fd9ff9c08df5a2df1e9d276e783b7 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 a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 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 @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings index 7463bb58b196e6187b4aee07f15acd218a1e7c6c..c3a97c15db2fd9ff9c08df5a2df1e9d276e783b7 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h index a56558d0ae166ee09f92bcb66c592ff5fae5c131..f625ef9e8b761631a702b1b07fc6dc56c78b229c 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -404,6 +404,11 @@ Parameters: * GetID returns the ID for this Cmix in the cmixTracker. */ - (long)getID; +/** + * GetReceptionRegistrationValidationSignature returns the signature provided by +the xx network. + */ +- (NSData* _Nullable)getReceptionRegistrationValidationSignature; /** * HasRunningProcessies checks if any background threads are running and returns true if one or more are. @@ -724,6 +729,17 @@ The first payload is index 0. * PayloadSize returns the max payload size for a partitionable E2E message. */ - (long)payloadSize; +/** + * RegisterListener registers a new listener. + +Parameters: + - senderId - the user ID who sends messages to this user that + this function will register a listener for. + - messageType - message type from the sender you want to listen for. + - newListener: A provider for a callback to hear a message. + Do not pass nil to this. + */ +- (BOOL)registerListener:(NSData* _Nullable)senderID messageType:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener error:(NSError* _Nullable* _Nullable)error; /** * RemoveService removes all services for the given tag. */ @@ -1329,6 +1345,15 @@ object. - (BOOL)unsetAlternativeUserDiscovery:(NSError* _Nullable* _Nullable)error; @end +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedCode; +/** + * Error codes + */ +FOUNDATION_EXPORT NSString* _Nonnull const BindingsUnrecognizedMessage; + /** * AsyncRequestRestLike sends an asynchronous restlike request to a given contact. @@ -1345,6 +1370,23 @@ of JSON marshalling the response when received. */ FOUNDATION_EXPORT BOOL BindingsAsyncRequestRestLike(long e2eID, NSData* _Nullable recipient, NSData* _Nullable request, NSData* _Nullable paramsJSON, id<BindingsRestlikeCallback> _Nullable cb, NSError* _Nullable* _Nullable error); +/** + * 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 which 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 + - errStr - an error returned from the backend. + +Returns + - A user-friendly error message. This should be devoid of technical speak + but still be meaningful for front-end or back-end teams. + */ +FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -1488,6 +1530,10 @@ FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLoadCmix(NSString* _Nullable s Parameters: - e2eID - e2e object ID in the tracker - follower - network follower func wrapped in UdNetworkStatus + - username - the username the user wants to register with UD. + If the user is already registered, this field may be blank + - registrationValidationSignature - the signature provided by the xx network. + This signature is optional for other consumers who deploy their own UD. */ FOUNDATION_EXPORT BindingsUserDiscovery* _Nullable BindingsLoadOrNewUserDiscovery(long e2eID, id<BindingsUdNetworkStatus> _Nullable follower, NSString* _Nullable username, NSData* _Nullable registrationValidationSignature, NSError* _Nullable* _Nullable error); @@ -1711,6 +1757,21 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsTransmitSingleUse(long e2eID, NSData* _Nullable recipient, NSString* _Nullable tag, NSData* _Nullable payload, NSData* _Nullable paramsJSON, id<BindingsSingleUseResponse> _Nullable responseCB, NSError* _Nullable* _Nullable error); +/** + * UpdateCommonErrors updates the internal error mapping DB. This internal database +maps errors returned from the backend to user-friendly error messages. + +Parameters + - jsonFile - contents of a JSON file whose format conforms to the example below. +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", + } + */ +FOUNDATION_EXPORT BOOL BindingsUpdateCommonErrors(NSString* _Nullable jsonFile, NSError* _Nullable* _Nullable error); + @class BindingsAuthCallbacks; @class BindingsBroadcastListener; diff --git a/Sources/ElixxirDAppsSDK/Cmix/Cmix.swift b/Sources/ElixxirDAppsSDK/Cmix/Cmix.swift index a8d867715a687b9d1c7c62700549461fb6b610be..3964f33b488554a58dfdf07478bbad8cc5d0eba5 100644 --- a/Sources/ElixxirDAppsSDK/Cmix/Cmix.swift +++ b/Sources/ElixxirDAppsSDK/Cmix/Cmix.swift @@ -2,6 +2,7 @@ import Bindings public struct Cmix { public var getId: CmixGetId + public var getReceptionRegistrationValidationSignature: CmixGetReceptionRegistrationValidationSignature public var makeReceptionIdentity: CmixMakeReceptionIdentity public var makeLegacyReceptionIdentity: CmixMakeLegacyReceptionIdentity public var isHealthy: CmixIsHealthy @@ -20,6 +21,7 @@ extension Cmix { public static func live(_ bindingsCmix: BindingsCmix) -> Cmix { Cmix( getId: .live(bindingsCmix), + getReceptionRegistrationValidationSignature: .live(bindingsCmix), makeReceptionIdentity: .live(bindingsCmix), makeLegacyReceptionIdentity: .live(bindingsCmix), isHealthy: .live(bindingsCmix), @@ -39,6 +41,7 @@ extension Cmix { extension Cmix { public static let unimplemented = Cmix( getId: .unimplemented, + getReceptionRegistrationValidationSignature: .unimplemented, makeReceptionIdentity: .unimplemented, makeLegacyReceptionIdentity: .unimplemented, isHealthy: .unimplemented, diff --git a/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixGetReceptionRegistrationValidationSignature.swift b/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixGetReceptionRegistrationValidationSignature.swift new file mode 100644 index 0000000000000000000000000000000000000000..06303e2b03ac9acdbaf88decf9530c51a5f86051 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixGetReceptionRegistrationValidationSignature.swift @@ -0,0 +1,27 @@ +import Bindings +import XCTestDynamicOverlay + +public struct CmixGetReceptionRegistrationValidationSignature { + public var run: () -> Data + + public func callAsFunction() -> Data { + run() + } +} + +extension CmixGetReceptionRegistrationValidationSignature { + public static func live(_ bindingsCmix: BindingsCmix) -> CmixGetReceptionRegistrationValidationSignature { + CmixGetReceptionRegistrationValidationSignature { + guard let data = bindingsCmix.getReceptionRegistrationValidationSignature() else { + fatalError("BindingsCmix.getReceptionRegistrationValidationSignature returned `nil`") + } + return data + } + } +} + +extension CmixGetReceptionRegistrationValidationSignature { + public static let unimplemented = CmixGetReceptionRegistrationValidationSignature( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/E2E/E2E.swift b/Sources/ElixxirDAppsSDK/E2E/E2E.swift index e127fdace0d45e8dd1ccf2a61046b37f0af4bd9b..710de98e414642b0638105e5520be63303ba3a36 100644 --- a/Sources/ElixxirDAppsSDK/E2E/E2E.swift +++ b/Sources/ElixxirDAppsSDK/E2E/E2E.swift @@ -22,6 +22,7 @@ public struct E2E { public var confirmReceivedRequest: E2EConfirmReceivedRequest public var replayConfirmReceivedRequest: E2EReplayConfirmReceivedRequest public var send: E2ESend + public var registerListener: E2ERegisterListener } extension E2E { @@ -47,7 +48,8 @@ extension E2E { verifyOwnership: .live(bindingsE2E), confirmReceivedRequest: .live(bindingsE2E), replayConfirmReceivedRequest: .live(bindingsE2E), - send: .live(bindingsE2E) + send: .live(bindingsE2E), + registerListener: .live(bindingsE2E) ) } } @@ -74,6 +76,7 @@ extension E2E { verifyOwnership: .unimplemented, confirmReceivedRequest: .unimplemented, replayConfirmReceivedRequest: .unimplemented, - send: .unimplemented + send: .unimplemented, + registerListener: .unimplemented ) } diff --git a/Sources/ElixxirDAppsSDK/E2E/Functors/E2ERegisterListener.swift b/Sources/ElixxirDAppsSDK/E2E/Functors/E2ERegisterListener.swift new file mode 100644 index 0000000000000000000000000000000000000000..5163c559939214177f175d89449c055dd376a4a0 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/E2E/Functors/E2ERegisterListener.swift @@ -0,0 +1,32 @@ +import Bindings +import XCTestDynamicOverlay + +public struct E2ERegisterListener { + public var run: (Data, Int, Listener) throws -> Void + + public func callAsFunction( + senderId: Data, + messageType: Int, + callback: Listener + ) throws { + try run(senderId, messageType, callback) + } +} + +extension E2ERegisterListener { + public static func live(_ bindingsE2E: BindingsE2e) -> E2ERegisterListener { + E2ERegisterListener { senderId, messageType, callback in + try bindingsE2E.registerListener( + senderId, + messageType: messageType, + newListener: callback.makeBindingsListener() + ) + } + } +} + +extension E2ERegisterListener { + public static let unimplemented = E2ERegisterListener( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/Functors/CreateUserFriendlyErrorMessage.swift b/Sources/ElixxirDAppsSDK/Functors/CreateUserFriendlyErrorMessage.swift new file mode 100644 index 0000000000000000000000000000000000000000..290529f3ee35dcbaf6d372f8f7dab8cad615d6eb --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/CreateUserFriendlyErrorMessage.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct CreateUserFriendlyErrorMessage { + public var run: (String) -> String + + public func callAsFunction(_ errorString: String) -> String { + run(errorString) + } +} + +extension CreateUserFriendlyErrorMessage { + public static let live = CreateUserFriendlyErrorMessage { errorString in + BindingsCreateUserFriendlyErrorMessage(errorString) + } +} + +extension CreateUserFriendlyErrorMessage { + public static let unimplemented = CreateUserFriendlyErrorMessage( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/Functors/LoadOrNewUserDiscovery.swift b/Sources/ElixxirDAppsSDK/Functors/LoadOrNewUserDiscovery.swift index f1817eb0a066a6c73daa6b076834cc062c5a9262..95a7371a0321974e1282fb99acb3137bc3fa4139 100644 --- a/Sources/ElixxirDAppsSDK/Functors/LoadOrNewUserDiscovery.swift +++ b/Sources/ElixxirDAppsSDK/Functors/LoadOrNewUserDiscovery.swift @@ -2,13 +2,13 @@ import Bindings import XCTestDynamicOverlay public struct LoadOrNewUserDiscovery { - public var run: (Int, UdNetworkStatus, String, Data) throws -> UserDiscovery + public var run: (Int, UdNetworkStatus, String?, Data?) throws -> UserDiscovery public func callAsFunction( e2eId: Int, follower: UdNetworkStatus, - username: String, - registrationValidationSignature: Data + username: String?, + registrationValidationSignature: Data? ) throws -> UserDiscovery { try run(e2eId, follower, username, registrationValidationSignature) } diff --git a/Sources/ElixxirDAppsSDK/Functors/UpdateCommonErrors.swift b/Sources/ElixxirDAppsSDK/Functors/UpdateCommonErrors.swift new file mode 100644 index 0000000000000000000000000000000000000000..32d195f66f05c8ffc6e77ca868c588573da00cdb --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/UpdateCommonErrors.swift @@ -0,0 +1,32 @@ +import Bindings +import XCTestDynamicOverlay + +public struct UpdateCommonErrors { + public var run: (String) throws -> Void + + public func callAsFunction(jsonFile: String) throws { + try run(jsonFile) + } +} + +extension UpdateCommonErrors { + public static let live = UpdateCommonErrors { jsonFile in + var error: NSError? + let result = BindingsUpdateCommonErrors( + jsonFile, + &error + ) + if let error = error { + throw error + } + guard result else { + fatalError("BindingsUpdateCommonErrors returned `false` without providing error") + } + } +} + +extension UpdateCommonErrors { + public static let unimplemented = UpdateCommonErrors( + run: XCTUnimplemented("\(Self.self)") + ) +}