diff --git a/Frameworks/Bindings.xcframework/Info.plist b/Frameworks/Bindings.xcframework/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..5da456bbdabbf3d610daca4ce17734b523413a53 --- /dev/null +++ b/Frameworks/Bindings.xcframework/Info.plist @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>AvailableLibraries</key> + <array> + <dict> + <key>LibraryIdentifier</key> + <string>ios-arm64</string> + <key>LibraryPath</key> + <string>Bindings.framework</string> + <key>SupportedArchitectures</key> + <array> + <string>arm64</string> + </array> + <key>SupportedPlatform</key> + <string>ios</string> + </dict> + <dict> + <key>LibraryIdentifier</key> + <string>ios-arm64_x86_64-simulator</string> + <key>LibraryPath</key> + <string>Bindings.framework</string> + <key>SupportedArchitectures</key> + <array> + <string>arm64</string> + <string>x86_64</string> + </array> + <key>SupportedPlatform</key> + <string>ios</string> + <key>SupportedPlatformVariant</key> + <string>simulator</string> + </dict> + </array> + <key>CFBundlePackageType</key> + <string>XFWK</string> + <key>XCFrameworkFormatVersion</key> + <string>1.0</string> +</dict> +</plist> diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings new file mode 100644 index 0000000000000000000000000000000000000000..6a502beec597ed1474bd50e61fa0537e2588f3eb Binary files /dev/null and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaUh6OGNlcDZvQk9RTAphUzBVRitHeU5VMnlVcVRNTWtTWThoUkh1c09CMmFheXoybHZVb3RLUHBPbjZRSWRWVTJrcE4vY2dtY0lSb2x5CkhBMDRUOHJBWVNaRlVqaVlRajkzKzRFREpJYXd2Z0YyVEs1bFoyb3oxVTdreStncU82V0RMR2Z0Q0wvODVQWEIKa210aXhnUXpRV3g1RWcvemtHdm03eURBalQxeDloNytsRjJwN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VTb0p1cGJzNXA1enNNRkJ1bwpncUZrVnQ0RUZhRDJweTVwM2tQbDJsZjhlZXVwWkZScGE0WmRQdVIrMjZ4eWYrNEJhdlZJeld3NFNPL1V4Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings new file mode 100644 index 0000000000000000000000000000000000000000..6a502beec597ed1474bd50e61fa0537e2588f3eb Binary files /dev/null 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.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdksw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dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings new file mode 100644 index 0000000000000000000000000000000000000000..6a502beec597ed1474bd50e61fa0537e2588f3eb Binary files /dev/null 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.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaU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PNUdqQVBxVHlQS3NudFlNZkY4UDczZ1NES1VSWWVFbHFDejdET0c5QzRzcitPK3FoN1B3cCtqUmFoK1ZiCkNuWllNMDlBVDQ3YStJYUJmbWRkaXpLbEFvR0JBSmo1dkRDNmJIQnNISWlhNUNJL1RZaG5YWXUzMkVCYytQM0sKMHF3VThzOCtzZTNpUHBla2Y4RjVHd3RuUU4zc2tsMk1GQWFGYldmeVFZazBpUEVTb0p1cGJzNXA1enNNRkJ1bwpncUZrVnQ0RUZhRDJweTVwM2tQbDJsZjhlZXVwWkZScGE0WmRQdVIrMjZ4eWYrNEJhdlZJeld3NFNPL1V4Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> 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 new file mode 100644 index 0000000000000000000000000000000000000000..8c6be89d2d97ed4d6b76cfd45d4012c4f7b649c1 Binary files /dev/null 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.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRXhTNWY4RnR0Qmk1NmNLZmdJQlVKT3ozZi9qQllTMkxzMlJ6cWV5YXM3SApjV2RaME9TclBTT3BiYlViU1FPbS9LWnlweGZHU21yZ2oxRUZuU1dZZ2xGZTdUOTRPbHF5MG14QTV5clVXbHorCk9sK3hHbXpCNUp4WUFSMU9oMFQrQTk4RWMrTUZHNm43L1MraDdzRDgybGRnVnJmbStFTzRCdmFKeTRESGZGMWgKNnp6QnVnY25NUVFGc0dLeDFYWC9COTVMdUpPVjdyeXlDbzZGbHdJREFRQUJBb0lCQVFDaUh6OGNlcDZvQk9RTAphUzBVRitHeU5VMnlVcVRNTWtTWThoUkh1c09CMmFheXoybHZVb3RLUHBPbjZRSWRWVTJrcE4vY2dtY0lSb2x5CkhBMDRUOHJBWVNaRlVqaVlRajkzKzRFREpJYXd2Z0YyVEs1bFoyb3oxVTdreStncU82V0RMR2Z0Q0wvODVQWEIKa210aXhnUXpRV3g1RWcvemtHdm03eURBalQxeDloNytsRjJwNFlBam5kT2xTS0dmQjFZeTR1RXBQd0kwc1lWdgpKQWc0MEFxbllZUmt4emJPbmQxWGNjdEJFN2Z1VDdrWXhoeSs3WXYrUTJwVy9BYmh6NGl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Q3crCnhqbTNEczRkQW9HQWREL0VOa1BjU004c1BCM3JSWW9MQ2twcUV2U0MzbVZSbjNJd3c1WFAwcDRRVndhRmR1ckMKYUhtSE1EekNrNEUvb0haQVhFdGZ2S2tRaUI4MXVYM2c1aVo4amdYUVhXUHRteTVIcVVhcWJYUTlENkxWc3B0egpKL3R4SWJLMXp5c1o2bk9IY1VoUUwyVVF6SlBBRThZNDdjYzVzTThEN3kwZjJ0QURTQUZNMmN3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> 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 new file mode 100644 index 0000000000000000000000000000000000000000..8c6be89d2d97ed4d6b76cfd45d4012c4f7b649c1 Binary files /dev/null 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.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYj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LUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==", + // Salt for identity (base64) + "Salt":"4kk02v0NIcGtlobZ/xkxqWz8uH/ams/gjvQm14QT0dI=", + // DH Private key + "DHKeyPrivate":"eyJWYWx1ZSI6NDU2MDgzOTEzMjA0OTIyODA5Njg2MDI3MzQ0MzM3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> 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 new file mode 100644 index 0000000000000000000000000000000000000000..8c6be89d2d97ed4d6b76cfd45d4012c4f7b649c1 Binary files /dev/null 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.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.h new file mode 100644 index 0000000000000000000000000000000000000000..8906a7da239705b790cb2bb64de92f806640cb38 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// gitlab.com/elixxir/client/bindings +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Bindings_FRAMEWORK_H__ +#define __Bindings_FRAMEWORK_H__ + +#include "Bindings.objc.h" +#include "Universe.objc.h" + +#endif 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3d9fefd0c6c4c233b287f3340a56d0d229d72b9 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -0,0 +1,496 @@ +// Objective-C API for talking to gitlab.com/elixxir/client/bindings Go package. +// gobind -lang=objc gitlab.com/elixxir/client/bindings +// +// File is generated by gobind. Do not edit. + +#ifndef __Bindings_H__ +#define __Bindings_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@class BindingsAuthenticatedConnection; +@class BindingsClient; +@class BindingsConnection; +@class BindingsE2ESendReport; +@class BindingsFact; +@class BindingsIdentity; +@class BindingsListenerID; +@class BindingsMessage; +@class BindingsRestlikeMessage; +@protocol BindingsClientError; +@class BindingsClientError; +@protocol BindingsListener; +@class BindingsListener; +@protocol BindingsLogWriter; +@class BindingsLogWriter; +@protocol BindingsMessageDeliveryCallback; +@class BindingsMessageDeliveryCallback; +@protocol BindingsNetworkHealthCallback; +@class BindingsNetworkHealthCallback; + +@protocol BindingsClientError <NSObject> +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +@protocol BindingsListener <NSObject> +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@protocol BindingsLogWriter <NSObject> +- (void)log:(NSString* _Nullable)p0; +@end + +@protocol BindingsMessageDeliveryCallback <NSObject> +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +@protocol BindingsNetworkHealthCallback <NSObject> +- (void)callback:(BOOL)p0; +@end + +@interface BindingsAuthenticatedConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field AuthenticatedConnection.Connection with unsupported type: gitlab.com/elixxir/client/bindings.Connection + +- (void)close; +- (NSData* _Nullable)getPartner; +- (BOOL)isAuthenticated; +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * Client BindingsClient wraps the api.Client, implementing additional functions +to support the gomobile Client interface + */ +@interface BindingsClient : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Connect performs auth key negotiation with the given recipient, +and returns a Connection object for the newly-created partner.Manager +This function is to be used sender-side and will block until the +partner.Manager is confirmed. +recipientContact - marshalled contact.Contact object +myIdentity - marshalled Identity 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; +- (long)getID; +/** + * HasRunningProcessies checks if any background threads are running. +returns true if none are running. This is meant to be +used when NetworkFollowerStatus() returns Stopping. +Due to the handling of comms on iOS, where the OS can +block indefiently, it may not enter the stopped +state apropreatly. This can be used instead. + */ +- (BOOL)hasRunningProcessies; +/** + * IsNetworkHealthy returns true if the network is read to be in a healthy state where +messages can be sent + */ +- (BOOL)isNetworkHealthy; +/** + * MakeIdentity generates a new cryptographic identity for receving +messages + */ +- (NSData* _Nullable)makeIdentity:(NSError* _Nullable* _Nullable)error; +/** + * Gets the state of the network follower. Returns: +Stopped - 0 +Starting - 1000 +Running - 2000 +Stopping - 3000 + */ +- (long)networkFollowerStatus; +/** + * RegisterClientErrorCallback registers the callback to handle errors from the +long running threads controlled by StartNetworkFollower and StopNetworkFollower + */ +- (void)registerClientErrorCallback:(id<BindingsClientError> _Nullable)clientError; +/** + * RegisterNetworkHealthCB registers the network health callback to be called +any time the network health changes. Returns a unique ID that can be used to +unregister the network health callback. + */ +- (int64_t)registerNetworkHealthCB:(id<BindingsNetworkHealthCallback> _Nullable)nhc; +/** + * StartNetworkFollower kicks off the tracking of the network. It starts +long running network client threads and returns an object for checking +state and stopping those threads. +Call this when returning from sleep and close when going back to +sleep. +These threads may become a significant drain on battery when offline, ensure +they are stopped if there is no internet access +Threads Started: + - Network Follower (/network/follow.go) + tracks the network events and hands them off to workers for handling + - Historical Round Retrieval (/network/rounds/historical.go) + Retrieves data about rounds which are too old to be stored by the client + - Message Retrieval Worker Group (/network/rounds/retrieve.go) + Requests all messages in a given round from the gateway of the last nodes + - Message Handling Worker Group (/network/message/handle.go) + Decrypts and partitions messages when signals via the Switchboard + - health Tracker (/network/health) + Via the network instance tracks the state of the network + - Garbled Messages (/network/message/garbled.go) + Can be signaled to check all recent messages which could be be decoded + Uses a message store on disk for persistence + - Critical Messages (/network/message/critical.go) + Ensures all protocol layer mandatory messages are sent + Uses a message store on disk for persistence + - KeyExchange Trigger (/keyExchange/trigger.go) + Responds to sent rekeys and executes them + - KeyExchange Confirm (/keyExchange/confirm.go) + Responds to confirmations of successful rekey operations + */ +- (BOOL)startNetworkFollower:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +- (void)unregisterNetworkHealthCB:(int64_t)funcID; +/** + * WaitForMessageDelivery allows the caller to get notified if the rounds a +message was sent in successfully completed. Under the hood, this uses an API +which uses the internal round data, network historical round lookup, and +waiting on network events to determine what has (or will) occur. + +The callbacks will return at timeoutMS if no state update occurs + +This function takes the marshaled send report to ensure a memory leak does +not occur as a result of both sides of the bindings holding a reference to +the same pointer. + */ +- (BOOL)waitForMessageDelivery:(NSData* _Nullable)roundList mdc:(id<BindingsMessageDeliveryCallback> _Nullable)mdc timeoutMS:(long)timeoutMS error:(NSError* _Nullable* _Nullable)error; +/** + * WaitForNewtwork will block until either the network is healthy or the +passed timeout. It will return true if the network is healthy + */ +- (BOOL)waitForNetwork:(long)timeoutMS; +@end + +/** + * Connection is the bindings representation of a connect.Connection object that can be tracked + */ +@interface BindingsConnection : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +/** + * Close deletes this Connection's partner.Manager and releases resources + */ +- (void)close; +/** + * GetPartner returns the partner.Manager for this Connection + */ +- (NSData* _Nullable)getPartner; +/** + * RegisterListener is used for E2E reception +and allows for reading data sent from the partner.Manager +Returns marshalled ListenerID + */ +- (NSData* _Nullable)registerListener:(long)messageType newListener:(id<BindingsListener> _Nullable)newListener; +/** + * SendE2E is a wrapper for sending specifically to the Connection's partner.Manager +Returns marshalled E2ESendReport + */ +- (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; +@end + +/** + * E2ESendReport is the bindings representation of the return values of SendE2E + */ +@interface BindingsE2ESendReport : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSData* _Nullable messageID; +@property (nonatomic) int64_t timestamp; +- (NSData* _Nullable)marshal:(NSError* _Nullable* _Nullable)error; +@end + +/** + * TODO: this seems completely pointless, as the FactList type is effectively the same thing + */ +@interface BindingsFact : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) NSString* _Nonnull fact; +@property (nonatomic) long type; +@end + +/** + * Identity struct +Example marshalled Identity: +{"ID":"emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD", // User ID (base64) + // RSA Private key (PEM format) + "RSAPrivatePem":"LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBNU15dTdhYjBJOS9UL1BFUUxtd2x3ejZHV3FjMUNYemVIVXhoVEc4bmg1WWRWSXMxCmJ2THpBVjNOMDJxdXN6K2s4TVFEWjBtejMzdkswUmhPczZIY0NUSFdzTEpXRkE5WWpzWWlCRi9qTDd1bmd1ckIKL2tvK1JJSnNrWGFWaEZaazRGdERoRX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M3OTA0MzAyODYwMjM2NDk2NDM5NDI4NTcxMTMwNDMzOTQwMzgyMTIyMjY4OTQzNTMyMjIyMzc1MTkzNTEzMjU4MjA4MDA0NTczMDY4MjEwNzg2NDI5NjA1MjA0OTA3MjI2ODI5OTc3NTczMDkxODY0NTY3NDExMDExNjQxNCwiRmluZ2VycHJpbnQiOjE2ODAxNTQxNTExMjMzMDk4MzYzfQ==" +} + */ +@interface BindingsIdentity : 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 + +/** + * ListenerID represents the return type of RegisterListener + */ +@interface BindingsListenerID : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@end + +/** + * Message is the bindings representation of a receive.Message + */ +@interface BindingsMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +@property (nonatomic) long messageType; +@property (nonatomic) NSData* _Nullable id_; +@property (nonatomic) NSData* _Nullable payload; +@property (nonatomic) NSData* _Nullable sender; +@property (nonatomic) NSData* _Nullable recipientID; +@property (nonatomic) int64_t ephemeralID; +@property (nonatomic) int64_t timestamp; +@property (nonatomic) BOOL encrypted; +@property (nonatomic) long roundId; +@end + +/** + * RestlikeMessage is the bindings representation of a restlike.Message +Example marshalled RestlikeMessage: +{"Version":1, +"Headers":"Y29udGVudHM6YXBwbGljYXRpb24vanNvbg==", +"Content":"VGhpcyBpcyBhIHJlc3RsaWtlIG1lc3NhZ2U=", +"Method":2, +"URI":"xx://CmixRestlike/rest", +"Error":""} + */ +@interface BindingsRestlikeMessage : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (nonnull instancetype)init; +// skipped field RestlikeMessage.Version with unsupported type: uint32 + +@property (nonatomic) NSData* _Nullable headers; +@property (nonatomic) NSData* _Nullable content; +@property (nonatomic) long method; +@property (nonatomic) NSString* _Nonnull uri; +@property (nonatomic) NSString* _Nonnull error; +@end + +/** + * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. +The NDF is processed into a protobuf containing a signature which +is verified using the cert string passed in. The NDF is returned as marshaled +byte data which may be used to start a client. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsDownloadAndVerifySignedNdfWithUrl(NSString* _Nullable url, NSString* _Nullable cert, NSError* _Nullable* _Nullable error); + +/** + * EnableGrpcLogs sets GRPC trace logging + */ +FOUNDATION_EXPORT void BindingsEnableGrpcLogs(id<BindingsLogWriter> _Nullable writer); + +/** + * GenerateSecret creates a secret password using a system-based +pseudorandom number generator. It takes 1 parameter, `numBytes`, +which should be set to 32, but can be set higher in certain cases. + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGenerateSecret(long numBytes); + +/** + * GetFactsFromContact accepts a marshalled contact.Contact object, returning its marshalled list of Fact objects + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetFactsFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetIDFromContact accepts a marshalled contact.Contact object & returns a marshalled id.ID object + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetIDFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * GetPubkeyFromContact accepts a marshalled contact.Contact object & returns a json marshalled large.Int DhPubKey + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsGetPubkeyFromContact(NSData* _Nullable marshaled, NSError* _Nullable* _Nullable error); + +/** + * sets level of logging. All logs the set level and above will be displayed +options are: + TRACE - 0 + DEBUG - 1 + INFO - 2 + WARN - 3 + ERROR - 4 + CRITICAL - 5 + FATAL - 6 +The default state without updates is: INFO + */ +FOUNDATION_EXPORT BOOL BindingsLogLevel(long level, NSError* _Nullable* _Nullable error); + +/** + * Login will load an existing client from the storageDir +using the password. This will fail if the client doesn't exist or +the password is incorrect. +The password is passed as a byte array so that it can be cleared from +memory and stored as securely as possible using the memguard library. +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); + +/** + * NewClient 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); + +/** + * RegisterLogWriter registers a callback on which logs are written. + */ +FOUNDATION_EXPORT void BindingsRegisterLogWriter(id<BindingsLogWriter> _Nullable writer); + +/** + * RestlikeRequest performs a normal restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequest(long clientID, long connectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * RestlikeRequestAuth performs an authenticated restlike request +request - marshalled RestlikeMessage +Returns marshalled result RestlikeMessage + */ +FOUNDATION_EXPORT NSData* _Nullable BindingsRestlikeRequestAuth(long clientID, long authConnectionID, NSData* _Nullable request, NSError* _Nullable* _Nullable error); + +/** + * SetFactsOnContact replaces the facts on the contact with the passed in facts +pass in empty facts in order to clear the facts +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 BindingsClientError; + +@class BindingsListener; + +@class BindingsLogWriter; + +@class BindingsMessageDeliveryCallback; + +@class BindingsNetworkHealthCallback; + +@interface BindingsClientError : NSObject <goSeqRefInterface, BindingsClientError> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)report:(NSString* _Nullable)source message:(NSString* _Nullable)message trace:(NSString* _Nullable)trace; +@end + +/** + * Listener provides a callback to hear a message +An object implementing this interface can be called back when the client +gets a message of the type that the registerer specified at registration +time. + */ +@interface BindingsListener : NSObject <goSeqRefInterface, BindingsListener> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Hear is called to receive a message in the UI + */ +- (void)hear:(NSData* _Nullable)item; +/** + * Returns a name, used for debugging + */ +- (NSString* _Nonnull)name; +@end + +@interface BindingsLogWriter : NSObject <goSeqRefInterface, BindingsLogWriter> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)log:(NSString* _Nullable)p0; +@end + +/** + * MessageDeliveryCallback gets called on the determination if all events +related to a message send were successful. + */ +@interface BindingsMessageDeliveryCallback : NSObject <goSeqRefInterface, BindingsMessageDeliveryCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)eventCallback:(BOOL)delivered timedOut:(BOOL)timedOut roundResults:(NSData* _Nullable)roundResults; +@end + +/** + * A callback when which is used to receive notification if network health +changes + */ +@interface BindingsNetworkHealthCallback : NSObject <goSeqRefInterface, BindingsNetworkHealthCallback> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (void)callback:(BOOL)p0; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Universe.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Universe.objc.h new file mode 100644 index 0000000000000000000000000000000000000000..019e7502d581983722a15bf30799e85cbc5dd766 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror <NSObject> +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError <goSeqRefInterface, Universeerror> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/ref.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/ref.h new file mode 100644 index 0000000000000000000000000000000000000000..b8036a4d85c7387f3def61473a071b5d8c4c8208 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include <Foundation/Foundation.h> + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Modules/module.modulemap b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..4316a5b24058edfc18ffb2dc7f7a982e8353441a --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Bindings" { + header "ref.h" + header "Bindings.objc.h" + header "Universe.objc.h" + header "Bindings.h" + + export * +} \ No newline at end of file diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Resources/Info.plist b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Resources/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..0d1a4b8ab9b1fc8e9357197398f73353470cb636 --- /dev/null +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Resources/Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> diff --git a/Package.swift b/Package.swift index b51c88c6a188374bee80a4324ab86d09f46f65ea..058d1eb9fa9bd8a9274a3dff49763296c3c571c0 100644 --- a/Package.swift +++ b/Package.swift @@ -29,6 +29,9 @@ let package = Package( targets: [ .target( name: "ElixxirDAppsSDK", + dependencies: [ + .target(name: "Bindings"), + ], swiftSettings: swiftSettings ), .testTarget( @@ -36,5 +39,9 @@ let package = Package( dependencies: ["ElixxirDAppsSDK"], swiftSettings: swiftSettings ), + .binaryTarget( + name: "Bindings", + path: "Frameworks/Bindings.xcframework" + ), ] )