diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings index 9613b0e5c18dd2250df2dd0367f10764cec12927..5e98165734e7459fa58db4fc4c12194fc68bd6bd 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAA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I4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", - // Salt for identity (base64) - "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", - // DH Private key - "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BF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gUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif 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 9613b0e5c18dd2250df2dd0367f10764cec12927..5e98165734e7459fa58db4fc4c12194fc68bd6bd 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) - // RSA Private key (PEM format) - "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZ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xMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4R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2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif 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 9613b0e5c18dd2250df2dd0367f10764cec12927..5e98165734e7459fa58db4fc4c12194fc68bd6bd 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) - // RSA Private key (PEM format) - "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaUh6OGNlcDZvQk9RTAphUzBVRitHeU5VMnlVcVRNTWtTWThoUkh1c09CMmFheXoybHZVb3R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3cCtqUmFoK1ZiCkNuWllNMDlBVDQ3YStJYUJmbWRkaXpLbEFvR0JBSmo1dkRDNmJIQnNISWlhNUNJL1RZaG5YWXUzMkVCYytQM0sKMHF3VThzOCtzZTNpUHBla2Y4RjVHd3RuUU4zc2tsMk1GQWFGYldmeVFZazBpUEVTb0p1cGJzNXA1enNNRkJ1bwpncUZrVnQ0RUZhRDJweTVwM2tQbDJsZjhlZXVwWkZScGE0WmRQdVIrMjZ4eWYrNEJhdlZJeld3NFNPL1V4Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", - // Salt for identity (base64) - "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", - // DH Private key - "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaUh6OGNlcDZvQk9RTAphUzBVRitHeU5VMnlVcVRNTWtTWThoUkh1c09CMmFheXoybHZVb3RLUHBPbjZRSWRWVTJrcE4vY2dtY0lSb2x5CkhBMDRUOHJBWVNaRlVqaVlRajkzKzRFREpJYXd2Z0YyVEs1bFoyb3oxVTdreStncU82V0RMR2Z0Q0wvODVQWEIKa210aXhnUXpRV3g1RWcvemt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sMk1GQWFGYldmeVFZazBpUEVTb0p1cGJzNXA1enNNRkJ1bwpncUZrVnQ0RUZhRDJweTVwM2tQbDJsZjhlZXVwWkZScGE0WmRQdVIrMjZ4eWYrNEJhdlZJeld3NFNPL1V4Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif 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 e10e9ee786df8cefcea1b2ea1007c9fdb864f674..146965a8b7ce44426ff1522b757705707d755540 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) - // RSA Private key (PEM format) - "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaUh6OGNlcDZvQk9RTAphUzBVRitHeU5VMnlVcVRNTWtTWThoUkh1c09CMmFheXoybHZVb3RLUHBPbjZRSWRWVTJrcE4vY2dtY0lSb2x5CkhBMDRUOHJBWVNaRlVqaVlRajkzKzRFREpJYXd2Z0YyVEs1bFoyb3oxVTdreStncU82V0RMR2Z0Q0wvODVQWEIKa210aXhnUXpRV3g1RWcvemtHdm03eURBalQxeDloNytsRjJwNFlBam5kT2xTS0dmQjFZeTR1RXBQd0kwc1lWdgpKQWc0MEFxbllZUmt4emJPbmQxWGNjdEJFN2Z1VDdrWXhoeSs3WXYrUTJwVy9BYmh6NGlHOEY1MW9GMGZwV0czCmlISDhsVXZFTkp2SUZEVHZ0UEp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MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", - // Salt for identity (base64) - "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", - // DH Private key - "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0t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p5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif 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 e10e9ee786df8cefcea1b2ea1007c9fdb864f674..146965a8b7ce44426ff1522b757705707d755540 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) - // RSA Private key (PEM format) - "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMx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4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", - // DH Private key - "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQ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5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif 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 e10e9ee786df8cefcea1b2ea1007c9fdb864f674..146965a8b7ce44426ff1522b757705707d755540 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 c5600d7bc966b7b9759d72cc659ae937c5482dc5..4e88771249b34b440abf4a8b282fcfc75ff1c7f9 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 @@ -12,14 +12,18 @@ @class BindingsAuthenticatedConnection; -@class BindingsClient; +@class BindingsCmix; @class BindingsConnection; @class BindingsE2ESendReport; +@class BindingsE2e; @class BindingsFact; -@class BindingsIdentity; +@class BindingsIdList; @class BindingsMessage; +@class BindingsReceptionIdentity; @class BindingsRestlikeMessage; @class BindingsRoundsList; +@protocol BindingsAuthCallbacks; +@class BindingsAuthCallbacks; @protocol BindingsClientError; @class BindingsClientError; @protocol BindingsListener; @@ -30,6 +34,14 @@ @class BindingsMessageDeliveryCallback; @protocol BindingsNetworkHealthCallback; @class BindingsNetworkHealthCallback; +@protocol BindingsProcessor; +@class BindingsProcessor; + +@protocol BindingsAuthCallbacks <NSObject> +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end @protocol BindingsClientError <NSObject> - (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; @@ -59,6 +71,11 @@ Accepts a marshalled Message object - (void)callback:(BOOL)p0; @end +@protocol BindingsProcessor <NSObject> +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + @interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -76,10 +93,10 @@ Accepts a marshalled Message object @end /** - * Client BindingsClient wraps the api.Client, implementing additional functions -to support the gomobile Client interface + * Cmix BindingsClient wraps the xxdk.Cmix, implementing additional functions +to support the gomobile Cmix interface */ -@interface BindingsClient : NSObject <goSeqRefInterface> { +@interface BindingsCmix : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; @@ -91,14 +108,10 @@ and returns a Connection object for the newly-created partner.Manager This function is to be used sender-side and will block until the partner.Manager is confirmed. recipientContact - marshalled contact.Contact object -myIdentity - marshalled Identity object +myIdentity - marshalled ReceptionIdentity object */ -- (BindingsConnection* _Nullable)connect:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(NSData* _Nullable)recipientContact myIdentity:(NSData* _Nullable)myIdentity error:(NSError* _Nullable* _Nullable)error; -/** - * GetContactFromIdentity accepts a marshalled Identity object and returns a marshalled contact.Contact object - */ -- (NSData* _Nullable)getContactFromIdentity:(NSData* _Nullable)identity error:(NSError* _Nullable* _Nullable)error; +- (BindingsConnection* _Nullable)connect:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; +- (BindingsAuthenticatedConnection* _Nullable)connectWithAuthentication:(long)e2eId recipientContact:(NSData* _Nullable)recipientContact error:(NSError* _Nullable* _Nullable)error; - (long)getID; /** * HasRunningProcessies checks if any background threads are running. @@ -251,6 +264,238 @@ Example E2ESendReport: - (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; @end +/** + * E2e BindingsClient wraps the xxdk.E2e, implementing additional functions +to support the gomobile E2e interface + */ +@interface BindingsE2e : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * AddPartnerCallback adds a new callback that overrides the generic auth +callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)addPartnerCallback:(NSData* _Nullable)partnerID cb:(id<BindingsAuthCallbacks> _Nullable)cb error:(NSError* _Nullable* _Nullable)error; +/** + * AddService adds a service for all partners of the given +tag, which will call back on the given processor. These can +be sent to using the tag fields in the Params Object +Passing nil for the processor allows you to create a +service which is never called but will be visible by +notifications. Processes added this way are generally not +end-to-end encrypted messages themselves, but other +protocols which piggyback on e2e relationships to start +communication + */ +- (BOOL)addService:(NSString* _Nullable)tag processor:(id<BindingsProcessor> _Nullable)processor error:(NSError* _Nullable* _Nullable)error; +/** + * CallAllReceivedRequests will iterate through all pending contact requests and +replay them on the callbacks. + */ +- (void)callAllReceivedRequests; +/** + * Confirm sends a confirmation for a received request. It can only be called +once. This both sends keying material to the other party and creates a +channel in the e2e handler, after which e2e messages can be sent to the +partner using e2e.Handler.SendE2E. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A confirm cannot be sent for a contact who has not sent a request or who is +already a partner. This can only be called once for a specific contact. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +If the confirm must be resent, use ReplayConfirm. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)confirm:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteAllRequests clears all requests from client's auth storage. + */ +- (BOOL)deleteAllRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeletePartnerCallback deletes the callback that overrides the generic +auth callback for the given partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deletePartnerCallback:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteReceiveRequests clears all received requests from client's auth storage. + */ +- (BOOL)deleteReceiveRequests:(NSError* _Nullable* _Nullable)error; +/** + * DeleteRequest deletes sent or received requests for a specific partner ID. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. + */ +- (BOOL)deleteRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * DeleteSentRequests clears all sent requests from client's auth storage. + */ +- (BOOL)deleteSentRequests:(NSError* _Nullable* _Nullable)error; +/** + * FirstPartitionSize returns the max partition payload size for the +first payload + */ +- (long)firstPartitionSize; +/** + * GetAllPartnerIDs returns a marshalled list of all partner IDs that the user has +an E2E relationship with. +Returns: + - []byte - the marshalled bytes of the IdList object. + */ +- (NSData* _Nullable)getAllPartnerIDs:(NSError* _Nullable* _Nullable)error; +/** + * GetContact returns a marshalled contact.Contact object for the E2e ReceptionIdentity + */ +- (NSData* _Nullable)getContact; +/** + * GetHistoricalDHPrivkey returns the user's marshalled Historical DH Private Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPrivkey:(NSError* _Nullable* _Nullable)error; +/** + * GetHistoricalDHPubkey returns the user's marshalled Historical DH +Public Key +Returns: + - []byte - the marshalled bytes of the cyclic.Int object. + */ +- (NSData* _Nullable)getHistoricalDHPubkey:(NSError* _Nullable* _Nullable)error; +/** + * GetID returns the e2eTracker ID for the E2e object + */ +- (long)getID; +/** + * GetReceivedRequest returns a contact if there's a received request for it. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - []byte - the marshalled bytes of the contact.Contact object. + */ +- (NSData* _Nullable)getReceivedRequest:(NSData* _Nullable)partnerID error:(NSError* _Nullable* _Nullable)error; +/** + * GetReceptionID returns the marshalled default IDs +Returns: + - []byte - the marshalled bytes of the id.ID object. + */ +- (NSData* _Nullable)getReceptionID; +/** + * HasAuthenticatedChannel returns true if an authenticated channel with the +partner exists, otherwise returns false +Parameters: + - partnerId - the marshalled bytes of the id.ID object. + */ +- (BOOL)hasAuthenticatedChannel:(NSData* _Nullable)partnerId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * PartitionSize returns the partition payload size for the given +payload index. The first payload is index 0. + */ +- (long)partitionSize:(long)payloadIndex; +/** + * PayloadSize Returns the max payload size for a partitionable E2E +message + */ +- (long)payloadSize; +/** + * RemoveService removes all services for the given tag + */ +- (BOOL)removeService:(NSString* _Nullable)tag error:(NSError* _Nullable* _Nullable)error; +/** + * ReplayConfirm resends a confirm to the partner. It will fail to send if the +send relationship with the partner has already ratcheted. +The confirm sends as a critical message; if the round it sends on fails, it +will be auto resend by the cMix client. +This will not be useful if either side has ratcheted. + +Parameters: + - partnerID - the marshalled bytes of the id.ID object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)replayConfirm:(NSData* _Nullable)partnerID ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Request sends a contact request from the user identity in the imported e2e +structure to the passed contact, as well as the passed facts (will error if +they are too long). +The other party must accept the request by calling Confirm in order to be +able to send messages using e2e.Handler.SendE2E. When the other party does +so, the "confirm" callback will get called. +The round the request is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. +The request sends as a critical message, if the round send on fails, it will +be auto resent by the cMix client. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. + - myFacts - stringified list of fact.FactList. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)request:(NSData* _Nullable)partnerContact myFactsString:(NSString* _Nullable)myFactsString ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * Reset sends a contact reset request from the user identity in the imported +e2e structure to the passed contact, as well as the passed facts (it will +error if they are too long). +This deletes all traces of the relationship with the partner from e2e and +create a new relationship from scratch. +The round the reset is initially sent on will be returned, but the request +will be listed as a critical message, so the underlying cMix client will auto +resend it in the event of failure. +A request cannot be sent for a contact who has already received a request or +who is already a partner. + +Parameters: + - partnerContact - the marshalled bytes of the contact.Contact object. +Returns: + - int64 - ID of the round (convert to uint64) + */ +- (BOOL)reset:(NSData* _Nullable)partnerContact ret0_:(int64_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +/** + * SecondPartitionSize returns the max partition payload size for all +payloads after the first payload + */ +- (long)secondPartitionSize; +/** + * SendE2E send a message containing the payload to the +recipient of the passed message type, per the given +parameters - encrypted with end-to-end encryption. +Default parameters can be retrieved through +Parameters: + - recipientId - the marshalled bytes of the id.ID object. + - e2eParams - the marshalled bytes of the e2e.Params object. +Returns: + - []byte - the marshalled bytes of the E2ESendReport object. + */ +- (NSData* _Nullable)sendE2E:(long)messageType recipientId:(NSData* _Nullable)recipientId payload:(NSData* _Nullable)payload e2eParams:(NSData* _Nullable)e2eParams error:(NSError* _Nullable* _Nullable)error; +/** + * VerifyOwnership checks if the received ownership proof is valid. + +Parameters: + - receivedContact, verifiedContact - the marshalled bytes of the + contact.Contact object. + - e2eId - ID of the e2e handler + */ +- (BOOL)verifyOwnership:(NSData* _Nullable)receivedContact verifiedContact:(NSData* _Nullable)verifiedContact e2eId:(long)e2eId ret0_:(BOOL* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error; +@end + /** * Fact is an internal fact type for use in the bindings layer example marshalled Fact: @@ -267,27 +512,16 @@ example marshalled Fact: @end /** - * Identity struct -Example marshalled Identity: -{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) - // RSA Private key (PEM format) - "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHor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NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" -} + * IdList is a wrapper for a list of marshalled id.ID objects */ -@interface BindingsIdentity : NSObject <goSeqRefInterface> { +@interface BindingsIdList : NSObject <goSeqRefInterface> { } @property(strong, readonly) _Nonnull id _ref; - (nonnull instancetype)initWithRef:(_Nonnull id)ref; - (nonnull instancetype)init; -@property (nonatomic) NSData* _Nullable id_; -@property (nonatomic) NSData* _Nullable rsaPrivatePem; -@property (nonatomic) NSData* _Nullable salt; -@property (nonatomic) NSData* _Nullable dhKeyPrivate; +// skipped field IdList.Ids with unsupported type: [][]byte + @end /** @@ -319,6 +553,30 @@ Example Message format: @property (nonatomic) long roundId; @end +/** + * ReceptionIdentity struct +Example marshalled ReceptionIdentity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQ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2g5QmRkegoyWkRPNUdqQVBxVHlQS3NudFlNZkY4UDczZ1NES1VSWWVFbHFDejdET0c5QzRzcitPK3FoN1B3cCtqUmFoK1ZiCkNuWllNMDlBVDQ3YStJYUJmbWRkaXpLbEFvR0JBSmo1dkRDNmJIQnNISWlhNUNJL1RZaG5YWXUzMkVCYytQM0sKMHF3VThzOCtzZTNpUHBla2Y4RjVHd3RuUU4zc2tsMk1GQWFGYldmeVFZazBpUEVTb0p1cGJzNXA1enNNRkJ1bwpncUZrVnQ0RUZhRDJweTVwM2tQbDJsZjhlZXVwWkZScGE0WmRQdVIrMjZ4eWYrNEJhdlZJeld3NFNPL1V4Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsReceptionIdentity : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable rsaPrivatePem; +@property (nonatomic) NSData* _Nullable salt; +@property (nonatomic) NSData* _Nullable dhKeyPrivate; +@end + /** * RestlikeMessage is the bindings representation of a restlike.Message Example marshalled RestlikeMessage: @@ -433,17 +691,40 @@ Login does not block on network connection, and instead loads and starts subprocesses to perform network operations. TODO: add in custom parameters instead of the default */ -FOUNDATION_EXPORT BindingsClient* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BindingsCmix* _Nullable BindingsLogin(NSString* _Nullable storageDir, NSData* _Nullable password, NSError* _Nullable* _Nullable error); + +/** + * LoginE2e creates and returns a new E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2e(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); + +/** + * LoginE2eEphemeral creates and returns a new ephemeral E2e object and adds it to the e2eTrackerSingleton +identity should be created via MakeIdentity() and passed in here +If callbacks is left nil, a default auth.Callbacks will be used + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eEphemeral(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSData* _Nullable identity, NSError* _Nullable* _Nullable error); /** - * NewClient creates client storage, generates keys, connects, and registers + * LoginE2eLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV +Uses the pre-generated transmission ID used by xxdk.Cmix +If callbacks is left nil, a default auth.Callbacks will be used +This function is designed to maintain backwards compatibility with previous xx messenger designs +and should not be used for other purposes + */ +FOUNDATION_EXPORT BindingsE2e* _Nullable BindingsLoginE2eLegacy(long cmixId, id<BindingsAuthCallbacks> _Nullable callbacks, NSError* _Nullable* _Nullable error); + +/** + * NewKeystore creates client storage, generates keys, connects, and registers with the network. Note that this does not register a username/identity, but merely creates a new cryptographic identity for adding such information at a later date. Users of this function should delete the storage directory on error. */ -FOUNDATION_EXPORT BOOL BindingsNewClient(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); +FOUNDATION_EXPORT BOOL BindingsNewKeystore(NSString* _Nullable network, NSString* _Nullable storageDir, NSData* _Nullable password, NSString* _Nullable regCode, NSError* _Nullable* _Nullable error); /** * RegisterLogWriter registers a callback on which logs are written. @@ -471,6 +752,8 @@ Accepts a marshalled contact.Contact object & a marshalled list of Fact objects */ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable marshaled, NSData* _Nullable facts, NSError* _Nullable* _Nullable error); +@class BindingsAuthCallbacks; + @class BindingsClientError; @class BindingsListener; @@ -481,6 +764,21 @@ FOUNDATION_EXPORT NSData* _Nullable BindingsSetFactsOnContact(NSData* _Nullable @class BindingsNetworkHealthCallback; +@class BindingsProcessor; + +/** + * AuthCallbacks is the bindings-specific interface for auth.Callbacks methods. + */ +@interface BindingsAuthCallbacks : NSObject <goSeqRefInterface, BindingsAuthCallbacks> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)confirm:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)request:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (void)reset:(NSData* _Nullable)contact receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +@end + @interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { } @property(strong, readonly) _Nonnull id _ref; @@ -546,4 +844,16 @@ changes - (void)callback:(BOOL)p0; @end +/** + * Processor is the bindings-specific interface for message.Processor methods. + */ +@interface BindingsProcessor : NSObject <goSeqRefInterface, BindingsProcessor> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)process:(NSData* _Nullable)message receptionId:(NSData* _Nullable)receptionId ephemeralId:(int64_t)ephemeralId roundId:(int64_t)roundId; +- (NSString* _Nonnull)string; +@end + #endif diff --git a/Sources/ElixxirDAppsSDK/Client.swift b/Sources/ElixxirDAppsSDK/Client.swift index 621270e4d1896e956f2cee89798ba2bc9e21f576..650e6dc0c806e4abef292e405509cb02522dafef 100644 --- a/Sources/ElixxirDAppsSDK/Client.swift +++ b/Sources/ElixxirDAppsSDK/Client.swift @@ -9,14 +9,12 @@ public struct Client { public var monitorNetworkHealth: NetworkHealthListener public var listenErrors: ClientErrorListener public var makeIdentity: IdentityMaker - public var makeContactFromIdentity: ContactFromIdentityProvider public var connect: ConnectionMaker - public var getContactFromIdentity: ContactFromIdentityProvider public var waitForDelivery: MessageDeliveryWaiter } extension Client { - public static func live(bindingsClient: BindingsClient) -> Client { + public static func live(bindingsClient: BindingsCmix) -> Client { Client( getId: .live(bindingsClient: bindingsClient), hasRunningProcesses: .live(bindingsClient: bindingsClient), @@ -26,9 +24,7 @@ extension Client { monitorNetworkHealth: .live(bindingsClient: bindingsClient), listenErrors: .live(bindingsClient: bindingsClient), makeIdentity: .live(bindingsClient: bindingsClient), - makeContactFromIdentity: .live(bindingsClient: bindingsClient), connect: .live(bindingsClient: bindingsClient), - getContactFromIdentity: .live(bindingsClient: bindingsClient), waitForDelivery: .live(bindingsClient: bindingsClient) ) } @@ -45,9 +41,7 @@ extension Client { monitorNetworkHealth: .failing, listenErrors: .failing, makeIdentity: .failing, - makeContactFromIdentity: .failing, connect: .failing, - getContactFromIdentity: .failing, waitForDelivery: .failing ) } diff --git a/Sources/ElixxirDAppsSDK/ClientCreator.swift b/Sources/ElixxirDAppsSDK/ClientCreator.swift index 5049fbcec655896226e11f8f2751c94181910d75..6021adc126b597b92de7068d8d5fd447cec36313 100644 --- a/Sources/ElixxirDAppsSDK/ClientCreator.swift +++ b/Sources/ElixxirDAppsSDK/ClientCreator.swift @@ -17,7 +17,7 @@ extension ClientCreator { public static let live = ClientCreator { directoryURL, ndf, password, regCode in var error: NSError? let network = String(data: ndf, encoding: .utf8)! - let created = BindingsNewClient(network, directoryURL.path, password, regCode, &error) + let created = BindingsNewKeystore(network, directoryURL.path, password, regCode, &error) if let error = error { throw error } diff --git a/Sources/ElixxirDAppsSDK/ClientE2E.swift b/Sources/ElixxirDAppsSDK/ClientE2E.swift new file mode 100644 index 0000000000000000000000000000000000000000..b16c68a6f39f8d6bebab0c1003a50d582e1d0ba7 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/ClientE2E.swift @@ -0,0 +1,24 @@ +import Bindings + +public struct ClientE2E { + public var getId: ClientE2EIdProvider + public var getContactFromIdentity: ContactFromIdentityProvider +} + +extension ClientE2E { + public static func live(bindingsClientE2E: BindingsE2e) -> ClientE2E { + ClientE2E( + getId: .live(bindingsClientE2E: bindingsClientE2E), + getContactFromIdentity: .live(bindingsClientE2E: bindingsClientE2E) + ) + } +} + +#if DEBUG +extension ClientE2E { + public static let failing = ClientE2E( + getId: .failing, + getContactFromIdentity: .failing + ) +} +#endif diff --git a/Sources/ElixxirDAppsSDK/ClientE2EIdProvider.swift b/Sources/ElixxirDAppsSDK/ClientE2EIdProvider.swift new file mode 100644 index 0000000000000000000000000000000000000000..4eadb5966c558281beb2e625422e79c9cd348600 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/ClientE2EIdProvider.swift @@ -0,0 +1,23 @@ +import Bindings + +public struct ClientE2EIdProvider { + public var get: () -> Int + + public func callAsFunction() -> Int { + get() + } +} + +extension ClientE2EIdProvider { + public static func live(bindingsClientE2E: BindingsE2e) -> ClientE2EIdProvider { + ClientE2EIdProvider(get: bindingsClientE2E.getID) + } +} + +#if DEBUG +extension ClientE2EIdProvider { + public static let failing = ClientE2EIdProvider { + fatalError("Not implemented") + } +} +#endif diff --git a/Sources/ElixxirDAppsSDK/ClientE2ELogin.swift b/Sources/ElixxirDAppsSDK/ClientE2ELogin.swift new file mode 100644 index 0000000000000000000000000000000000000000..6af64a4e46f19ae1b6d7f5c13348a99d1cf1672f --- /dev/null +++ b/Sources/ElixxirDAppsSDK/ClientE2ELogin.swift @@ -0,0 +1,36 @@ +import Bindings + +public struct ClientE2ELogin { + public var login: (Client) throws -> ClientE2E + + public func callAsFunction(with client: Client) throws -> ClientE2E { + try login(client) + } +} + +extension ClientE2ELogin { + public static let live = ClientE2ELogin { client in + var error: NSError? + let cMixId = client.getId() + let myIdentity = try client.makeIdentity() + let encoder = JSONEncoder() + let myIdentityData = try encoder.encode(myIdentity) + let bindingsClientE2E = BindingsLoginE2e(cMixId, nil, myIdentityData, &error) + if let error = error { + throw error + } + guard let bindingsClientE2E = bindingsClientE2E else { + fatalError("BindingsLoginE2E returned `nil` without providing error") + } + return ClientE2E.live(bindingsClientE2E: bindingsClientE2E) + } +} + +#if DEBUG +extension ClientE2ELogin { + public static let failing = ClientE2ELogin { _ in + struct NotImplemented: Error {} + throw NotImplemented() + } +} +#endif diff --git a/Sources/ElixxirDAppsSDK/ClientErrorListener.swift b/Sources/ElixxirDAppsSDK/ClientErrorListener.swift index 5e7b0446caf0c9d3becf7e885295a91e3eb6d0eb..7babe34e57c1ad2e9ae0ff33a760f55fda419dc9 100644 --- a/Sources/ElixxirDAppsSDK/ClientErrorListener.swift +++ b/Sources/ElixxirDAppsSDK/ClientErrorListener.swift @@ -9,10 +9,10 @@ public struct ClientErrorListener { } extension ClientErrorListener { - public static func live(bindingsClient: BindingsClient) -> ClientErrorListener { + public static func live(bindingsClient: BindingsCmix) -> ClientErrorListener { ClientErrorListener { callback in let listener = Listener(onReport: callback) - bindingsClient.registerErrorCallback(listener) + bindingsClient.registerClientErrorCallback(listener) } } } diff --git a/Sources/ElixxirDAppsSDK/ClientIdProvider.swift b/Sources/ElixxirDAppsSDK/ClientIdProvider.swift index 259a64b2510afcae200c7e49e8613bc3858fc7ca..acdfadbae87b69cb9c0f1ee1f6cd5601edfb8ec5 100644 --- a/Sources/ElixxirDAppsSDK/ClientIdProvider.swift +++ b/Sources/ElixxirDAppsSDK/ClientIdProvider.swift @@ -9,7 +9,7 @@ public struct ClientIdProvider { } extension ClientIdProvider { - public static func live(bindingsClient: BindingsClient) -> ClientIdProvider { + public static func live(bindingsClient: BindingsCmix) -> ClientIdProvider { ClientIdProvider(get: bindingsClient.getID) } } diff --git a/Sources/ElixxirDAppsSDK/ClientProcessStatusProvider.swift b/Sources/ElixxirDAppsSDK/ClientProcessStatusProvider.swift index 297f00afde36933b6fb929e7fbde25ce0d67d7da..4da5756277a848f8ca5131fed039ef1ff4ef7abe 100644 --- a/Sources/ElixxirDAppsSDK/ClientProcessStatusProvider.swift +++ b/Sources/ElixxirDAppsSDK/ClientProcessStatusProvider.swift @@ -9,7 +9,7 @@ public struct ClientProcessStatusProvider { } extension ClientProcessStatusProvider { - public static func live(bindingsClient: BindingsClient) -> ClientProcessStatusProvider { + public static func live(bindingsClient: BindingsCmix) -> ClientProcessStatusProvider { ClientProcessStatusProvider(get: bindingsClient.hasRunningProcessies) } } diff --git a/Sources/ElixxirDAppsSDK/ConnectionMaker.swift b/Sources/ElixxirDAppsSDK/ConnectionMaker.swift index 34d7c14b0eaa9f41b5bb959f2fa760e42b271b88..aa3b4d6222166480f64437e5774afcf89cdb57f2 100644 --- a/Sources/ElixxirDAppsSDK/ConnectionMaker.swift +++ b/Sources/ElixxirDAppsSDK/ConnectionMaker.swift @@ -1,34 +1,32 @@ import Bindings public struct ConnectionMaker { - public var connect: (Bool, Data, Identity) throws -> Connection + public var connect: (Bool, Data, Int) throws -> Connection public func callAsFunction( withAuthentication: Bool, recipientContact: Data, - myIdentity: Identity + e2eId: Int ) throws -> Connection { - try connect(withAuthentication, recipientContact, myIdentity) + try connect(withAuthentication, recipientContact, e2eId) } } extension ConnectionMaker { - public static func live(bindingsClient: BindingsClient) -> ConnectionMaker { - ConnectionMaker { withAuthentication, recipientContact, myIdentity in - let encoder = JSONEncoder() - let myIdentityData = try encoder.encode(myIdentity) + public static func live(bindingsClient: BindingsCmix) -> ConnectionMaker { + ConnectionMaker { withAuthentication, recipientContact, e2eId in if withAuthentication { return Connection.live( bindingsAuthenticatedConnection: try bindingsClient.connect( - withAuthentication: recipientContact, - myIdentity: myIdentityData + withAuthentication: e2eId, + recipientContact: recipientContact ) ) } else { return Connection.live( bindingsConnection: try bindingsClient.connect( - recipientContact, - myIdentity: myIdentityData + e2eId, + recipientContact: recipientContact ) ) } diff --git a/Sources/ElixxirDAppsSDK/ContactFromIdentityProvider.swift b/Sources/ElixxirDAppsSDK/ContactFromIdentityProvider.swift index 292f217d8c28f556f6599e4a4bf4fbde6248081c..e38a7c0172494308176e4056a3774613f5216b4e 100644 --- a/Sources/ElixxirDAppsSDK/ContactFromIdentityProvider.swift +++ b/Sources/ElixxirDAppsSDK/ContactFromIdentityProvider.swift @@ -1,19 +1,20 @@ import Bindings public struct ContactFromIdentityProvider { - public var get: (Identity) throws -> Data + public var get: () throws -> Data - public func callAsFunction(identity: Identity) throws -> Data { - try get(identity) + public func callAsFunction() throws -> Data { + try get() } } extension ContactFromIdentityProvider { - public static func live(bindingsClient: BindingsClient) -> ContactFromIdentityProvider { - ContactFromIdentityProvider { identity in - let encoder = JSONEncoder() - let identityData = try encoder.encode(identity) - let contactData = try bindingsClient.getContactFromIdentity(identityData) + public static func live(bindingsClientE2E: BindingsE2e) -> ContactFromIdentityProvider { + ContactFromIdentityProvider { + let contactData = bindingsClientE2E.getContact() + guard let contactData = contactData else { + fatalError("BindingsGetContact returned `nil` without providing error") + } return contactData } } @@ -21,7 +22,7 @@ extension ContactFromIdentityProvider { #if DEBUG extension ContactFromIdentityProvider { - public static let failing = ContactFromIdentityProvider { _ in + public static let failing = ContactFromIdentityProvider { struct NotImplemented: Error {} throw NotImplemented() } diff --git a/Sources/ElixxirDAppsSDK/IdentityMaker.swift b/Sources/ElixxirDAppsSDK/IdentityMaker.swift index 863e180e8343e87808984d4dee709e9c92fea766..6e214d6c20878656a2d798a3fb6b1d956b018b11 100644 --- a/Sources/ElixxirDAppsSDK/IdentityMaker.swift +++ b/Sources/ElixxirDAppsSDK/IdentityMaker.swift @@ -9,7 +9,7 @@ public struct IdentityMaker { } extension IdentityMaker { - public static func live(bindingsClient: BindingsClient) -> IdentityMaker { + public static func live(bindingsClient: BindingsCmix) -> IdentityMaker { IdentityMaker { let data = try bindingsClient.makeIdentity() let decoder = JSONDecoder() diff --git a/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift b/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift index e5e254c07cbf3b8993403dd1e451b6a8fdd69f3f..fa6620f26f1240fc7da934ae72637b0d266ad90f 100644 --- a/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift +++ b/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift @@ -18,7 +18,7 @@ public struct MessageDeliveryWaiter { } extension MessageDeliveryWaiter { - public static func live(bindingsClient: BindingsClient) -> MessageDeliveryWaiter { + public static func live(bindingsClient: BindingsCmix) -> MessageDeliveryWaiter { MessageDeliveryWaiter { report, timeoutMS, callback in let encoder = JSONEncoder() let reportData = try encoder.encode(report) diff --git a/Sources/ElixxirDAppsSDK/NetworkFollower.swift b/Sources/ElixxirDAppsSDK/NetworkFollower.swift index 40e8b530f6bbbd0fe7fcb278036f40de6637d57f..d4afa8c71ff37ed2b9cd26d7a90c4b68fa5b374b 100644 --- a/Sources/ElixxirDAppsSDK/NetworkFollower.swift +++ b/Sources/ElixxirDAppsSDK/NetworkFollower.swift @@ -7,7 +7,7 @@ public struct NetworkFollower { } extension NetworkFollower { - public static func live(bindingsClient: BindingsClient) -> NetworkFollower { + public static func live(bindingsClient: BindingsCmix) -> NetworkFollower { NetworkFollower( status: .live(bindingsClient: bindingsClient), start: .live(bindingsClient: bindingsClient), diff --git a/Sources/ElixxirDAppsSDK/NetworkFollowerStarter.swift b/Sources/ElixxirDAppsSDK/NetworkFollowerStarter.swift index 54b8c23747467874109ba52931e727a9cdd75c71..3bc7a46080c9e43c630e25dd0052f787c50e9cc2 100644 --- a/Sources/ElixxirDAppsSDK/NetworkFollowerStarter.swift +++ b/Sources/ElixxirDAppsSDK/NetworkFollowerStarter.swift @@ -9,7 +9,7 @@ public struct NetworkFollowerStarter { } extension NetworkFollowerStarter { - public static func live(bindingsClient: BindingsClient) -> NetworkFollowerStarter { + public static func live(bindingsClient: BindingsCmix) -> NetworkFollowerStarter { NetworkFollowerStarter { timeoutMS in try bindingsClient.startNetworkFollower(timeoutMS) } diff --git a/Sources/ElixxirDAppsSDK/NetworkFollowerStatusProvider.swift b/Sources/ElixxirDAppsSDK/NetworkFollowerStatusProvider.swift index b1049df732e2a2c209a0925df5cbbb14e9ec5158..04ca4d2a55195aa031c8f5aff95763f288fb4912 100644 --- a/Sources/ElixxirDAppsSDK/NetworkFollowerStatusProvider.swift +++ b/Sources/ElixxirDAppsSDK/NetworkFollowerStatusProvider.swift @@ -9,7 +9,7 @@ public struct NetworkFollowerStatusProvider { } extension NetworkFollowerStatusProvider { - public static func live(bindingsClient: BindingsClient) -> NetworkFollowerStatusProvider { + public static func live(bindingsClient: BindingsCmix) -> NetworkFollowerStatusProvider { NetworkFollowerStatusProvider { let rawValue = bindingsClient.networkFollowerStatus() return NetworkFollowerStatus(rawValue: rawValue) diff --git a/Sources/ElixxirDAppsSDK/NetworkFollowerStopper.swift b/Sources/ElixxirDAppsSDK/NetworkFollowerStopper.swift index dfe95111e09f49ce1f2b77f8baaa044f9671fb82..1b8ed6ab582430d231fdf01900941aba00e0d42d 100644 --- a/Sources/ElixxirDAppsSDK/NetworkFollowerStopper.swift +++ b/Sources/ElixxirDAppsSDK/NetworkFollowerStopper.swift @@ -9,7 +9,7 @@ public struct NetworkFollowerStopper { } extension NetworkFollowerStopper { - public static func live(bindingsClient: BindingsClient) -> NetworkFollowerStopper { + public static func live(bindingsClient: BindingsCmix) -> NetworkFollowerStopper { NetworkFollowerStopper(stop: bindingsClient.stopNetworkFollower) } } diff --git a/Sources/ElixxirDAppsSDK/NetworkHealthListener.swift b/Sources/ElixxirDAppsSDK/NetworkHealthListener.swift index 69419b2e403e0230d92356cfffd370432d4057ed..50628c4ae46a3c4614bf1cc257c920d2cd0ad2b8 100644 --- a/Sources/ElixxirDAppsSDK/NetworkHealthListener.swift +++ b/Sources/ElixxirDAppsSDK/NetworkHealthListener.swift @@ -9,7 +9,7 @@ public struct NetworkHealthListener { } extension NetworkHealthListener { - public static func live(bindingsClient: BindingsClient) -> NetworkHealthListener { + public static func live(bindingsClient: BindingsCmix) -> NetworkHealthListener { NetworkHealthListener { callback in let listener = Listener(onCallback: callback) let id = bindingsClient.registerNetworkHealthCB(listener) diff --git a/Sources/ElixxirDAppsSDK/NetworkHealthProvider.swift b/Sources/ElixxirDAppsSDK/NetworkHealthProvider.swift index aba7ef8fb0239af8f07b908799a8877cca92666d..65d8944da93045d390b76c4431e68554daa65625 100644 --- a/Sources/ElixxirDAppsSDK/NetworkHealthProvider.swift +++ b/Sources/ElixxirDAppsSDK/NetworkHealthProvider.swift @@ -9,7 +9,7 @@ public struct NetworkHealthProvider { } extension NetworkHealthProvider { - public static func live(bindingsClient: BindingsClient) -> NetworkHealthProvider { + public static func live(bindingsClient: BindingsCmix) -> NetworkHealthProvider { NetworkHealthProvider(get: bindingsClient.isNetworkHealthy) } } diff --git a/Sources/ElixxirDAppsSDK/NetworkWaiter.swift b/Sources/ElixxirDAppsSDK/NetworkWaiter.swift index c895104daa70bc1176a11041ca06ff6fe2bf4092..4782ab90c62cc6fd06c8d42d9b2842c1f790611d 100644 --- a/Sources/ElixxirDAppsSDK/NetworkWaiter.swift +++ b/Sources/ElixxirDAppsSDK/NetworkWaiter.swift @@ -9,7 +9,7 @@ public struct NetworkWaiter { } extension NetworkWaiter { - public static func live(bindingsClient: BindingsClient) -> NetworkWaiter { + public static func live(bindingsClient: BindingsCmix) -> NetworkWaiter { NetworkWaiter { timeoutMS in bindingsClient.wait(forNetwork: timeoutMS) }