diff --git a/aries_vcx/Cargo.toml b/aries_vcx/Cargo.toml index 42fb584fd1..571606d0bc 100644 --- a/aries_vcx/Cargo.toml +++ b/aries_vcx/Cargo.toml @@ -18,7 +18,6 @@ general_test = ["test_utils", "messages/general_test" ] fatal_warnings = [] warnlog_fetched_messages = [] mysql_test = ["test_utils" ] -ios-wrapper = ["libvdrtools/ffi_api"] modular_dependencies = ["test_utils", "tokio/rt", "tokio/macros"] [dependencies] diff --git a/libvcx/Cargo.toml b/libvcx/Cargo.toml index 98ea24f27b..7320508ada 100644 --- a/libvcx/Cargo.toml +++ b/libvcx/Cargo.toml @@ -17,7 +17,6 @@ test_utils = [ "aries-vcx/test_utils" ] pool_tests = [ "test_utils" ] general_test = [ "test_utils" ] fatal_warnings = [] -ios-wrapper = ["aries-vcx/ios-wrapper"] libvcx_c = [] [dependencies] diff --git a/wrappers/ios/ci/build.sh b/wrappers/ios/ci/build.sh index 1507497e36..f30d19bb15 100755 --- a/wrappers/ios/ci/build.sh +++ b/wrappers/ios/ci/build.sh @@ -156,7 +156,7 @@ build_libvcx() { export OPENSSL_LIB_DIR=$WORK_DIR/libs/openssl/${ARCH} echo "Building vcx. OPENSSL_LIB_DIR=${OPENSSL_LIB_DIR}" - cargo build --target "${TRIPLET}" --release --features ios-wrapper + cargo build --target "${TRIPLET}" --release done popd } diff --git a/wrappers/ios/vcx/VcxAPI.m b/wrappers/ios/vcx/VcxAPI.m index 18a59b8744..910b6db13a 100644 --- a/wrappers/ios/vcx/VcxAPI.m +++ b/wrappers/ios/vcx/VcxAPI.m @@ -13,9 +13,6 @@ #import "VcxCallbacks.h" #import "VcxWrapperCallbacks.h" #import "libvcx.h" -#import "IndySdk.h" -#import "utils/IndyCallbacks.h" -#import "utils/IndySdk.h" #import "utils/VcxLogger.h" void checkErrorAndComplete(vcx_error_t ret, vcx_command_handle_t cmdHandle, void (^completion)()) { diff --git a/wrappers/ios/vcx/include/indy_crypto.h b/wrappers/ios/vcx/include/indy_crypto.h deleted file mode 100644 index efeaedf520..0000000000 --- a/wrappers/ios/vcx/include/indy_crypto.h +++ /dev/null @@ -1,446 +0,0 @@ -#ifndef __indy__crypto__included__ -#define __indy__crypto__included__ - -#ifdef __cplusplus -extern "C" { -#endif - - - - /// Creates keys pair and stores in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// key_json: Key information as json. Example: - /// { - /// "seed": string, (optional) Seed that allows deterministic key creation (if not set random one will be created). - /// Can be UTF-8, base64 or hex string. - /// "crypto_type": string, // Optional (if not set then ed25519 curve is used); Currently only 'ed25519' value is supported for this field. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: command handle to map callback to caller context. - /// - err: Error code. - /// - verkey: Ver key of generated key pair, also used as key identifier - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_create_key(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const key_json, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err, - const char *const vk) - ); - - /// Saves/replaces the meta information for the giving key in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// verkey - the key (verkey, key id) to store metadata. - /// metadata - the meta information that will be store with the key. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: command handle to map callback to caller context. - /// - err: Error code. - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_set_key_metadata(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const verkey, - const char *const metadata, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err) - ); - - /// Retrieves the meta information for the giving key in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// verkey - The key (verkey, key id) to retrieve metadata. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: Command handle to map callback to caller context. - /// - err: Error code. - /// - metadata - The meta information stored with the key; Can be null if no metadata was saved for this key. - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_get_key_metadata(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const verkey, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err, - const char *const metadata) - ); - - - - - /// Signs a message with a key. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// signer_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// message_raw: a pointer to first byte of message to be signed - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// a signature string - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_sign(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * signer_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* signature_raw, - indy_u32_t signature_len) - ); - - /// Verify a signature with a verkey. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// signer_vk: verkey of signer of the message - /// message_raw: a pointer to first byte of message that has been signed - /// message_len: a message length - /// signature_raw: a pointer to first byte of signature to be verified - /// signature_len: a signature length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// valid: true - if signature is valid, false - otherwise - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_crypto_verify(indy_handle_t command_handle, - const char * signer_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - const indy_u8_t * signature_raw, - indy_u32_t signature_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - indy_bool_t valid ) - ); - - /// Encrypt a message by authenticated-encryption scheme. - /// - /// Sender can encrypt a confidential message specifically for Recipient, using Sender's public key. - /// Using Recipient's public key, Sender can compute a shared secret key. - /// Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key. - /// That shared secret key can be used to verify that the encrypted message was not tampered with, - /// before eventually decrypting it. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// sender_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// recipient_vk: id (verkey) of their key - /// message_raw: a pointer to first byte of message that to be encrypted - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// an encrypted message as a pointer to array of bytes. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* -/// Crypto* - extern indy_error_t indy_crypto_auth_crypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * sender_vk, - const char * recipient_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len) - ); - - /// Decrypt a message by authenticated-encryption scheme. - /// - /// Sender can encrypt a confidential message specifically for Recipient, using Sender's public key. - /// Using Recipient's public key, Sender can compute a shared secret key. - /// Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key. - /// That shared secret key can be used to verify that the encrypted message was not tampered with, - /// before eventually decrypting it. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// recipient_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// encrypted_msg_raw: a pointer to first byte of message that to be decrypted - /// encrypted_msg_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// sender verkey and decrypted message as a pointer to array of bytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_auth_decrypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * recipient_vk, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char * sender_vk, - const indy_u8_t* decrypted_msg_raw, - indy_u32_t decrypted_msg_len) - ); - - - /// Encrypts a message by anonymous-encryption scheme. - /// - /// Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - /// Only the Recipient can decrypt these messages, using its private key. - /// While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// recipient_vk: verkey of message recipient - /// message_raw: a pointer to first byte of message that to be encrypted - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// an encrypted message as a pointer to array of vytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_crypto_anon_crypt(indy_handle_t command_handle, - const char * recipient_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len) - ); - - /// Decrypts a message by anonymous-encryption scheme. - /// - /// Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - /// Only the Recipient can decrypt these messages, using its private key. - /// While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// recipient_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// encrypted_msg_raw: a pointer to first byte of message that to be decrypted - /// encrypted_msg_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// decrypted message as a pointer to an array of bytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_anon_decrypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * recipient_vk, - const indy_u8_t* encrypted_msg, - indy_u32_t encrypted_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* decrypted_msg_raw, - indy_u32_t decrypted_msg_len) - ); - - - /// Packs a message by encrypting the message and serializes it in a JWE-like format (Experimental) - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// message: a pointer to the first byte of the message to be packed - /// message_len: the length of the message - /// receivers: a string in the format of a json list which will contain the list of receiver's keys - /// the message is being encrypted for. - /// Example: - /// "[, ]" - /// sender: the sender's verkey as a string When null pointer is used in this parameter, anoncrypt is used - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// a JWE using authcrypt alg is defined below: - /// { - /// "protected": "b64URLencoded({ - /// "enc": "xchachapoly1305_ietf", - /// "typ": "JWM/1.0", - /// "alg": "Authcrypt", - /// "recipients": [ - /// { - /// "encrypted_key": base64URLencode(libsodium.crypto_box(my_key, their_vk, cek, cek_iv)) - /// "header": { - /// "kid": "base58encode(recipient_verkey)", - /// "sender" : base64URLencode(libsodium.crypto_box_seal(their_vk, base58encode(sender_vk)), - /// "iv" : base64URLencode(cek_iv) - /// } - /// }, - /// ], - /// })", - /// "iv": , - /// "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek), - /// "tag": - /// } - /// - /// Alternative example in using anoncrypt alg is defined below: - /// { - /// "protected": "b64URLencoded({ - /// "enc": "xchachapoly1305_ietf", - /// "typ": "JWM/1.0", - /// "alg": "Anoncrypt", - /// "recipients": [ - /// { - /// "encrypted_key": base64URLencode(libsodium.crypto_box_seal(their_vk, cek)), - /// "header": { - /// "kid": base58encode(recipient_verkey), - /// } - /// }, - /// ], - /// })", - /// "iv": b64URLencode(iv), - /// "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek), - /// "tag": b64URLencode(tag) - /// } - /// - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_pack_message(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const indy_u8_t* message, - indy_u32_t message_len, - const char * receiver_keys, - const char * sender, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* jwe_msg_raw, - indy_u32_t jwe_msg_len) - ); - - - /// Unpacks a JWE-like formatted message outputted by indy_pack_message (Experimental) - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// jwe_data: a pointer to the first byte of the JWE to be unpacked - /// jwe_len: the length of the JWE message in bytes - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// if authcrypt was used to pack the message returns this json structure: - /// { - /// message: , - /// sender_verkey: - /// recipient_verkey: - /// } - /// - /// OR - /// - /// if anoncrypt was used to pack the message returns this json structure: - /// { - /// message: , - /// recipient_verkey: - /// } - /// - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_unpack_message(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const indy_u8_t* jwe_msg, - indy_u32_t jwe_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* res_json_raw, - indy_u32_t res_json_len) - ); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wrappers/ios/vcx/include/indy_ledger.h b/wrappers/ios/vcx/include/indy_ledger.h deleted file mode 100644 index 9fdf3c7491..0000000000 --- a/wrappers/ios/vcx/include/indy_ledger.h +++ /dev/null @@ -1,1203 +0,0 @@ -#ifndef __indy__ledger_included__ -#define __indy__ledger_included__ - -#include "indy_mod.h" -#include "indy_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - /// Signs and submits request message to validator pool. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign), and sends signed request message - /// to validator pool (see write_request). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_sign_and_submit_request(indy_handle_t command_handle, - indy_handle_t pool_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Publishes request message to validator pool (no signing, unlike sign_and_submit_request). - /// - /// The request is sent to the validator pool as is. It's assumed that it's already prepared. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Ledger* - - extern indy_error_t indy_submit_request(indy_handle_t command_handle, - indy_handle_t pool_handle, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Send action to particular nodes of validator pool. - /// - /// The list of requests can be send: - /// POOL_RESTART - /// GET_VALIDATOR_INFO - /// - /// The request is sent to the nodes as is. It's assumed that it's already prepared. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// request_json: Request data json. - /// nodes: (Optional) List of node names to send the request. - /// ["Node1", "Node2",...."NodeN"] - /// timeout: (Optional) Time to wait respond from nodes (override the default timeout) (in sec). - /// Pass -1 to use default timeout - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Ledger* - - extern indy_error_t indy_submit_action(indy_handle_t command_handle, - indy_handle_t pool_handle, - const char * request_json, - const char * nodes, - indy_i32_t timeout, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Signs request message. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Signed request json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_sign_request(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* signed_request_json) - ); - - - /// Multi signs request message. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Signed request json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_multi_sign_request(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* signed_request_json) - ); - - /// Builds a request to get a DDO. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Id of Identity stored in secured Wallet. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_ddo_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Builds a NYM request. Request to create a new NYM record for a specific user. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// verkey: Target identity verification key as base58-encoded string. - /// alias: NYM's alias. - /// role: Role of a user NYM record: - /// null (common USER) - /// TRUSTEE - /// STEWARD - /// TRUST_ANCHOR - /// ENDORSER - equal to TRUST_ANCHOR that will be removed soon - /// empty string to reset role - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_nym_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * verkey, - const char * alias, - const char * role, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds an ATTRIB request. Request to add attribute to a NYM record. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// hash: (Optional) Hash of attribute data. - /// raw: (Optional) Json, where key is attribute name and value is attribute value. - /// enc: (Optional) Encrypted value attribute data. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_attrib_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * hash, - const char * raw, - const char * enc, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_ATTRIB request. Request to get information about an Attribute for the specified DID. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// raw: (Optional) Requested attribute name. - /// hash: (Optional) Requested attribute hash. - /// enc: (Optional) Requested attribute encrypted value. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_attrib_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * hash, - const char * raw, - const char * enc, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_NYM request. Request to get information about a DID (NYM). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did:(Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_nym_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a SCHEMA request. Request to add Credential's schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: Credential schema. - /// { - /// id: identifier of schema - /// attrNames: array of attribute name strings (the number of attributes should be less or equal than 125) - /// name: Schema's name string - /// version: Schema's version string, - /// ver: Version of the Schema json - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_schema_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_SCHEMA request. Request to get Credential's Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: Schema ID in ledger - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_schema_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_SCHEMA response to get Schema in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_schema_response: response of GET_SCHEMA request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Schema Id and Schema json. - /// { - /// id: identifier of schema - /// attrNames: array of attribute name strings - /// name: Schema's name string - /// version: Schema's version string - /// ver: Version of the Schema json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_schema_response(indy_handle_t command_handle, - const char * get_schema_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* schema_id, - const char* schema_json) - ); - - /// Builds an CRED_DEF request. Request to add a Credential Definition (in particular, public key), - /// that Issuer creates for a particular Credential Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: credential definition json - /// { - /// id: string - identifier of credential definition - /// schemaId: string - identifier of stored in ledger schema - /// type: string - type of the credential definition. CL is the only supported type now. - /// tag: string - allows to distinct between credential definitions for the same issuer and schema - /// value: Dictionary with Credential Definition's data: { - /// primary: primary credential public key, - /// Optional: revocation credential public key - /// }, - /// ver: Version of the CredDef json - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_cred_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_CRED_DEF request. Request to get a Credential Definition (in particular, public key), - /// that Issuer creates for a particular Credential Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: Credential Definition ID in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_cred_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_CRED_DEF response to get Credential Definition in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_cred_def_response: response of GET_CRED_DEF request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Credential Definition Id and Credential Definition json. - /// { - /// id: string - identifier of credential definition - /// schemaId: string - identifier of stored in ledger schema - /// type: string - type of the credential definition. CL is the only supported type now. - /// tag: string - allows to distinct between credential definitions for the same issuer and schema - /// value: Dictionary with Credential Definition's data: { - /// primary: primary credential public key, - /// Optional: revocation credential public key - /// }, - /// ver: Version of the Credential Definition json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_cred_def_response(indy_handle_t command_handle, - const char * get_cred_def_response, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* cred_def_id, - const char* cred_def_json) - ); - - /// Builds a NODE request. Request to add a new node to the pool, or updates existing in the pool. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// target_did: Target Node's DID. It differs from submitter_did field. - /// data: Data associated with the Node: { - /// alias: string - Node's alias - /// blskey: string - (Optional) BLS multi-signature key as base58-encoded string. - /// blskey_pop: string - (Optional) BLS key proof of possession as base58-encoded string. - /// client_ip: string - (Optional) Node's client listener IP address. - /// client_port: string - (Optional) Node's client listener port. - /// node_ip: string - (Optional) The IP address other Nodes use to communicate with this Node. - /// node_port: string - (Optional) The port other Nodes use to communicate with this Node. - /// services: array - (Optional) The service of the Node. VALIDATOR is the only supported one now. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_node_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_VALIDATOR_INFO request. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: Id of Identity stored in secured Wallet. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_validator_info_request(indy_handle_t command_handle, - const char * submitter_did, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - - /// Builds a GET_TXN request. Request to get any transaction by its seq_no. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// ledger_type: (Optional) type of the ledger the requested transaction belongs to: - /// DOMAIN - used default, - /// POOL, - /// CONFIG - /// any number - /// seq_no: seq_no of transaction in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_txn_request(indy_handle_t command_handle, - const char * submitter_did, - const char * ledger_type, - indy_i32_t seq_no, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_CONFIG request. Request to change Pool's configuration. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// writes: Whether any write requests can be processed by the pool - /// (if false, then pool goes to read-only state). True by default. - /// force: Whether we should apply transaction (for example, move pool to read-only state) - /// without waiting for consensus of this transaction. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_config_request(indy_handle_t command_handle, - const char * submitter_did, - indy_bool_t writes, - indy_bool_t force, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_RESTART request. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: Id of Identity stored in secured Wallet. - /// action: Either start or cancel - /// datetime: - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_restart_request(indy_handle_t command_handle, - const char * submitter_did, - const char * action, - const char * datetime, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_UPGRADE request. Request to upgrade the Pool (sent by Trustee). - /// It upgrades the specified Nodes (either all nodes in the Pool, or some specific ones). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// name: Human-readable name for the upgrade. - /// version: The version of indy-node package we perform upgrade to. - /// Must be greater than existing one (or equal if reinstall flag is True). - /// action: Either start or cancel. - /// sha256: sha256 hash of the package. - /// timeout: (Optional) Limits upgrade time on each Node. - /// schedule: (Optional) Schedule of when to perform upgrade on each node. Map Node DIDs to upgrade time. - /// justification: (Optional) justification string for this particular Upgrade. - /// reinstall: Whether it's allowed to re-install the same version. False by default. - /// force: Whether we should apply transaction (schedule Upgrade) without waiting - /// for consensus of this transaction. - /// package: (Optional) Package to be upgraded. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_upgrade_request(indy_handle_t command_handle, - const char * submitter_did, - const char * name, - const char * version, - const char * action, - const char * sha256, - indy_i32_t timeout, - const char * schedule, - const char * justification, - indy_bool_t reinstall, - indy_bool_t force, - const char * package_, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a REVOC_REG_DEF request. Request to add the definition of revocation registry - /// to an exists credential definition. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: Revocation Registry data: - /// { - /// "id": string - ID of the Revocation Registry, - /// "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now), - /// "tag": string - Unique descriptive ID of the Registry, - /// "credDefId": string - ID of the corresponding CredentialDefinition, - /// "value": Registry-specific data { - /// "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND), - /// "maxCredNum": number - Maximum number of credentials the Registry can serve. - /// "tailsHash": string - Hash of tails. - /// "tailsLocation": string - Location of tails file. - /// "publicKeys": - Registry's public key. - /// }, - /// "ver": string - version of revocation registry definition json. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_revoc_reg_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_REVOC_REG_DEF request. Request to get a revocation registry definition, - /// that Issuer creates for a particular Credential Definition. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: ID of Revocation Registry Definition in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG_DEF response to get Revocation Registry Definition in the format - /// compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_def_response: response of GET_REVOC_REG_DEF request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id and Revocation Registry Definition json. - /// { - /// "id": string - ID of the Revocation Registry, - /// "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now), - /// "tag": string - Unique descriptive ID of the Registry, - /// "credDefId": string - ID of the corresponding CredentialDefinition, - /// "value": Registry-specific data { - /// "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND), - /// "maxCredNum": number - Maximum number of credentials the Registry can serve. - /// "tailsHash": string - Hash of tails. - /// "tailsLocation": string - Location of tails file. - /// "publicKeys": - Registry's public key. - /// }, - /// "ver": string - version of revocation registry definition json. - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_def_response(indy_handle_t command_handle, - const char * get_revoc_ref_def_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_def_json) - ); - - /// Builds a REVOC_REG_ENTRY request. Request to add the RevocReg entry containing - /// the new accumulator value and issued/revoked indices. - /// This is just a delta of indices, not the whole list. - /// So, it can be sent each time a new credential is issued/revoked. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// revoc_reg_def_id: ID of the corresponding RevocRegDef. - /// rev_def_type: Revocation Registry type (only CL_ACCUM is supported for now). - /// value: Registry-specific data: { - /// value: { - /// prevAccum: string - previous accumulator value. - /// accum: string - current accumulator value. - /// issued: array - an array of issued indices. - /// revoked: array an array of revoked indices. - /// }, - /// ver: string - version revocation registry entry json - /// - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_revoc_reg_entry_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - const char * rev_def_type, - const char * value, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_REVOC_REG request. Request to get the accumulated state of the Revocation Registry - /// by ID. The state is defined by the given timestamp. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// revoc_reg_def_id: ID of the corresponding Revocation Registry Definition in ledger. - /// timestamp: Requested time represented as a total number of seconds from Unix Epoch - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - long long timestamp, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG response to get Revocation Registry in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_response: response of GET_REVOC_REG request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id, Revocation Registry json and Timestamp. - /// { - /// "value": Registry-specific data { - /// "accum": string - current accumulator value - /// }, - /// "ver": string - version revocation registry json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_response(indy_handle_t command_handle, - const char * get_revoc_reg_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_json, - unsigned long long timestamp) - ); - - /// Builds a GET_REVOC_REG_DELTA request. Request to get the delta of the accumulated state of the Revocation Registry. - /// The Delta is defined by from and to timestamp fields. - /// If from is not specified, then the whole state till to will be returned. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// revoc_reg_def_id: ID of the corresponding Revocation Registry Definition in ledger. - /// from: Requested time represented as a total number of seconds from Unix Epoch - /// to: Requested time represented as a total number of seconds from Unix Epoch - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_delta_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - long long from, - long long to, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG_DELTA response to get Revocation Registry Delta in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_response: response of GET_REVOC_REG_DELTA request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id, Revocation Registry Delta json and Timestamp. - /// { - /// "value": Registry-specific data { - /// prevAccum: string - previous accumulator value. - /// accum: string - current accumulator value. - /// issued: array - an array of issued indices. - /// revoked: array an array of revoked indices. - /// }, - /// "ver": string - version revocation registry delta json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_delta_response(indy_handle_t command_handle, - const char * get_revoc_reg_delta_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_delta_json, - unsigned long long timestamp) - ); - - - /// Parse transaction response to fetch metadata. - /// The important use case for this method is validation of Node's response freshens. - /// - /// Distributed Ledgers can reply with outdated information for consequence read request after write. - /// To reduce pool load libindy sends read requests to one random node in the pool. - /// Consensus validation is performed based on validation of nodes multi signature for current ledger Merkle Trie root. - /// This multi signature contains information about the latest ldeger's transaction ordering time and sequence number that this method returns. - /// - /// If node that returned response for some reason is out of consensus and has outdated ledger - /// it can be caught by analysis of the returned latest ledger's transaction ordering time and sequence number. - /// - /// There are two ways to filter outdated responses: - /// 1) based on "seqNo" - sender knows the sequence number of transaction that he consider as a fresh enough. - /// 2) based on "txnTime" - sender knows the timestamp that he consider as a fresh enough. - /// - /// Note: response of GET_VALIDATOR_INFO request isn't supported - /// - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// response: response of write or get request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// response metadata. - /// { - /// "seqNo": Option - transaction sequence number, - /// "txnTime": Option - transaction ordering time, - /// "lastSeqNo": Option - the latest transaction seqNo for particular Node, - /// "lastTxnTime": Option - the latest transaction ordering time for particular Node - /// } - /// - /// #Errors - /// Common* - /// Ledger* - extern indy_error_t indy_get_response_metadata(indy_handle_t command_handle, - const char * response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* response_metadata) - ); - - /// Builds a AUTH_RULE request. Request to change authentication rules for a ledger transaction. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// txn_type: ledger transaction alias or associated value. - /// action: type of an action. - /// Can be either "ADD" (to add a new rule) or "EDIT" (to edit an existing one). - /// field: transaction field. - /// old_value: (Optional) old value of a field, which can be changed to a new_value (mandatory for EDIT action). - /// new_value: (Optional) new value that can be used to fill the field. - /// constraint: set of constraints required for execution of an action in the following format - /// { - /// constraint_id - type of a constraint. - /// Can be either "ROLE" to specify final constraint or "AND"/"OR" to combine constraints. - /// role - role of a user which satisfy to constrain. - /// sig_count - the number of signatures required to execution action. - /// need_to_be_owner - if user must be an owner of transaction. - /// metadata - additional parameters of the constraint. - /// } - /// can be combined by - /// { - /// 'constraint_id': <"AND" or "OR"> - /// 'auth_constraints': [, ] - /// } - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_auth_rule_request(indy_handle_t command_handle, - const char * submitter_did, - const char * txn_type, - const char * action, - const char * field, - const char * old_value, - const char * new_value, - const char * constraint, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_AUTH_RULE request. Request to get authentication rules for a ledger transaction. - /// - /// NOTE: Either none or all transaction related parameters must be specified (`old_value` can be skipped for `ADD` action). - /// * none - to get all authentication rules for all ledger transactions - /// * all - to get authentication rules for specific action (`old_value` can be skipped for `ADD` action) - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender. - /// txn_type: (Optional) target ledger transaction alias or associated value. - /// action: (Optional) target action type. Can be either "ADD" or "EDIT". - /// field: (Optional) target transaction field. - /// old_value: (Optional) old value of field, which can be changed to a new_value (mandatory for EDIT action). - /// new_value: (Optional) new value that can be used to fill the field. - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_auth_rule_request(indy_handle_t command_handle, - const char * submitter_did, - const char * txn_type, - const char * action, - const char * field, - const char * old_value, - const char * new_value, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a TXN_AUTHR_AGRMT request. Request to add a new version of Transaction Author Agreement to the ledger. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the request sender. - /// text: a content of the TTA. - /// version: a version of the TTA (unique UTF-8 string). - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_txn_author_agreement_request(indy_handle_t command_handle, - const char * submitter_did, - const char * text, - const char * version, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_TXN_AUTHR_AGRMT request. Request to get a specific Transaction Author Agreement from the ledger. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the request sender. - /// data: (Optional) specifies a condition for getting specific TAA. - /// Contains 3 mutually exclusive optional fields: - /// { - /// hash: Optional - hash of requested TAA, - /// version: Optional - version of requested TAA. - /// timestamp: Optional - ledger will return TAA valid at requested timestamp. - /// } - /// Null data or empty JSON are acceptable here. In this case, ledger will return the latest version of TAA. - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_txn_author_agreement_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a SET_TXN_AUTHR_AGRMT_AML request. Request to add a new list of acceptance mechanisms for transaction author agreement. - /// Acceptance Mechanism is a description of the ways how the user may accept a transaction author agreement. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the request sender. - /// aml: a set of new acceptance mechanisms: - /// { - /// “”: { acceptance mechanism description 1}, - /// “”: { acceptance mechanism description 2}, - /// ... - /// } - /// version: a version of new acceptance mechanisms. (Note: unique on the Ledger) - /// aml_context: (Optional) common context information about acceptance mechanisms (may be a URL to external resource). - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_acceptance_mechanisms_request(indy_handle_t command_handle, - const char * submitter_did, - const char * aml, - const char * version, - const char * aml_context, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_TXN_AUTHR_AGRMT_AML request. Request to get a list of acceptance mechanisms from the ledger - /// valid for specified time or the latest one. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the request sender. - /// timestamp: i64 - time to get an active acceptance mechanisms. Pass -1 to get the latest one. - /// version: (Optional) version of acceptance mechanisms. - /// cb: Callback that takes command result as parameter. - /// - /// NOTE: timestamp and version cannot be specified together. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_acceptance_mechanisms_request(indy_handle_t command_handle, - const char * submitter_did, - indy_i64_t timestamp, - const char * version, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Append transaction author agreement acceptance data to a request. - /// This function should be called before signing and sending a request - /// if there is any transaction author agreement set on the Ledger. - /// - /// EXPERIMENTAL - /// - /// This function may calculate hash by itself or consume it as a parameter. - /// If all text, version and taa_digest parameters are specified, a check integrity of them will be done. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// request_json: original request data json. - /// text and version - (optional) raw data about TAA from ledger. - /// These parameters should be passed together. - /// These parameters are required if taa_digest parameter is omitted. - /// taa_digest - (optional) hash on text and version. This parameter is required if text and version parameters are omitted. - /// mechanism - mechanism how user has accepted the TAA - /// time - UTC timestamp when user has accepted the TAA - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Updated request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_append_txn_author_agreement_acceptance_to_request(indy_handle_t command_handle, - const char * request_json, - const char * text, - const char * version, - const char * taa_digest, - const char * mechanism, - indy_u64_t time, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_with_meta_json) - ); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wrappers/ios/vcx/include/indy_mod.h b/wrappers/ios/vcx/include/indy_mod.h deleted file mode 100644 index 8d44a064a1..0000000000 --- a/wrappers/ios/vcx/include/indy_mod.h +++ /dev/null @@ -1,222 +0,0 @@ -#ifndef __indy__mod_included__ -#define __indy__mod_included__ - -#include "indy_types.h" - -typedef enum -{ - Success = 0, - - // Common errors - - // Caller passed invalid value as param 1 (null, invalid json and etc..) - CommonInvalidParam1 = 100, - - // Caller passed invalid value as param 2 (null, invalid json and etc..) - CommonInvalidParam2 = 101, - - // Caller passed invalid value as param 3 (null, invalid json and etc..) - CommonInvalidParam3 = 102, - - // Caller passed invalid value as param 4 (null, invalid json and etc..) - CommonInvalidParam4 = 103, - - // Caller passed invalid value as param 5 (null, invalid json and etc..) - CommonInvalidParam5 = 104, - - // Caller passed invalid value as param 6 (null, invalid json and etc..) - CommonInvalidParam6 = 105, - - // Caller passed invalid value as param 7 (null, invalid json and etc..) - CommonInvalidParam7 = 106, - - // Caller passed invalid value as param 8 (null, invalid json and etc..) - CommonInvalidParam8 = 107, - - // Caller passed invalid value as param 9 (null, invalid json and etc..) - CommonInvalidParam9 = 108, - - // Caller passed invalid value as param 10 (null, invalid json and etc..) - CommonInvalidParam10 = 109, - - // Caller passed invalid value as param 11 (null, invalid json and etc..) - CommonInvalidParam11 = 110, - - // Caller passed invalid value as param 12 (null, invalid json and etc..) - CommonInvalidParam12 = 111, - - // Invalid library state was detected in runtime. It signals library bug - CommonInvalidState = 112, - - // Object (json, config, key, credential and etc...) passed by library caller has invalid structure - CommonInvalidStructure = 113, - - // IO Error - CommonIOError = 114, - - // Wallet errors - // Caller passed invalid wallet handle - WalletInvalidHandle = 200, - - // Unknown type of wallet was passed on create_wallet - WalletUnknownTypeError = 201, - - // Attempt to register already existing wallet type - WalletTypeAlreadyRegisteredError = 202, - - // Attempt to create wallet with name used for another exists wallet - WalletAlreadyExistsError = 203, - - // Requested entity id isn't present in wallet - WalletNotFoundError = 204, - - // Trying to use wallet with pool that has different name - WalletIncompatiblePoolError = 205, - - // Trying to open wallet that was opened already - WalletAlreadyOpenedError = 206, - - // Attempt to open encrypted wallet with invalid credentials - WalletAccessFailed = 207, - - // Input provided to wallet operations is considered not valid - WalletInputError = 208, - - // Decoding of wallet data during input/output failed - WalletDecodingError = 209, - - // Storage error occurred during wallet operation - WalletStorageError = 210, - - // Error during encryption-related operations - WalletEncryptionError = 211, - - // Requested wallet item not found - WalletItemNotFound = 212, - - // Returned if wallet's add_record operation is used with record name that already exists - WalletItemAlreadyExists = 213, - - // Returned if provided wallet query is invalid - WalletQueryError = 214, - - // Ledger errors - // Trying to open pool ledger that wasn't created before - PoolLedgerNotCreatedError = 300, - - // Caller passed invalid pool ledger handle - PoolLedgerInvalidPoolHandle = 301, - - // Pool ledger terminated - PoolLedgerTerminated = 302, - - // No concensus during ledger operation - LedgerNoConsensusError = 303, - - // Attempt to parse invalid transaction response - LedgerInvalidTransaction = 304, - - // Attempt to send transaction without the necessary privileges - LedgerSecurityError = 305, - - // Attempt to create pool ledger config with name used for another existing pool - PoolLedgerConfigAlreadyExistsError = 306, - - // Timeout for action - PoolLedgerTimeout = 307, - - // Attempt to open Pool for witch Genesis Transactions are not compatible with set Protocol version. - // Call pool.indy_set_protocol_version to set correct Protocol version. - PoolIncompatibleProtocolVersion = 308, - - // Item not found on ledger. - LedgerNotFound = 309, - - // Revocation registry is full and creation of new registry is necessary - AnoncredsRevocationRegistryFullError = 400, - - AnoncredsInvalidUserRevocId = 401, - - // Attempt to generate master secret with dupplicated name - AnoncredsMasterSecretDuplicateNameError = 404, - - AnoncredsProofRejected = 405, - - AnoncredsCredentialRevoked = 406, - - // Attempt to create credential definition with duplicated did schema pair - AnoncredsCredDefAlreadyExistsError = 407, - - // Crypto errors - // Unknown format of DID entity keys - UnknownCryptoTypeError = 500, - - // Attempt to create duplicate did - DidAlreadyExistsError = 600, - - // Unknown payment method was given - PaymentUnknownMethodError = 700, - - //No method were scraped from inputs/outputs or more than one were scraped - PaymentIncompatibleMethodsError = 701, - - // Insufficient funds on inputs - PaymentInsufficientFundsError = 702, - - // No such source on a ledger - PaymentSourceDoesNotExistError = 703, - - // Operation is not supported for payment method - PaymentOperationNotSupportedError = 704, - - // Extra funds on inputs - PaymentExtraFundsError = 705 - -} indy_error_t; - -#ifdef __cplusplus -extern "C" { -#endif - - /// Set libindy runtime configuration. Can be optionally called to change current params. - /// - /// #Params - /// config: { - /// "crypto_thread_pool_size": Optional - size of thread pool for the most expensive crypto operations. (4 by default) - /// "collect_backtrace": Optional - whether errors backtrace should be collected. - /// Capturing of backtrace can affect library performance. - /// NOTE: must be set before invocation of any other API functions. - /// } - /// - /// #Errors - /// Common* - extern indy_error_t indy_set_runtime_config(const char * config); - - /// Get details for last occurred error. - /// - /// This function should be called in two places to handle both cases of error occurrence: - /// 1) synchronous - in the same application thread - /// 2) asynchronous - inside of function callback - /// - /// NOTE: Error is stored until the next one occurs in the same execution thread or until asynchronous callback finished. - /// Returning pointer has the same lifetime. - /// - /// #Params - /// * `error_json_p` - Reference that will contain error details (if any error has occurred before) - /// in the format: - /// { - /// "backtrace": Optional - error backtrace. - /// Collecting of backtrace can be enabled by: - /// 1) setting environment variable `RUST_BACKTRACE=1` - /// 2) calling `indy_set_runtime_config` API function with `collect_backtrace: true` - /// "message": str - human-readable error description - /// } - /// - extern void indy_get_current_error(const char ** error_json_p); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/wrappers/ios/vcx/include/indy_types.h b/wrappers/ios/vcx/include/indy_types.h deleted file mode 100644 index debdfcc6f9..0000000000 --- a/wrappers/ios/vcx/include/indy_types.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __indy__types__included__ -#define __indy__types__included__ - -#include - -typedef uint8_t indy_u8_t; -typedef uint32_t indy_u32_t; -typedef int32_t indy_i32_t; -typedef int32_t indy_handle_t; -typedef unsigned int indy_bool_t; -typedef long long indy_i64_t; -typedef unsigned long long indy_u64_t; - -#endif diff --git a/wrappers/ios/vcx/include/libvcx.h b/wrappers/ios/vcx/include/libvcx.h index 5ccb12c811..7def18f960 100644 --- a/wrappers/ios/vcx/include/libvcx.h +++ b/wrappers/ios/vcx/include/libvcx.h @@ -5,7 +5,6 @@ extern "C" { #endif -#import "IndySdk.h" #import "VcxTypes.h" /** diff --git a/wrappers/ios/vcx/utils/IndyCallbacks.h b/wrappers/ios/vcx/utils/IndyCallbacks.h deleted file mode 100644 index 8655a19366..0000000000 --- a/wrappers/ios/vcx/utils/IndyCallbacks.h +++ /dev/null @@ -1,117 +0,0 @@ -// -// IndyCallbacks.h -// libindy -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#import -#import "indy_mod.h" -#import "indy_types.h" -#import "IndyTypes.h" - - -#ifndef IndyCallbacks_h -#define IndyCallbacks_h - -extern void IndyWrapperCommonCallback(indy_handle_t xcommand_handle, - indy_error_t err); - -extern void IndyWrapperCommonHandleCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_handle_t pool_handle); - -extern void IndyWrapperCommonStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1); - -extern void IndyWrapperCommonBoolCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_bool_t arg1); - -extern void IndyWrapperCommonStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2); - -extern void IndyWrapperCommonStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2); - -extern void IndyWrapperCommonDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const uint8_t *const arg1, - uint32_t arg2); - -extern void IndyWrapperCommonStringStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3); - -extern void IndyWrapperCommonStringDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const uint8_t *const arg2, - uint32_t arg3); - -extern void IndyWrapperCommonNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle); - -extern void IndyWrapperCommonHandleNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle, - uint32_t count); - -extern void IndyWrapperCommonStringOptStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3); - -void IndyWrapperCommonStringStringLongCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *arg1, - const char *arg2, - unsigned long long arg3); - -@interface IndyCallbacks : NSObject - -// MARK: - Store callback and create command handle -- (indy_handle_t)createCommandHandleFor:(id)callback; - -- (void)deleteCommandHandleFor:(indy_handle_t)handle; - -- (void)complete:(void (^)(NSError *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeBool:(void (^)(NSError *, BOOL))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeStr:(void (^)(NSError *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)complete2Str:(void (^)(NSError *, NSString *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeData:(void (^)(NSError *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - - -- (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -+ (IndyCallbacks *)sharedInstance; - -@end - -#endif /* IndyCallbacks_h */ diff --git a/wrappers/ios/vcx/utils/IndyCallbacks.m b/wrappers/ios/vcx/utils/IndyCallbacks.m deleted file mode 100644 index afee74bc44..0000000000 --- a/wrappers/ios/vcx/utils/IndyCallbacks.m +++ /dev/null @@ -1,450 +0,0 @@ -// -// IndyCallbacks.m -// libindy -// - -#include "indy_types.h" -#include "indy_mod.h" -#import "IndyCallbacks.h" -#import "NSError+VcxError.h" -#import "IndyTypes.h" - -static NSString *commandCallbackKey = @"commandCallback"; - -@interface IndyCallbacks () - -@property(strong, readwrite) NSMutableDictionary *commandCompletions; -@property indy_i32_t commandHandleCounter; -@property(strong, readwrite) NSRecursiveLock *globalLock; - -@end - -@implementation IndyCallbacks - -+ (IndyCallbacks *)sharedInstance { - static IndyCallbacks *instance = nil; - static dispatch_once_t dispatch_once_block; - - dispatch_once(&dispatch_once_block, ^{ - instance = [IndyCallbacks new]; - }); - - return instance; -} - -- (IndyCallbacks *)init { - self = [super init]; - if (self) { - self.commandHandleCounter = 0; - self.commandCompletions = [[NSMutableDictionary alloc] init]; - self.globalLock = [NSRecursiveLock new]; - } - return self; -} - -// MARK: - Create command handle and store callback - -- (indy_handle_t)createCommandHandleFor:(id)callback { - NSNumber *handle = nil; - - @synchronized (self.globalLock) { - handle = [NSNumber numberWithInt:self.commandHandleCounter]; - self.commandHandleCounter++; - - NSMutableDictionary *dict = [NSMutableDictionary new]; - dict[commandCallbackKey] = [callback copy]; - - self.commandCompletions[handle] = dict; - } - return (indy_handle_t) [handle integerValue]; -} - -- (void)deleteCommandHandleFor:(indy_handle_t)handle { - NSNumber *key = [NSNumber numberWithInt:handle]; - @synchronized (self.globalLock) { - if ([self.commandCompletions objectForKey:key]) { - [self.commandCompletions removeObjectForKey:key]; - } - } -} - -- (id)commandCompletionFor:(indy_handle_t)handle { - NSNumber *key = [NSNumber numberWithInt:handle]; - id val = nil; - @synchronized (self.globalLock) { - NSMutableDictionary *dict = (NSMutableDictionary *) [self.commandCompletions objectForKey:key]; - val = [dict objectForKey:@"commandCallback"]; - } - return val; -} - -- (void)complete:(void (^)(NSError *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret]); - }); - } -} - -- (void)completeBool:(void (^)(NSError *, BOOL))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], false); - }); - } -} - -- (void)completeStr:(void (^)(NSError *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil); - }); - } -} - -- (void)complete2Str:(void (^)(NSError *, NSString *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -- (void)completeData:(void (^)(NSError *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil); - }); - } -} - -- (void)complete2Data:(void (^)(NSError *, NSData *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -- (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -@end - -// MARK: - static indy C-callbacks - -void IndyWrapperCommonCallback(indy_handle_t xcommand_handle, - indy_error_t err) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *) = (void (^)(NSError *)) block; - - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error); - }); - } -} - -void IndyWrapperCommonHandleCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_handle_t pool_handle) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, IndyHandle) = (void (^)(NSError *, IndyHandle)) block; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (IndyHandle) pool_handle); - }); - } -} - -void IndyWrapperCommonNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSNumber *) = (void (^)(NSError *, NSNumber *arg1)) block; - NSNumber *sarg1 = @(handle); - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (NSNumber *) sarg1); - }); - } -} - - -void IndyWrapperCommonHandleNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle, - uint32_t count) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, IndyHandle, NSNumber *) = (void (^)(NSError *, IndyHandle, NSNumber *arg2)) block; - NSNumber *sarg2 = @(count); - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (IndyHandle) handle, (NSNumber *) sarg2); - }); - } -} - -void IndyWrapperCommonStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *) = (void (^)(NSError *, NSString *arg1)) block; - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1); - }); - } -} - -void IndyWrapperCommonBoolCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_bool_t arg1) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, BOOL) = (void (^)(NSError *, BOOL arg1)) block; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (BOOL) arg1); - }); - } -} - -void IndyWrapperCommonStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2) = (void (^)(NSError *, NSString *arg1, NSString *arg2)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2) = (void (^)(NSError *, NSString *arg1, NSString *arg2)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringOptStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSString *sarg3 = nil; - if (arg3) { - sarg3 = [NSString stringWithUTF8String:arg3]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2, sarg3); - }); - } -} - -void IndyWrapperCommonStringStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSString *sarg3 = nil; - if (arg3) { - sarg3 = [NSString stringWithUTF8String:arg3]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2, sarg3); - }); - } -} - -/// Arguments arg1 and arg2 will be converted to nsdata -void IndyWrapperCommonDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const uint8_t *const arg1, - uint32_t arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSData *arg) = (void (^)(NSError *, NSData *arg)) block; - - NSData *sarg = [NSData dataWithBytes:arg1 length:arg2]; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg); - }); - } -} - -void IndyWrapperCommonStringDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const uint8_t *const arg2, - uint32_t arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *, NSData *) = (void (^)(NSError *, NSString *, NSData *)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSData *sarg2 = [NSData dataWithBytes:arg2 length:arg3]; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringStringLongCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *arg1, - const char *arg2, - unsigned long long arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *, NSString *, NSNumber *) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSNumber *arg3)) block; - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSNumber *sarg3 = [NSNumber numberWithInt:arg3]; - NSError *error = [NSError errorFromVcxError:err]; - - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (NSString *) sarg1, (NSString *) sarg2, (NSNumber *) sarg3); - }); - } -} diff --git a/wrappers/ios/vcx/utils/IndySdk.h b/wrappers/ios/vcx/utils/IndySdk.h deleted file mode 100644 index 8a9768607b..0000000000 --- a/wrappers/ios/vcx/utils/IndySdk.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// IndySdk.h -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#ifndef IndySdk_h -#define IndySdk_h - -#import -//#import "vcx.h" -//#include "vcx.h" -#import "IndyTypes.h" - -@interface IndySdk : NSObject - -/// Builds a TXN_AUTHR_AGRMT request. Request to add a new version of Transaction Author Agreement to the ledger. -/// -/// #Params -/// text: a content of the TTA. -/// version: a version of the TTA (unique UTF-8 string). -/// requesterDID: DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)addTxnAuthorAgreement:(NSString *)text - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a GET_TXN_AUTHR_AGRMT request. Request to get a specific Transaction Author Agreement from the ledger. -/// -/// #Params -/// taaFilter: (Optional) specifies a condition for getting specific TAA. -/// Contains 3 mutually exclusive optional fields: -/// { -/// hash: Optional - hash of requested TAA, -/// version: Optional - version of requested TAA. -/// timestamp: Optional - ledger will return TAA valid at requested timestamp. -/// } -/// requesterDID: (Optional) DID of the request sender. -/// Null taaFilter or empty JSON are acceptable here. In this case, ledger will return the latest version of TAA. -/// -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)getTxnAuthorAgreement:(NSString *)taaFilter - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a SET_TXN_AUTHR_AGRMT_AML request. Request to add a new list of acceptance mechanisms for transaction author agreement. -/// Acceptance Mechanism is a description of the ways how the user may accept a transaction author agreement. -/// -/// #Params -/// aml: a set of new acceptance mechanisms: -/// { -/// “”: { acceptance mechanism description 1}, -/// “”: { acceptance mechanism description 2}, -/// ... -/// } -/// version: a version of new acceptance mechanisms. (Note: unique on the Ledger) -/// amlContext: (Optional) common context information about acceptance mechanisms (may be a URL to external resource). -/// requesterDID: DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)addAcceptanceMechanisms:(NSString *)aml - withVersion:(NSString *)version - withContext:(NSString *)amlContext - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a GET_TXN_AUTHR_AGRMT_AML request. Request to get a list of acceptance mechanisms from the ledger -/// valid for specified time or the latest one. -/// -/// #Params -/// timestamp: i64 - time to get an active acceptance mechanisms. Pass -1 to get the latest one. -/// version: (Optional) version of acceptance mechanisms. -/// requesterDID: (Optional) DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// NOTE: timestamp and version cannot be specified together. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)getAcceptanceMechanisms:(NSNumber *)timestamp - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Append transaction author agreement acceptance data to a request. -/// This function should be called before signing and sending a request -/// if there is any transaction author agreement set on the Ledger. -/// -/// This function may calculate hash by itself or consume it as a parameter. -/// If all text, version and taa_digest parameters are specified, a check integrity of them will be done. -/// -/// #Params -/// request_json: original request data json. -/// text and version - (optional) raw data about TAA from ledger. -/// These parameters should be passed together. -/// These parameters are required if taa_digest parameter is omitted. -/// taa_digest - (optional) hash on text and version. This parameter is required if text and version parameters are omitted. -/// mechanism - mechanism how user has accepted the TAA -/// time - UTC timestamp when user has accepted the TAA -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Updated request result as json. -/// -/// #Errors -/// Common* -+ (void)appendTxnAuthorAgreement:(NSString *)requestJson - withAgreement:(NSString *)text - withVersion:(NSString *)version - withDigest:(NSString *)taaDigest - withMechanism:(NSString *)mechanism - withTimestamp:(NSNumber *)time - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/** - Encrypts a message by anonymous-encryption scheme. - - Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - Only the Recipient can decrypt these messages, using its private key. - While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - - Note to use DID keys with this function you can call keyForDid to get key id (verkey) - for specific DID. - - @param theirKey verkey of message recipient - @param message a message to be encrypted - Returns encrypted message - */ -+ (void)anonCrypt:(NSData *)message - theirKey:(NSString *)theirKey - completion:(void (^)(NSError *error, NSData *encryptedMsg))completion; - -/** - Decrypts a message by anonymous-encryption scheme. - - Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - Only the Recipient can decrypt these messages, using its private key. - While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - - Note to use DID keys with this function you can call keyForDid to get key id (verkey) - for specific DID. - - @param walletHandle The wallet. - @param myKey Id (verkey) of my key. The key must be created by calling createKey or createAndStoreMyDid - @param encryptedMessage encrypted message - Returns decrypted message as an array of bytes. - */ -+ (void)anonDecrypt:(NSData *)encryptedMessage - myKey:(NSString *)myKey - walletHandle:(IndyHandle)walletHandle - completion:(void (^)(NSError *error, NSData *decryptedMessage))completion; - - -@end - -#endif /* IndySdk_h */ diff --git a/wrappers/ios/vcx/utils/IndySdk.m b/wrappers/ios/vcx/utils/IndySdk.m deleted file mode 100644 index f96d6371a9..0000000000 --- a/wrappers/ios/vcx/utils/IndySdk.m +++ /dev/null @@ -1,156 +0,0 @@ -// -// IndySdk.m -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - - -#include "IndySdk.h" -#include "IndyCallbacks.h" -//#include "vcx.h" -#include "indy_types.h" -#include "indy_crypto.h" -#include "indy_ledger.h" - -@implementation IndySdk - - - -+ (void)addTxnAuthorAgreement:(NSString *)text - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_txn_author_agreement_request(handle, - [requesterDID UTF8String], - [text UTF8String], - [version UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)getTxnAuthorAgreement:(NSString *)taaFilter - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_get_txn_author_agreement_request(handle, - [requesterDID UTF8String], - [taaFilter UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)addAcceptanceMechanisms:(NSString *)aml - withVersion:(NSString *)version - withContext:(NSString *)amlContext - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_acceptance_mechanisms_request(handle, - [requesterDID UTF8String], - [aml UTF8String], - [version UTF8String], - [amlContext UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)getAcceptanceMechanisms:(NSNumber *)timestamp - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_get_acceptance_mechanisms_request(handle, - [requesterDID UTF8String], - [timestamp longLongValue], - [version UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; - -} - - -+ (void)appendTxnAuthorAgreement:(NSString *)requestJson - withAgreement:(NSString *)text - withVersion:(NSString *)version - withDigest:(NSString *)taaDigest - withMechanism:(NSString *)mechanism - withTimestamp:(NSNumber *)time - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_append_txn_author_agreement_acceptance_to_request(handle, - [requestJson UTF8String], - [text UTF8String], - [version UTF8String], - [taaDigest UTF8String], - [mechanism UTF8String], - [time longLongValue], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; - -} - - - -+ (void)anonCrypt:(NSData *)message - theirKey:(NSString *)theirKey - completion:(void (^)(NSError *error, NSData *encryptedMsg))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - uint32_t messageLen = (uint32_t) [message length]; - uint8_t *messageRaw = (uint8_t *) [message bytes]; - - indy_error_t ret = indy_crypto_anon_crypt(handle, - [theirKey UTF8String], - messageRaw, - messageLen, - IndyWrapperCommonDataCallback); - - [[IndyCallbacks sharedInstance] completeData:completion forHandle:handle ifError:ret]; -} - -+ (void)anonDecrypt:(NSData *)encryptedMessage - myKey:(NSString *)myKey - walletHandle:(IndyHandle)walletHandle - completion:(void (^)(NSError *error, NSData *decryptedMessage))completion -{ - - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - uint32_t messageLen = (uint32_t) [encryptedMessage length]; - uint8_t *messageRaw = (uint8_t *) [encryptedMessage bytes]; - - indy_error_t ret = indy_crypto_anon_decrypt(handle, - walletHandle, - [myKey UTF8String], - messageRaw, - messageLen, - IndyWrapperCommonDataCallback); - - [[IndyCallbacks sharedInstance] completeData:completion forHandle:handle ifError:ret]; -} - - -@end - diff --git a/wrappers/ios/vcx/utils/IndyTypes.h b/wrappers/ios/vcx/utils/IndyTypes.h deleted file mode 100644 index 749b34850d..0000000000 --- a/wrappers/ios/vcx/utils/IndyTypes.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// IndyTypes.h -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#ifndef IndyTypes_h -#define IndyTypes_h - -//typedef unsigned int indy_error_t; -//typedef unsigned int indy_handle_t; -typedef SInt32 IndyHandle; - - -#endif /* IndyTypes_h */ \ No newline at end of file diff --git a/wrappers/ios/vcx/utils/VcxCallbacks.mm b/wrappers/ios/vcx/utils/VcxCallbacks.mm index bb4351a721..79ea6608c0 100644 --- a/wrappers/ios/vcx/utils/VcxCallbacks.mm +++ b/wrappers/ios/vcx/utils/VcxCallbacks.mm @@ -158,7 +158,3 @@ - (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))complet } @end - -// MARK: - static indy C-callbacks - - diff --git a/wrappers/ios/vcx/utils/VcxLogger.h b/wrappers/ios/vcx/utils/VcxLogger.h index 10458a8e47..1d8acacd9a 100644 --- a/wrappers/ios/vcx/utils/VcxLogger.h +++ b/wrappers/ios/vcx/utils/VcxLogger.h @@ -7,7 +7,6 @@ // #import -#import "IndyTypes.h" @interface VcxLogger : NSObject diff --git a/wrappers/ios/vcx/utils/VcxTypes.h b/wrappers/ios/vcx/utils/VcxTypes.h index c03097b5e9..8590c6b6f7 100644 --- a/wrappers/ios/vcx/utils/VcxTypes.h +++ b/wrappers/ios/vcx/utils/VcxTypes.h @@ -9,6 +9,8 @@ #ifndef VcxTypes_h #define VcxTypes_h +#include + typedef enum { none = 0, initialized, diff --git a/wrappers/ios/vcx/vcx-demoTests/vcx_demoTests.m b/wrappers/ios/vcx/vcx-demoTests/vcx_demoTests.m index 901fa3898c..463d3edeaf 100644 --- a/wrappers/ios/vcx/vcx-demoTests/vcx_demoTests.m +++ b/wrappers/ios/vcx/vcx-demoTests/vcx_demoTests.m @@ -8,7 +8,6 @@ #import #import "RNIndyTests.h" -#import "IndyCallbacks.h" @interface vcx_demoTests : XCTestCase diff --git a/wrappers/ios/vcx/vcx.xcodeproj/project.pbxproj b/wrappers/ios/vcx/vcx.xcodeproj/project.pbxproj index 10a37a93f0..7faef25566 100644 --- a/wrappers/ios/vcx/vcx.xcodeproj/project.pbxproj +++ b/wrappers/ios/vcx/vcx.xcodeproj/project.pbxproj @@ -23,8 +23,6 @@ /* Begin PBXBuildFile section */ 4D5F206FBB9ED1724E29C275 /* VcxWrapperCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D5F2F217F1D8DB99D136E82 /* VcxWrapperCallbacks.m */; }; 4D5F2B86DA730337C103A885 /* VcxWrapperCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D5F27439E44B92B6769389B /* VcxWrapperCallbacks.h */; }; - 8E1E709F221B653B00EF3CBB /* IndySdk.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1E709E221B653B00EF3CBB /* IndySdk.m */; }; - 8E1E70A7221B7B8C00EF3CBB /* IndyCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */; }; 8EFD49F922133FBF002E58D5 /* VcxLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EFD49F722133FBF002E58D5 /* VcxLogger.h */; }; 8EFD49FA22133FBF002E58D5 /* VcxLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFD49F822133FBF002E58D5 /* VcxLogger.m */; }; 8EFD93C9220269BD00A0400A /* vcx.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2566EE209705E3002EBEBA /* vcx.framework */; }; @@ -111,11 +109,6 @@ /* Begin PBXFileReference section */ 4D5F27439E44B92B6769389B /* VcxWrapperCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VcxWrapperCallbacks.h; sourceTree = ""; }; 4D5F2F217F1D8DB99D136E82 /* VcxWrapperCallbacks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VcxWrapperCallbacks.m; sourceTree = ""; }; - 8E1E709E221B653B00EF3CBB /* IndySdk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IndySdk.m; sourceTree = ""; }; - 8E1E70A0221B659E00EF3CBB /* IndySdk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndySdk.h; sourceTree = ""; }; - 8E1E70A5221B77D100EF3CBB /* IndyTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndyTypes.h; sourceTree = ""; }; - 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IndyCallbacks.m; sourceTree = ""; }; - 8E1E70A8221B7BC100EF3CBB /* IndyCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndyCallbacks.h; sourceTree = ""; }; 8EFD49F722133FBF002E58D5 /* VcxLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VcxLogger.h; sourceTree = ""; }; 8EFD49F822133FBF002E58D5 /* VcxLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VcxLogger.m; sourceTree = ""; }; 8EFD93CA22026CA400A0400A /* RNIndy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNIndy.m; sourceTree = ""; }; @@ -310,11 +303,6 @@ DD858CB820A4AF7B004B3CB5 /* VcxCallbacks.mm */, DD858CB720A4AF7B004B3CB5 /* VcxErrors.h */, DD858CB920A4AF7B004B3CB5 /* VcxTypes.h */, - 8E1E709E221B653B00EF3CBB /* IndySdk.m */, - 8E1E70A0221B659E00EF3CBB /* IndySdk.h */, - 8E1E70A5221B77D100EF3CBB /* IndyTypes.h */, - 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */, - 8E1E70A8221B7BC100EF3CBB /* IndyCallbacks.h */, 4D5F2F217F1D8DB99D136E82 /* VcxWrapperCallbacks.m */, 4D5F27439E44B92B6769389B /* VcxWrapperCallbacks.h */, ); @@ -558,9 +546,7 @@ files = ( DD858CBE20A4AF7C004B3CB5 /* VcxCallbacks.mm in Sources */, DD858C9E20A45C11004B3CB5 /* VcxAPI.m in Sources */, - 8E1E709F221B653B00EF3CBB /* IndySdk.m in Sources */, DD858CC120A4AF7C004B3CB5 /* NSError+VcxError.m in Sources */, - 8E1E70A7221B7B8C00EF3CBB /* IndyCallbacks.m in Sources */, 8EFD49FA22133FBF002E58D5 /* VcxLogger.m in Sources */, 4D5F206FBB9ED1724E29C275 /* VcxWrapperCallbacks.m in Sources */, ); diff --git a/wrappers/ios/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate b/wrappers/ios/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000..d9d8335973 Binary files /dev/null and b/wrappers/ios/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/wrappers/ios/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist b/wrappers/ios/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000..9fb0187234 --- /dev/null +++ b/wrappers/ios/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,24 @@ + + + + + SchemeUserState + + vcx-demo.xcscheme_^#shared#^_ + + orderHint + 1 + + vcx-objc.xcscheme_^#shared#^_ + + orderHint + 2 + + vcx.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/wrappers/ios/vcx/vcx/vcx.h b/wrappers/ios/vcx/vcx/vcx.h index 066294fc01..7cc012313f 100644 --- a/wrappers/ios/vcx/vcx/vcx.h +++ b/wrappers/ios/vcx/vcx/vcx.h @@ -18,6 +18,5 @@ FOUNDATION_EXPORT const unsigned char vcxVersionString[]; #import "VcxAPI.h" #import "VcxLogger.h" -#import "IndySdk.h" #import "libvcx.h" diff --git a/wrappers/ios_legacy/ci/build.sh b/wrappers/ios_legacy/ci/build.sh index 26a838059c..49635486e5 100755 --- a/wrappers/ios_legacy/ci/build.sh +++ b/wrappers/ios_legacy/ci/build.sh @@ -156,7 +156,7 @@ build_libvcx() { export OPENSSL_LIB_DIR=$WORK_DIR/libs/openssl/${ARCH} echo "Building vcx. OPENSSL_LIB_DIR=${OPENSSL_LIB_DIR}" - cargo build --target "${TRIPLET}" --release --features ios-wrapper + cargo build --target "${TRIPLET}" --release done popd } diff --git a/wrappers/ios_legacy/vcx/include/indy_crypto.h b/wrappers/ios_legacy/vcx/include/indy_crypto.h deleted file mode 100644 index efeaedf520..0000000000 --- a/wrappers/ios_legacy/vcx/include/indy_crypto.h +++ /dev/null @@ -1,446 +0,0 @@ -#ifndef __indy__crypto__included__ -#define __indy__crypto__included__ - -#ifdef __cplusplus -extern "C" { -#endif - - - - /// Creates keys pair and stores in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// key_json: Key information as json. Example: - /// { - /// "seed": string, (optional) Seed that allows deterministic key creation (if not set random one will be created). - /// Can be UTF-8, base64 or hex string. - /// "crypto_type": string, // Optional (if not set then ed25519 curve is used); Currently only 'ed25519' value is supported for this field. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: command handle to map callback to caller context. - /// - err: Error code. - /// - verkey: Ver key of generated key pair, also used as key identifier - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_create_key(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const key_json, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err, - const char *const vk) - ); - - /// Saves/replaces the meta information for the giving key in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// verkey - the key (verkey, key id) to store metadata. - /// metadata - the meta information that will be store with the key. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: command handle to map callback to caller context. - /// - err: Error code. - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_set_key_metadata(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const verkey, - const char *const metadata, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err) - ); - - /// Retrieves the meta information for the giving key in the wallet. - /// - /// #Params - /// command_handle: Command handle to map callback to caller context. - /// wallet_handle: Wallet handle (created by open_wallet). - /// verkey - The key (verkey, key id) to retrieve metadata. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Error Code - /// cb: - /// - command_handle_: Command handle to map callback to caller context. - /// - err: Error code. - /// - metadata - The meta information stored with the key; Can be null if no metadata was saved for this key. - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_get_key_metadata(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char *const verkey, - - void (*cb)(indy_handle_t command_handle, - indy_error_t err, - const char *const metadata) - ); - - - - - /// Signs a message with a key. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// signer_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// message_raw: a pointer to first byte of message to be signed - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// a signature string - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_sign(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * signer_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* signature_raw, - indy_u32_t signature_len) - ); - - /// Verify a signature with a verkey. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// signer_vk: verkey of signer of the message - /// message_raw: a pointer to first byte of message that has been signed - /// message_len: a message length - /// signature_raw: a pointer to first byte of signature to be verified - /// signature_len: a signature length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// valid: true - if signature is valid, false - otherwise - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_crypto_verify(indy_handle_t command_handle, - const char * signer_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - const indy_u8_t * signature_raw, - indy_u32_t signature_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - indy_bool_t valid ) - ); - - /// Encrypt a message by authenticated-encryption scheme. - /// - /// Sender can encrypt a confidential message specifically for Recipient, using Sender's public key. - /// Using Recipient's public key, Sender can compute a shared secret key. - /// Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key. - /// That shared secret key can be used to verify that the encrypted message was not tampered with, - /// before eventually decrypting it. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// sender_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// recipient_vk: id (verkey) of their key - /// message_raw: a pointer to first byte of message that to be encrypted - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// an encrypted message as a pointer to array of bytes. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* -/// Crypto* - extern indy_error_t indy_crypto_auth_crypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * sender_vk, - const char * recipient_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len) - ); - - /// Decrypt a message by authenticated-encryption scheme. - /// - /// Sender can encrypt a confidential message specifically for Recipient, using Sender's public key. - /// Using Recipient's public key, Sender can compute a shared secret key. - /// Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key. - /// That shared secret key can be used to verify that the encrypted message was not tampered with, - /// before eventually decrypting it. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// recipient_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// encrypted_msg_raw: a pointer to first byte of message that to be decrypted - /// encrypted_msg_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// sender verkey and decrypted message as a pointer to array of bytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_auth_decrypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * recipient_vk, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char * sender_vk, - const indy_u8_t* decrypted_msg_raw, - indy_u32_t decrypted_msg_len) - ); - - - /// Encrypts a message by anonymous-encryption scheme. - /// - /// Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - /// Only the Recipient can decrypt these messages, using its private key. - /// While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// recipient_vk: verkey of message recipient - /// message_raw: a pointer to first byte of message that to be encrypted - /// message_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// an encrypted message as a pointer to array of vytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_crypto_anon_crypt(indy_handle_t command_handle, - const char * recipient_vk, - const indy_u8_t * message_raw, - indy_u32_t message_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* encrypted_msg_raw, - indy_u32_t encrypted_msg_len) - ); - - /// Decrypts a message by anonymous-encryption scheme. - /// - /// Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - /// Only the Recipient can decrypt these messages, using its private key. - /// While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handler (created by open_wallet). - /// recipient_vk: id (verkey) of my key. The key must be created by calling indy_create_key or indy_create_and_store_my_did - /// encrypted_msg_raw: a pointer to first byte of message that to be decrypted - /// encrypted_msg_len: a message length - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// decrypted message as a pointer to an array of bytes - /// - /// #Errors - /// Common* - /// Wallet* - /// Crypto* - extern indy_error_t indy_crypto_anon_decrypt(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * recipient_vk, - const indy_u8_t* encrypted_msg, - indy_u32_t encrypted_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* decrypted_msg_raw, - indy_u32_t decrypted_msg_len) - ); - - - /// Packs a message by encrypting the message and serializes it in a JWE-like format (Experimental) - /// - /// Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) - /// for specific DID. - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// message: a pointer to the first byte of the message to be packed - /// message_len: the length of the message - /// receivers: a string in the format of a json list which will contain the list of receiver's keys - /// the message is being encrypted for. - /// Example: - /// "[, ]" - /// sender: the sender's verkey as a string When null pointer is used in this parameter, anoncrypt is used - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// a JWE using authcrypt alg is defined below: - /// { - /// "protected": "b64URLencoded({ - /// "enc": "xchachapoly1305_ietf", - /// "typ": "JWM/1.0", - /// "alg": "Authcrypt", - /// "recipients": [ - /// { - /// "encrypted_key": base64URLencode(libsodium.crypto_box(my_key, their_vk, cek, cek_iv)) - /// "header": { - /// "kid": "base58encode(recipient_verkey)", - /// "sender" : base64URLencode(libsodium.crypto_box_seal(their_vk, base58encode(sender_vk)), - /// "iv" : base64URLencode(cek_iv) - /// } - /// }, - /// ], - /// })", - /// "iv": , - /// "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek), - /// "tag": - /// } - /// - /// Alternative example in using anoncrypt alg is defined below: - /// { - /// "protected": "b64URLencoded({ - /// "enc": "xchachapoly1305_ietf", - /// "typ": "JWM/1.0", - /// "alg": "Anoncrypt", - /// "recipients": [ - /// { - /// "encrypted_key": base64URLencode(libsodium.crypto_box_seal(their_vk, cek)), - /// "header": { - /// "kid": base58encode(recipient_verkey), - /// } - /// }, - /// ], - /// })", - /// "iv": b64URLencode(iv), - /// "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek), - /// "tag": b64URLencode(tag) - /// } - /// - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_pack_message(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const indy_u8_t* message, - indy_u32_t message_len, - const char * receiver_keys, - const char * sender, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* jwe_msg_raw, - indy_u32_t jwe_msg_len) - ); - - - /// Unpacks a JWE-like formatted message outputted by indy_pack_message (Experimental) - /// - /// #Params - /// command_handle: command handle to map callback to user context. - /// wallet_handle: wallet handle (created by open_wallet). - /// jwe_data: a pointer to the first byte of the JWE to be unpacked - /// jwe_len: the length of the JWE message in bytes - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// if authcrypt was used to pack the message returns this json structure: - /// { - /// message: , - /// sender_verkey: - /// recipient_verkey: - /// } - /// - /// OR - /// - /// if anoncrypt was used to pack the message returns this json structure: - /// { - /// message: , - /// recipient_verkey: - /// } - /// - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - extern indy_error_t indy_unpack_message(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const indy_u8_t* jwe_msg, - indy_u32_t jwe_len, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const indy_u8_t* res_json_raw, - indy_u32_t res_json_len) - ); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wrappers/ios_legacy/vcx/include/indy_ledger.h b/wrappers/ios_legacy/vcx/include/indy_ledger.h deleted file mode 100644 index 9fdf3c7491..0000000000 --- a/wrappers/ios_legacy/vcx/include/indy_ledger.h +++ /dev/null @@ -1,1203 +0,0 @@ -#ifndef __indy__ledger_included__ -#define __indy__ledger_included__ - -#include "indy_mod.h" -#include "indy_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - /// Signs and submits request message to validator pool. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign), and sends signed request message - /// to validator pool (see write_request). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_sign_and_submit_request(indy_handle_t command_handle, - indy_handle_t pool_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Publishes request message to validator pool (no signing, unlike sign_and_submit_request). - /// - /// The request is sent to the validator pool as is. It's assumed that it's already prepared. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Ledger* - - extern indy_error_t indy_submit_request(indy_handle_t command_handle, - indy_handle_t pool_handle, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Send action to particular nodes of validator pool. - /// - /// The list of requests can be send: - /// POOL_RESTART - /// GET_VALIDATOR_INFO - /// - /// The request is sent to the nodes as is. It's assumed that it's already prepared. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// pool_handle: pool handle (created by open_pool_ledger). - /// request_json: Request data json. - /// nodes: (Optional) List of node names to send the request. - /// ["Node1", "Node2",...."NodeN"] - /// timeout: (Optional) Time to wait respond from nodes (override the default timeout) (in sec). - /// Pass -1 to use default timeout - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - /// Ledger* - - extern indy_error_t indy_submit_action(indy_handle_t command_handle, - indy_handle_t pool_handle, - const char * request_json, - const char * nodes, - indy_i32_t timeout, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Signs request message. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Signed request json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_sign_request(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* signed_request_json) - ); - - - /// Multi signs request message. - /// - /// Adds submitter information to passed request json, signs it with submitter - /// sign key (see wallet_sign). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// wallet_handle: wallet handle (created by open_wallet). - /// submitter_did: Id of Identity stored in secured Wallet. - /// request_json: Request data json. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Signed request json. - /// - /// #Errors - /// Common* - /// Wallet* - /// Ledger* - /// Crypto* - - extern indy_error_t indy_multi_sign_request(indy_handle_t command_handle, - indy_handle_t wallet_handle, - const char * submitter_did, - const char * request_json, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* signed_request_json) - ); - - /// Builds a request to get a DDO. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Id of Identity stored in secured Wallet. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_ddo_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_result_json) - ); - - /// Builds a NYM request. Request to create a new NYM record for a specific user. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// verkey: Target identity verification key as base58-encoded string. - /// alias: NYM's alias. - /// role: Role of a user NYM record: - /// null (common USER) - /// TRUSTEE - /// STEWARD - /// TRUST_ANCHOR - /// ENDORSER - equal to TRUST_ANCHOR that will be removed soon - /// empty string to reset role - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_nym_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * verkey, - const char * alias, - const char * role, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds an ATTRIB request. Request to add attribute to a NYM record. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// hash: (Optional) Hash of attribute data. - /// raw: (Optional) Json, where key is attribute name and value is attribute value. - /// enc: (Optional) Encrypted value attribute data. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_attrib_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * hash, - const char * raw, - const char * enc, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_ATTRIB request. Request to get information about an Attribute for the specified DID. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// raw: (Optional) Requested attribute name. - /// hash: (Optional) Requested attribute hash. - /// enc: (Optional) Requested attribute encrypted value. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_attrib_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * hash, - const char * raw, - const char * enc, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_NYM request. Request to get information about a DID (NYM). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did:(Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// target_did: Target DID as base58-encoded string for 16 or 32 bit DID value. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_nym_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a SCHEMA request. Request to add Credential's schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: Credential schema. - /// { - /// id: identifier of schema - /// attrNames: array of attribute name strings (the number of attributes should be less or equal than 125) - /// name: Schema's name string - /// version: Schema's version string, - /// ver: Version of the Schema json - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_schema_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_SCHEMA request. Request to get Credential's Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: Schema ID in ledger - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_schema_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_SCHEMA response to get Schema in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_schema_response: response of GET_SCHEMA request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Schema Id and Schema json. - /// { - /// id: identifier of schema - /// attrNames: array of attribute name strings - /// name: Schema's name string - /// version: Schema's version string - /// ver: Version of the Schema json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_schema_response(indy_handle_t command_handle, - const char * get_schema_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* schema_id, - const char* schema_json) - ); - - /// Builds an CRED_DEF request. Request to add a Credential Definition (in particular, public key), - /// that Issuer creates for a particular Credential Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: credential definition json - /// { - /// id: string - identifier of credential definition - /// schemaId: string - identifier of stored in ledger schema - /// type: string - type of the credential definition. CL is the only supported type now. - /// tag: string - allows to distinct between credential definitions for the same issuer and schema - /// value: Dictionary with Credential Definition's data: { - /// primary: primary credential public key, - /// Optional: revocation credential public key - /// }, - /// ver: Version of the CredDef json - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_cred_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_CRED_DEF request. Request to get a Credential Definition (in particular, public key), - /// that Issuer creates for a particular Credential Schema. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: Credential Definition ID in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_cred_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_CRED_DEF response to get Credential Definition in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_cred_def_response: response of GET_CRED_DEF request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Credential Definition Id and Credential Definition json. - /// { - /// id: string - identifier of credential definition - /// schemaId: string - identifier of stored in ledger schema - /// type: string - type of the credential definition. CL is the only supported type now. - /// tag: string - allows to distinct between credential definitions for the same issuer and schema - /// value: Dictionary with Credential Definition's data: { - /// primary: primary credential public key, - /// Optional: revocation credential public key - /// }, - /// ver: Version of the Credential Definition json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_cred_def_response(indy_handle_t command_handle, - const char * get_cred_def_response, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* cred_def_id, - const char* cred_def_json) - ); - - /// Builds a NODE request. Request to add a new node to the pool, or updates existing in the pool. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// target_did: Target Node's DID. It differs from submitter_did field. - /// data: Data associated with the Node: { - /// alias: string - Node's alias - /// blskey: string - (Optional) BLS multi-signature key as base58-encoded string. - /// blskey_pop: string - (Optional) BLS key proof of possession as base58-encoded string. - /// client_ip: string - (Optional) Node's client listener IP address. - /// client_port: string - (Optional) Node's client listener port. - /// node_ip: string - (Optional) The IP address other Nodes use to communicate with this Node. - /// node_port: string - (Optional) The port other Nodes use to communicate with this Node. - /// services: array - (Optional) The service of the Node. VALIDATOR is the only supported one now. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_node_request(indy_handle_t command_handle, - const char * submitter_did, - const char * target_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_VALIDATOR_INFO request. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: Id of Identity stored in secured Wallet. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_validator_info_request(indy_handle_t command_handle, - const char * submitter_did, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - - /// Builds a GET_TXN request. Request to get any transaction by its seq_no. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// ledger_type: (Optional) type of the ledger the requested transaction belongs to: - /// DOMAIN - used default, - /// POOL, - /// CONFIG - /// any number - /// seq_no: seq_no of transaction in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_txn_request(indy_handle_t command_handle, - const char * submitter_did, - const char * ledger_type, - indy_i32_t seq_no, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_CONFIG request. Request to change Pool's configuration. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// writes: Whether any write requests can be processed by the pool - /// (if false, then pool goes to read-only state). True by default. - /// force: Whether we should apply transaction (for example, move pool to read-only state) - /// without waiting for consensus of this transaction. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_config_request(indy_handle_t command_handle, - const char * submitter_did, - indy_bool_t writes, - indy_bool_t force, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_RESTART request. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: Id of Identity stored in secured Wallet. - /// action: Either start or cancel - /// datetime: - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_restart_request(indy_handle_t command_handle, - const char * submitter_did, - const char * action, - const char * datetime, - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a POOL_UPGRADE request. Request to upgrade the Pool (sent by Trustee). - /// It upgrades the specified Nodes (either all nodes in the Pool, or some specific ones). - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// name: Human-readable name for the upgrade. - /// version: The version of indy-node package we perform upgrade to. - /// Must be greater than existing one (or equal if reinstall flag is True). - /// action: Either start or cancel. - /// sha256: sha256 hash of the package. - /// timeout: (Optional) Limits upgrade time on each Node. - /// schedule: (Optional) Schedule of when to perform upgrade on each node. Map Node DIDs to upgrade time. - /// justification: (Optional) justification string for this particular Upgrade. - /// reinstall: Whether it's allowed to re-install the same version. False by default. - /// force: Whether we should apply transaction (schedule Upgrade) without waiting - /// for consensus of this transaction. - /// package: (Optional) Package to be upgraded. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_pool_upgrade_request(indy_handle_t command_handle, - const char * submitter_did, - const char * name, - const char * version, - const char * action, - const char * sha256, - indy_i32_t timeout, - const char * schedule, - const char * justification, - indy_bool_t reinstall, - indy_bool_t force, - const char * package_, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a REVOC_REG_DEF request. Request to add the definition of revocation registry - /// to an exists credential definition. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// data: Revocation Registry data: - /// { - /// "id": string - ID of the Revocation Registry, - /// "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now), - /// "tag": string - Unique descriptive ID of the Registry, - /// "credDefId": string - ID of the corresponding CredentialDefinition, - /// "value": Registry-specific data { - /// "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND), - /// "maxCredNum": number - Maximum number of credentials the Registry can serve. - /// "tailsHash": string - Hash of tails. - /// "tailsLocation": string - Location of tails file. - /// "publicKeys": - Registry's public key. - /// }, - /// "ver": string - version of revocation registry definition json. - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_revoc_reg_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_REVOC_REG_DEF request. Request to get a revocation registry definition, - /// that Issuer creates for a particular Credential Definition. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// id: ID of Revocation Registry Definition in ledger. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_def_request(indy_handle_t command_handle, - const char * submitter_did, - const char * id, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG_DEF response to get Revocation Registry Definition in the format - /// compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_def_response: response of GET_REVOC_REG_DEF request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id and Revocation Registry Definition json. - /// { - /// "id": string - ID of the Revocation Registry, - /// "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now), - /// "tag": string - Unique descriptive ID of the Registry, - /// "credDefId": string - ID of the corresponding CredentialDefinition, - /// "value": Registry-specific data { - /// "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND), - /// "maxCredNum": number - Maximum number of credentials the Registry can serve. - /// "tailsHash": string - Hash of tails. - /// "tailsLocation": string - Location of tails file. - /// "publicKeys": - Registry's public key. - /// }, - /// "ver": string - version of revocation registry definition json. - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_def_response(indy_handle_t command_handle, - const char * get_revoc_ref_def_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_def_json) - ); - - /// Builds a REVOC_REG_ENTRY request. Request to add the RevocReg entry containing - /// the new accumulator value and issued/revoked indices. - /// This is just a delta of indices, not the whole list. - /// So, it can be sent each time a new credential is issued/revoked. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the submitter stored in secured Wallet. - /// revoc_reg_def_id: ID of the corresponding RevocRegDef. - /// rev_def_type: Revocation Registry type (only CL_ACCUM is supported for now). - /// value: Registry-specific data: { - /// value: { - /// prevAccum: string - previous accumulator value. - /// accum: string - current accumulator value. - /// issued: array - an array of issued indices. - /// revoked: array an array of revoked indices. - /// }, - /// ver: string - version revocation registry entry json - /// - /// } - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_revoc_reg_entry_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - const char * rev_def_type, - const char * value, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_REVOC_REG request. Request to get the accumulated state of the Revocation Registry - /// by ID. The state is defined by the given timestamp. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// revoc_reg_def_id: ID of the corresponding Revocation Registry Definition in ledger. - /// timestamp: Requested time represented as a total number of seconds from Unix Epoch - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - long long timestamp, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG response to get Revocation Registry in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_response: response of GET_REVOC_REG request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id, Revocation Registry json and Timestamp. - /// { - /// "value": Registry-specific data { - /// "accum": string - current accumulator value - /// }, - /// "ver": string - version revocation registry json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_response(indy_handle_t command_handle, - const char * get_revoc_reg_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_json, - unsigned long long timestamp) - ); - - /// Builds a GET_REVOC_REG_DELTA request. Request to get the delta of the accumulated state of the Revocation Registry. - /// The Delta is defined by from and to timestamp fields. - /// If from is not specified, then the whole state till to will be returned. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender (if not provided then default Libindy DID will be used). - /// revoc_reg_def_id: ID of the corresponding Revocation Registry Definition in ledger. - /// from: Requested time represented as a total number of seconds from Unix Epoch - /// to: Requested time represented as a total number of seconds from Unix Epoch - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - - extern indy_error_t indy_build_get_revoc_reg_delta_request(indy_handle_t command_handle, - const char * submitter_did, - const char * revoc_reg_def_id, - long long from, - long long to, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Parse a GET_REVOC_REG_DELTA response to get Revocation Registry Delta in the format compatible with Anoncreds API. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// get_revoc_reg_response: response of GET_REVOC_REG_DELTA request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Revocation Registry Definition Id, Revocation Registry Delta json and Timestamp. - /// { - /// "value": Registry-specific data { - /// prevAccum: string - previous accumulator value. - /// accum: string - current accumulator value. - /// issued: array - an array of issued indices. - /// revoked: array an array of revoked indices. - /// }, - /// "ver": string - version revocation registry delta json - /// } - /// - /// #Errors - /// Common* - - extern indy_error_t indy_parse_get_revoc_reg_delta_response(indy_handle_t command_handle, - const char * get_revoc_reg_delta_response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* revoc_reg_def_id, - const char* revoc_reg_delta_json, - unsigned long long timestamp) - ); - - - /// Parse transaction response to fetch metadata. - /// The important use case for this method is validation of Node's response freshens. - /// - /// Distributed Ledgers can reply with outdated information for consequence read request after write. - /// To reduce pool load libindy sends read requests to one random node in the pool. - /// Consensus validation is performed based on validation of nodes multi signature for current ledger Merkle Trie root. - /// This multi signature contains information about the latest ldeger's transaction ordering time and sequence number that this method returns. - /// - /// If node that returned response for some reason is out of consensus and has outdated ledger - /// it can be caught by analysis of the returned latest ledger's transaction ordering time and sequence number. - /// - /// There are two ways to filter outdated responses: - /// 1) based on "seqNo" - sender knows the sequence number of transaction that he consider as a fresh enough. - /// 2) based on "txnTime" - sender knows the timestamp that he consider as a fresh enough. - /// - /// Note: response of GET_VALIDATOR_INFO request isn't supported - /// - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// response: response of write or get request. - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// response metadata. - /// { - /// "seqNo": Option - transaction sequence number, - /// "txnTime": Option - transaction ordering time, - /// "lastSeqNo": Option - the latest transaction seqNo for particular Node, - /// "lastTxnTime": Option - the latest transaction ordering time for particular Node - /// } - /// - /// #Errors - /// Common* - /// Ledger* - extern indy_error_t indy_get_response_metadata(indy_handle_t command_handle, - const char * response, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* response_metadata) - ); - - /// Builds a AUTH_RULE request. Request to change authentication rules for a ledger transaction. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// txn_type: ledger transaction alias or associated value. - /// action: type of an action. - /// Can be either "ADD" (to add a new rule) or "EDIT" (to edit an existing one). - /// field: transaction field. - /// old_value: (Optional) old value of a field, which can be changed to a new_value (mandatory for EDIT action). - /// new_value: (Optional) new value that can be used to fill the field. - /// constraint: set of constraints required for execution of an action in the following format - /// { - /// constraint_id - type of a constraint. - /// Can be either "ROLE" to specify final constraint or "AND"/"OR" to combine constraints. - /// role - role of a user which satisfy to constrain. - /// sig_count - the number of signatures required to execution action. - /// need_to_be_owner - if user must be an owner of transaction. - /// metadata - additional parameters of the constraint. - /// } - /// can be combined by - /// { - /// 'constraint_id': <"AND" or "OR"> - /// 'auth_constraints': [, ] - /// } - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_auth_rule_request(indy_handle_t command_handle, - const char * submitter_did, - const char * txn_type, - const char * action, - const char * field, - const char * old_value, - const char * new_value, - const char * constraint, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_AUTH_RULE request. Request to get authentication rules for a ledger transaction. - /// - /// NOTE: Either none or all transaction related parameters must be specified (`old_value` can be skipped for `ADD` action). - /// * none - to get all authentication rules for all ledger transactions - /// * all - to get authentication rules for specific action (`old_value` can be skipped for `ADD` action) - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the read request sender. - /// txn_type: (Optional) target ledger transaction alias or associated value. - /// action: (Optional) target action type. Can be either "ADD" or "EDIT". - /// field: (Optional) target transaction field. - /// old_value: (Optional) old value of field, which can be changed to a new_value (mandatory for EDIT action). - /// new_value: (Optional) new value that can be used to fill the field. - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_auth_rule_request(indy_handle_t command_handle, - const char * submitter_did, - const char * txn_type, - const char * action, - const char * field, - const char * old_value, - const char * new_value, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a TXN_AUTHR_AGRMT request. Request to add a new version of Transaction Author Agreement to the ledger. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the request sender. - /// text: a content of the TTA. - /// version: a version of the TTA (unique UTF-8 string). - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_txn_author_agreement_request(indy_handle_t command_handle, - const char * submitter_did, - const char * text, - const char * version, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_TXN_AUTHR_AGRMT request. Request to get a specific Transaction Author Agreement from the ledger. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the request sender. - /// data: (Optional) specifies a condition for getting specific TAA. - /// Contains 3 mutually exclusive optional fields: - /// { - /// hash: Optional - hash of requested TAA, - /// version: Optional - version of requested TAA. - /// timestamp: Optional - ledger will return TAA valid at requested timestamp. - /// } - /// Null data or empty JSON are acceptable here. In this case, ledger will return the latest version of TAA. - /// - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_txn_author_agreement_request(indy_handle_t command_handle, - const char * submitter_did, - const char * data, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a SET_TXN_AUTHR_AGRMT_AML request. Request to add a new list of acceptance mechanisms for transaction author agreement. - /// Acceptance Mechanism is a description of the ways how the user may accept a transaction author agreement. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: DID of the request sender. - /// aml: a set of new acceptance mechanisms: - /// { - /// “”: { acceptance mechanism description 1}, - /// “”: { acceptance mechanism description 2}, - /// ... - /// } - /// version: a version of new acceptance mechanisms. (Note: unique on the Ledger) - /// aml_context: (Optional) common context information about acceptance mechanisms (may be a URL to external resource). - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_acceptance_mechanisms_request(indy_handle_t command_handle, - const char * submitter_did, - const char * aml, - const char * version, - const char * aml_context, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Builds a GET_TXN_AUTHR_AGRMT_AML request. Request to get a list of acceptance mechanisms from the ledger - /// valid for specified time or the latest one. - /// - /// EXPERIMENTAL - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// submitter_did: (Optional) DID of the request sender. - /// timestamp: i64 - time to get an active acceptance mechanisms. Pass -1 to get the latest one. - /// version: (Optional) version of acceptance mechanisms. - /// cb: Callback that takes command result as parameter. - /// - /// NOTE: timestamp and version cannot be specified together. - /// - /// #Returns - /// Request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_build_get_acceptance_mechanisms_request(indy_handle_t command_handle, - const char * submitter_did, - indy_i64_t timestamp, - const char * version, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_json) - ); - - /// Append transaction author agreement acceptance data to a request. - /// This function should be called before signing and sending a request - /// if there is any transaction author agreement set on the Ledger. - /// - /// EXPERIMENTAL - /// - /// This function may calculate hash by itself or consume it as a parameter. - /// If all text, version and taa_digest parameters are specified, a check integrity of them will be done. - /// - /// #Params - /// command_handle: command handle to map callback to caller context. - /// request_json: original request data json. - /// text and version - (optional) raw data about TAA from ledger. - /// These parameters should be passed together. - /// These parameters are required if taa_digest parameter is omitted. - /// taa_digest - (optional) hash on text and version. This parameter is required if text and version parameters are omitted. - /// mechanism - mechanism how user has accepted the TAA - /// time - UTC timestamp when user has accepted the TAA - /// cb: Callback that takes command result as parameter. - /// - /// #Returns - /// Updated request result as json. - /// - /// #Errors - /// Common* - extern indy_error_t indy_append_txn_author_agreement_acceptance_to_request(indy_handle_t command_handle, - const char * request_json, - const char * text, - const char * version, - const char * taa_digest, - const char * mechanism, - indy_u64_t time, - - void (*cb)(indy_handle_t command_handle_, - indy_error_t err, - const char* request_with_meta_json) - ); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wrappers/ios_legacy/vcx/include/indy_mod.h b/wrappers/ios_legacy/vcx/include/indy_mod.h deleted file mode 100644 index 8d44a064a1..0000000000 --- a/wrappers/ios_legacy/vcx/include/indy_mod.h +++ /dev/null @@ -1,222 +0,0 @@ -#ifndef __indy__mod_included__ -#define __indy__mod_included__ - -#include "indy_types.h" - -typedef enum -{ - Success = 0, - - // Common errors - - // Caller passed invalid value as param 1 (null, invalid json and etc..) - CommonInvalidParam1 = 100, - - // Caller passed invalid value as param 2 (null, invalid json and etc..) - CommonInvalidParam2 = 101, - - // Caller passed invalid value as param 3 (null, invalid json and etc..) - CommonInvalidParam3 = 102, - - // Caller passed invalid value as param 4 (null, invalid json and etc..) - CommonInvalidParam4 = 103, - - // Caller passed invalid value as param 5 (null, invalid json and etc..) - CommonInvalidParam5 = 104, - - // Caller passed invalid value as param 6 (null, invalid json and etc..) - CommonInvalidParam6 = 105, - - // Caller passed invalid value as param 7 (null, invalid json and etc..) - CommonInvalidParam7 = 106, - - // Caller passed invalid value as param 8 (null, invalid json and etc..) - CommonInvalidParam8 = 107, - - // Caller passed invalid value as param 9 (null, invalid json and etc..) - CommonInvalidParam9 = 108, - - // Caller passed invalid value as param 10 (null, invalid json and etc..) - CommonInvalidParam10 = 109, - - // Caller passed invalid value as param 11 (null, invalid json and etc..) - CommonInvalidParam11 = 110, - - // Caller passed invalid value as param 12 (null, invalid json and etc..) - CommonInvalidParam12 = 111, - - // Invalid library state was detected in runtime. It signals library bug - CommonInvalidState = 112, - - // Object (json, config, key, credential and etc...) passed by library caller has invalid structure - CommonInvalidStructure = 113, - - // IO Error - CommonIOError = 114, - - // Wallet errors - // Caller passed invalid wallet handle - WalletInvalidHandle = 200, - - // Unknown type of wallet was passed on create_wallet - WalletUnknownTypeError = 201, - - // Attempt to register already existing wallet type - WalletTypeAlreadyRegisteredError = 202, - - // Attempt to create wallet with name used for another exists wallet - WalletAlreadyExistsError = 203, - - // Requested entity id isn't present in wallet - WalletNotFoundError = 204, - - // Trying to use wallet with pool that has different name - WalletIncompatiblePoolError = 205, - - // Trying to open wallet that was opened already - WalletAlreadyOpenedError = 206, - - // Attempt to open encrypted wallet with invalid credentials - WalletAccessFailed = 207, - - // Input provided to wallet operations is considered not valid - WalletInputError = 208, - - // Decoding of wallet data during input/output failed - WalletDecodingError = 209, - - // Storage error occurred during wallet operation - WalletStorageError = 210, - - // Error during encryption-related operations - WalletEncryptionError = 211, - - // Requested wallet item not found - WalletItemNotFound = 212, - - // Returned if wallet's add_record operation is used with record name that already exists - WalletItemAlreadyExists = 213, - - // Returned if provided wallet query is invalid - WalletQueryError = 214, - - // Ledger errors - // Trying to open pool ledger that wasn't created before - PoolLedgerNotCreatedError = 300, - - // Caller passed invalid pool ledger handle - PoolLedgerInvalidPoolHandle = 301, - - // Pool ledger terminated - PoolLedgerTerminated = 302, - - // No concensus during ledger operation - LedgerNoConsensusError = 303, - - // Attempt to parse invalid transaction response - LedgerInvalidTransaction = 304, - - // Attempt to send transaction without the necessary privileges - LedgerSecurityError = 305, - - // Attempt to create pool ledger config with name used for another existing pool - PoolLedgerConfigAlreadyExistsError = 306, - - // Timeout for action - PoolLedgerTimeout = 307, - - // Attempt to open Pool for witch Genesis Transactions are not compatible with set Protocol version. - // Call pool.indy_set_protocol_version to set correct Protocol version. - PoolIncompatibleProtocolVersion = 308, - - // Item not found on ledger. - LedgerNotFound = 309, - - // Revocation registry is full and creation of new registry is necessary - AnoncredsRevocationRegistryFullError = 400, - - AnoncredsInvalidUserRevocId = 401, - - // Attempt to generate master secret with dupplicated name - AnoncredsMasterSecretDuplicateNameError = 404, - - AnoncredsProofRejected = 405, - - AnoncredsCredentialRevoked = 406, - - // Attempt to create credential definition with duplicated did schema pair - AnoncredsCredDefAlreadyExistsError = 407, - - // Crypto errors - // Unknown format of DID entity keys - UnknownCryptoTypeError = 500, - - // Attempt to create duplicate did - DidAlreadyExistsError = 600, - - // Unknown payment method was given - PaymentUnknownMethodError = 700, - - //No method were scraped from inputs/outputs or more than one were scraped - PaymentIncompatibleMethodsError = 701, - - // Insufficient funds on inputs - PaymentInsufficientFundsError = 702, - - // No such source on a ledger - PaymentSourceDoesNotExistError = 703, - - // Operation is not supported for payment method - PaymentOperationNotSupportedError = 704, - - // Extra funds on inputs - PaymentExtraFundsError = 705 - -} indy_error_t; - -#ifdef __cplusplus -extern "C" { -#endif - - /// Set libindy runtime configuration. Can be optionally called to change current params. - /// - /// #Params - /// config: { - /// "crypto_thread_pool_size": Optional - size of thread pool for the most expensive crypto operations. (4 by default) - /// "collect_backtrace": Optional - whether errors backtrace should be collected. - /// Capturing of backtrace can affect library performance. - /// NOTE: must be set before invocation of any other API functions. - /// } - /// - /// #Errors - /// Common* - extern indy_error_t indy_set_runtime_config(const char * config); - - /// Get details for last occurred error. - /// - /// This function should be called in two places to handle both cases of error occurrence: - /// 1) synchronous - in the same application thread - /// 2) asynchronous - inside of function callback - /// - /// NOTE: Error is stored until the next one occurs in the same execution thread or until asynchronous callback finished. - /// Returning pointer has the same lifetime. - /// - /// #Params - /// * `error_json_p` - Reference that will contain error details (if any error has occurred before) - /// in the format: - /// { - /// "backtrace": Optional - error backtrace. - /// Collecting of backtrace can be enabled by: - /// 1) setting environment variable `RUST_BACKTRACE=1` - /// 2) calling `indy_set_runtime_config` API function with `collect_backtrace: true` - /// "message": str - human-readable error description - /// } - /// - extern void indy_get_current_error(const char ** error_json_p); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/wrappers/ios_legacy/vcx/include/indy_types.h b/wrappers/ios_legacy/vcx/include/indy_types.h deleted file mode 100644 index debdfcc6f9..0000000000 --- a/wrappers/ios_legacy/vcx/include/indy_types.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __indy__types__included__ -#define __indy__types__included__ - -#include - -typedef uint8_t indy_u8_t; -typedef uint32_t indy_u32_t; -typedef int32_t indy_i32_t; -typedef int32_t indy_handle_t; -typedef unsigned int indy_bool_t; -typedef long long indy_i64_t; -typedef unsigned long long indy_u64_t; - -#endif diff --git a/wrappers/ios_legacy/vcx/utils/IndyCallbacks.h b/wrappers/ios_legacy/vcx/utils/IndyCallbacks.h deleted file mode 100644 index 8655a19366..0000000000 --- a/wrappers/ios_legacy/vcx/utils/IndyCallbacks.h +++ /dev/null @@ -1,117 +0,0 @@ -// -// IndyCallbacks.h -// libindy -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#import -#import "indy_mod.h" -#import "indy_types.h" -#import "IndyTypes.h" - - -#ifndef IndyCallbacks_h -#define IndyCallbacks_h - -extern void IndyWrapperCommonCallback(indy_handle_t xcommand_handle, - indy_error_t err); - -extern void IndyWrapperCommonHandleCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_handle_t pool_handle); - -extern void IndyWrapperCommonStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1); - -extern void IndyWrapperCommonBoolCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_bool_t arg1); - -extern void IndyWrapperCommonStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2); - -extern void IndyWrapperCommonStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2); - -extern void IndyWrapperCommonDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const uint8_t *const arg1, - uint32_t arg2); - -extern void IndyWrapperCommonStringStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3); - -extern void IndyWrapperCommonStringDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const uint8_t *const arg2, - uint32_t arg3); - -extern void IndyWrapperCommonNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle); - -extern void IndyWrapperCommonHandleNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle, - uint32_t count); - -extern void IndyWrapperCommonStringOptStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3); - -void IndyWrapperCommonStringStringLongCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *arg1, - const char *arg2, - unsigned long long arg3); - -@interface IndyCallbacks : NSObject - -// MARK: - Store callback and create command handle -- (indy_handle_t)createCommandHandleFor:(id)callback; - -- (void)deleteCommandHandleFor:(indy_handle_t)handle; - -- (void)complete:(void (^)(NSError *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeBool:(void (^)(NSError *, BOOL))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeStr:(void (^)(NSError *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)complete2Str:(void (^)(NSError *, NSString *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -- (void)completeData:(void (^)(NSError *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - - -- (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret; - -+ (IndyCallbacks *)sharedInstance; - -@end - -#endif /* IndyCallbacks_h */ diff --git a/wrappers/ios_legacy/vcx/utils/IndyCallbacks.m b/wrappers/ios_legacy/vcx/utils/IndyCallbacks.m deleted file mode 100644 index 30290a3dd0..0000000000 --- a/wrappers/ios_legacy/vcx/utils/IndyCallbacks.m +++ /dev/null @@ -1,451 +0,0 @@ -// -// IndyCallbacks.m -// libindy -// - -#include "indy_types.h" -#include "indy_mod.h" -#import "IndyCallbacks.h" -#import "NSError+VcxError.h" -#import "IndyTypes.h" -#import "VcxLogger.h" - -static NSString *commandCallbackKey = @"commandCallback"; - -@interface IndyCallbacks () - -@property(strong, readwrite) NSMutableDictionary *commandCompletions; -@property indy_i32_t commandHandleCounter; -@property(strong, readwrite) NSRecursiveLock *globalLock; - -@end - -@implementation IndyCallbacks - -+ (IndyCallbacks *)sharedInstance { - static IndyCallbacks *instance = nil; - static dispatch_once_t dispatch_once_block; - - dispatch_once(&dispatch_once_block, ^{ - instance = [IndyCallbacks new]; - }); - - return instance; -} - -- (IndyCallbacks *)init { - self = [super init]; - if (self) { - self.commandHandleCounter = 0; - self.commandCompletions = [[NSMutableDictionary alloc] init]; - self.globalLock = [NSRecursiveLock new]; - } - return self; -} - -// MARK: - Create command handle and store callback - -- (indy_handle_t)createCommandHandleFor:(id)callback { - NSNumber *handle = nil; - - @synchronized (self.globalLock) { - handle = [NSNumber numberWithInt:self.commandHandleCounter]; - self.commandHandleCounter++; - - NSMutableDictionary *dict = [NSMutableDictionary new]; - dict[commandCallbackKey] = [callback copy]; - - self.commandCompletions[handle] = dict; - } - return (indy_handle_t) [handle integerValue]; -} - -- (void)deleteCommandHandleFor:(indy_handle_t)handle { - NSNumber *key = [NSNumber numberWithInt:handle]; - @synchronized (self.globalLock) { - if ([self.commandCompletions objectForKey:key]) { - [self.commandCompletions removeObjectForKey:key]; - } - } -} - -- (id)commandCompletionFor:(indy_handle_t)handle { - NSNumber *key = [NSNumber numberWithInt:handle]; - id val = nil; - @synchronized (self.globalLock) { - NSMutableDictionary *dict = (NSMutableDictionary *) [self.commandCompletions objectForKey:key]; - val = [dict objectForKey:@"commandCallback"]; - } - return val; -} - -- (void)complete:(void (^)(NSError *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret]); - }); - } -} - -- (void)completeBool:(void (^)(NSError *, BOOL))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], false); - }); - } -} - -- (void)completeStr:(void (^)(NSError *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil); - }); - } -} - -- (void)complete2Str:(void (^)(NSError *, NSString *, NSString *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -- (void)completeData:(void (^)(NSError *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil); - }); - } -} - -- (void)complete2Data:(void (^)(NSError *, NSData *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -- (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))completion - forHandle:(indy_handle_t)handle - ifError:(indy_error_t)ret { - if (ret != Success) { - [self deleteCommandHandleFor:handle]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion([NSError errorFromVcxError:ret], nil, nil); - }); - } -} - -@end - -// MARK: - static indy C-callbacks - -void IndyWrapperCommonCallback(indy_handle_t xcommand_handle, - indy_error_t err) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *) = (void (^)(NSError *)) block; - - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error); - }); - } -} - -void IndyWrapperCommonHandleCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_handle_t pool_handle) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, IndyHandle) = (void (^)(NSError *, IndyHandle)) block; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (IndyHandle) pool_handle); - }); - } -} - -void IndyWrapperCommonNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSNumber *) = (void (^)(NSError *, NSNumber *arg1)) block; - NSNumber *sarg1 = @(handle); - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (NSNumber *) sarg1); - }); - } -} - - -void IndyWrapperCommonHandleNumberCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_i32_t handle, - uint32_t count) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, IndyHandle, NSNumber *) = (void (^)(NSError *, IndyHandle, NSNumber *arg2)) block; - NSNumber *sarg2 = @(count); - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (IndyHandle) handle, (NSNumber *) sarg2); - }); - } -} - -void IndyWrapperCommonStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *) = (void (^)(NSError *, NSString *arg1)) block; - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1); - }); - } -} - -void IndyWrapperCommonBoolCallback(indy_handle_t xcommand_handle, - indy_error_t err, - indy_bool_t arg1) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, BOOL) = (void (^)(NSError *, BOOL arg1)) block; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (BOOL) arg1); - }); - } -} - -void IndyWrapperCommonStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2) = (void (^)(NSError *, NSString *arg1, NSString *arg2)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2) = (void (^)(NSError *, NSString *arg1, NSString *arg2)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringOptStringOptStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSString *sarg3 = nil; - if (arg3) { - sarg3 = [NSString stringWithUTF8String:arg3]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2, sarg3); - }); - } -} - -void IndyWrapperCommonStringStringStringCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const char *const arg2, - const char *const arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSString *arg3)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSString *sarg3 = nil; - if (arg3) { - sarg3 = [NSString stringWithUTF8String:arg3]; - } - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2, sarg3); - }); - } -} - -/// Arguments arg1 and arg2 will be converted to nsdata -void IndyWrapperCommonDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const uint8_t *const arg1, - uint32_t arg2) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSData *arg) = (void (^)(NSError *, NSData *arg)) block; - - NSData *sarg = [NSData dataWithBytes:arg1 length:arg2]; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg); - }); - } -} - -void IndyWrapperCommonStringDataCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *const arg1, - const uint8_t *const arg2, - uint32_t arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *, NSData *) = (void (^)(NSError *, NSString *, NSData *)) block; - - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSData *sarg2 = [NSData dataWithBytes:arg2 length:arg3]; - NSError *error = [NSError errorFromVcxError:err]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, sarg1, sarg2); - }); - } -} - -void IndyWrapperCommonStringStringLongCallback(indy_handle_t xcommand_handle, - indy_error_t err, - const char *arg1, - const char *arg2, - unsigned long long arg3) { - id block = [[IndyCallbacks sharedInstance] commandCompletionFor:xcommand_handle]; - [[IndyCallbacks sharedInstance] deleteCommandHandleFor:xcommand_handle]; - - void (^completion)(NSError *, NSString *, NSString *, NSNumber *) = (void (^)(NSError *, NSString *arg1, NSString *arg2, NSNumber *arg3)) block; - NSString *sarg1 = nil; - if (arg1) { - sarg1 = [NSString stringWithUTF8String:arg1]; - } - NSString *sarg2 = nil; - if (arg2) { - sarg2 = [NSString stringWithUTF8String:arg2]; - } - NSNumber *sarg3 = [NSNumber numberWithInt:arg3]; - NSError *error = [NSError errorFromVcxError:err]; - - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(error, (NSString *) sarg1, (NSString *) sarg2, (NSNumber *) sarg3); - }); - } -} diff --git a/wrappers/ios_legacy/vcx/utils/IndySdk.h b/wrappers/ios_legacy/vcx/utils/IndySdk.h deleted file mode 100644 index 8a9768607b..0000000000 --- a/wrappers/ios_legacy/vcx/utils/IndySdk.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// IndySdk.h -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#ifndef IndySdk_h -#define IndySdk_h - -#import -//#import "vcx.h" -//#include "vcx.h" -#import "IndyTypes.h" - -@interface IndySdk : NSObject - -/// Builds a TXN_AUTHR_AGRMT request. Request to add a new version of Transaction Author Agreement to the ledger. -/// -/// #Params -/// text: a content of the TTA. -/// version: a version of the TTA (unique UTF-8 string). -/// requesterDID: DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)addTxnAuthorAgreement:(NSString *)text - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a GET_TXN_AUTHR_AGRMT request. Request to get a specific Transaction Author Agreement from the ledger. -/// -/// #Params -/// taaFilter: (Optional) specifies a condition for getting specific TAA. -/// Contains 3 mutually exclusive optional fields: -/// { -/// hash: Optional - hash of requested TAA, -/// version: Optional - version of requested TAA. -/// timestamp: Optional - ledger will return TAA valid at requested timestamp. -/// } -/// requesterDID: (Optional) DID of the request sender. -/// Null taaFilter or empty JSON are acceptable here. In this case, ledger will return the latest version of TAA. -/// -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)getTxnAuthorAgreement:(NSString *)taaFilter - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a SET_TXN_AUTHR_AGRMT_AML request. Request to add a new list of acceptance mechanisms for transaction author agreement. -/// Acceptance Mechanism is a description of the ways how the user may accept a transaction author agreement. -/// -/// #Params -/// aml: a set of new acceptance mechanisms: -/// { -/// “”: { acceptance mechanism description 1}, -/// “”: { acceptance mechanism description 2}, -/// ... -/// } -/// version: a version of new acceptance mechanisms. (Note: unique on the Ledger) -/// amlContext: (Optional) common context information about acceptance mechanisms (may be a URL to external resource). -/// requesterDID: DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)addAcceptanceMechanisms:(NSString *)aml - withVersion:(NSString *)version - withContext:(NSString *)amlContext - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Builds a GET_TXN_AUTHR_AGRMT_AML request. Request to get a list of acceptance mechanisms from the ledger -/// valid for specified time or the latest one. -/// -/// #Params -/// timestamp: i64 - time to get an active acceptance mechanisms. Pass -1 to get the latest one. -/// version: (Optional) version of acceptance mechanisms. -/// requesterDID: (Optional) DID of the request sender. -/// completion: Callback that takes command result as parameter. -/// -/// NOTE: timestamp and version cannot be specified together. -/// -/// #Returns -/// Request result as json. -/// -/// #Errors -/// Common* -+ (void)getAcceptanceMechanisms:(NSNumber *)timestamp - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/// Append transaction author agreement acceptance data to a request. -/// This function should be called before signing and sending a request -/// if there is any transaction author agreement set on the Ledger. -/// -/// This function may calculate hash by itself or consume it as a parameter. -/// If all text, version and taa_digest parameters are specified, a check integrity of them will be done. -/// -/// #Params -/// request_json: original request data json. -/// text and version - (optional) raw data about TAA from ledger. -/// These parameters should be passed together. -/// These parameters are required if taa_digest parameter is omitted. -/// taa_digest - (optional) hash on text and version. This parameter is required if text and version parameters are omitted. -/// mechanism - mechanism how user has accepted the TAA -/// time - UTC timestamp when user has accepted the TAA -/// completion: Callback that takes command result as parameter. -/// -/// #Returns -/// Updated request result as json. -/// -/// #Errors -/// Common* -+ (void)appendTxnAuthorAgreement:(NSString *)requestJson - withAgreement:(NSString *)text - withVersion:(NSString *)version - withDigest:(NSString *)taaDigest - withMechanism:(NSString *)mechanism - withTimestamp:(NSNumber *)time - completion:(void (^)(NSError *error, NSString *jsonResult))completion; - - -/** - Encrypts a message by anonymous-encryption scheme. - - Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - Only the Recipient can decrypt these messages, using its private key. - While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - - Note to use DID keys with this function you can call keyForDid to get key id (verkey) - for specific DID. - - @param theirKey verkey of message recipient - @param message a message to be encrypted - Returns encrypted message - */ -+ (void)anonCrypt:(NSData *)message - theirKey:(NSString *)theirKey - completion:(void (^)(NSError *error, NSData *encryptedMsg))completion; - -/** - Decrypts a message by anonymous-encryption scheme. - - Sealed boxes are designed to anonymously send messages to a Recipient given its public key. - Only the Recipient can decrypt these messages, using its private key. - While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender. - - Note to use DID keys with this function you can call keyForDid to get key id (verkey) - for specific DID. - - @param walletHandle The wallet. - @param myKey Id (verkey) of my key. The key must be created by calling createKey or createAndStoreMyDid - @param encryptedMessage encrypted message - Returns decrypted message as an array of bytes. - */ -+ (void)anonDecrypt:(NSData *)encryptedMessage - myKey:(NSString *)myKey - walletHandle:(IndyHandle)walletHandle - completion:(void (^)(NSError *error, NSData *decryptedMessage))completion; - - -@end - -#endif /* IndySdk_h */ diff --git a/wrappers/ios_legacy/vcx/utils/IndySdk.m b/wrappers/ios_legacy/vcx/utils/IndySdk.m deleted file mode 100644 index f96d6371a9..0000000000 --- a/wrappers/ios_legacy/vcx/utils/IndySdk.m +++ /dev/null @@ -1,156 +0,0 @@ -// -// IndySdk.m -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - - -#include "IndySdk.h" -#include "IndyCallbacks.h" -//#include "vcx.h" -#include "indy_types.h" -#include "indy_crypto.h" -#include "indy_ledger.h" - -@implementation IndySdk - - - -+ (void)addTxnAuthorAgreement:(NSString *)text - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_txn_author_agreement_request(handle, - [requesterDID UTF8String], - [text UTF8String], - [version UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)getTxnAuthorAgreement:(NSString *)taaFilter - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_get_txn_author_agreement_request(handle, - [requesterDID UTF8String], - [taaFilter UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)addAcceptanceMechanisms:(NSString *)aml - withVersion:(NSString *)version - withContext:(NSString *)amlContext - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_acceptance_mechanisms_request(handle, - [requesterDID UTF8String], - [aml UTF8String], - [version UTF8String], - [amlContext UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; -} - - -+ (void)getAcceptanceMechanisms:(NSNumber *)timestamp - withVersion:(NSString *)version - fromRequester:(NSString *)requesterDID - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_build_get_acceptance_mechanisms_request(handle, - [requesterDID UTF8String], - [timestamp longLongValue], - [version UTF8String], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; - -} - - -+ (void)appendTxnAuthorAgreement:(NSString *)requestJson - withAgreement:(NSString *)text - withVersion:(NSString *)version - withDigest:(NSString *)taaDigest - withMechanism:(NSString *)mechanism - withTimestamp:(NSNumber *)time - completion:(void (^)(NSError *error, NSString *jsonResult))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - indy_error_t ret = indy_append_txn_author_agreement_acceptance_to_request(handle, - [requestJson UTF8String], - [text UTF8String], - [version UTF8String], - [taaDigest UTF8String], - [mechanism UTF8String], - [time longLongValue], - IndyWrapperCommonStringCallback); - - [[IndyCallbacks sharedInstance] completeStr:completion forHandle:handle ifError:ret]; - -} - - - -+ (void)anonCrypt:(NSData *)message - theirKey:(NSString *)theirKey - completion:(void (^)(NSError *error, NSData *encryptedMsg))completion -{ - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - uint32_t messageLen = (uint32_t) [message length]; - uint8_t *messageRaw = (uint8_t *) [message bytes]; - - indy_error_t ret = indy_crypto_anon_crypt(handle, - [theirKey UTF8String], - messageRaw, - messageLen, - IndyWrapperCommonDataCallback); - - [[IndyCallbacks sharedInstance] completeData:completion forHandle:handle ifError:ret]; -} - -+ (void)anonDecrypt:(NSData *)encryptedMessage - myKey:(NSString *)myKey - walletHandle:(IndyHandle)walletHandle - completion:(void (^)(NSError *error, NSData *decryptedMessage))completion -{ - - indy_handle_t handle = [[IndyCallbacks sharedInstance] createCommandHandleFor:completion]; - - uint32_t messageLen = (uint32_t) [encryptedMessage length]; - uint8_t *messageRaw = (uint8_t *) [encryptedMessage bytes]; - - indy_error_t ret = indy_crypto_anon_decrypt(handle, - walletHandle, - [myKey UTF8String], - messageRaw, - messageLen, - IndyWrapperCommonDataCallback); - - [[IndyCallbacks sharedInstance] completeData:completion forHandle:handle ifError:ret]; -} - - -@end - diff --git a/wrappers/ios_legacy/vcx/utils/IndyTypes.h b/wrappers/ios_legacy/vcx/utils/IndyTypes.h deleted file mode 100644 index 749b34850d..0000000000 --- a/wrappers/ios_legacy/vcx/utils/IndyTypes.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// IndyTypes.h -// vcx -// -// Created by Norman Jarvis on 2/18/19. -// Copyright © 2019 GuestUser. All rights reserved. -// - -#ifndef IndyTypes_h -#define IndyTypes_h - -//typedef unsigned int indy_error_t; -//typedef unsigned int indy_handle_t; -typedef SInt32 IndyHandle; - - -#endif /* IndyTypes_h */ \ No newline at end of file diff --git a/wrappers/ios_legacy/vcx/utils/NSError+VcxError.m b/wrappers/ios_legacy/vcx/utils/NSError+VcxError.m index 2a88f0f13c..f14ca7f3d7 100644 --- a/wrappers/ios_legacy/vcx/utils/NSError+VcxError.m +++ b/wrappers/ios_legacy/vcx/utils/NSError+VcxError.m @@ -1,6 +1,5 @@ // // NSError+VcxError.m -// libindy // #import "NSError+VcxError.h" @@ -39,4 +38,4 @@ + (NSError*) errorFromVcxError:(vcx_error_t) error return [NSError errorWithDomain:VcxErrorDomain code: error userInfo:userInfo]; } -@end \ No newline at end of file +@end diff --git a/wrappers/ios_legacy/vcx/utils/VcxCallbacks.mm b/wrappers/ios_legacy/vcx/utils/VcxCallbacks.mm index bb4351a721..3c16c3a529 100644 --- a/wrappers/ios_legacy/vcx/utils/VcxCallbacks.mm +++ b/wrappers/ios_legacy/vcx/utils/VcxCallbacks.mm @@ -1,6 +1,5 @@ // // VcxCallbacks.m -// libindy // #import "VcxCallbacks.h" @@ -159,6 +158,5 @@ - (void)completeStringAndData:(void (^)(NSError *, NSString *, NSData *))complet @end -// MARK: - static indy C-callbacks diff --git a/wrappers/ios_legacy/vcx/vcx-demoTests/vcx_demoTests.m b/wrappers/ios_legacy/vcx/vcx-demoTests/vcx_demoTests.m index 901fa3898c..463d3edeaf 100644 --- a/wrappers/ios_legacy/vcx/vcx-demoTests/vcx_demoTests.m +++ b/wrappers/ios_legacy/vcx/vcx-demoTests/vcx_demoTests.m @@ -8,7 +8,6 @@ #import #import "RNIndyTests.h" -#import "IndyCallbacks.h" @interface vcx_demoTests : XCTestCase diff --git a/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.pbxproj b/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.pbxproj index a7832cb9e2..f318af2806 100644 --- a/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.pbxproj +++ b/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.pbxproj @@ -21,8 +21,6 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 8E1E709F221B653B00EF3CBB /* IndySdk.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1E709E221B653B00EF3CBB /* IndySdk.m */; }; - 8E1E70A7221B7B8C00EF3CBB /* IndyCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */; }; 8EFD49F922133FBF002E58D5 /* VcxLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EFD49F722133FBF002E58D5 /* VcxLogger.h */; }; 8EFD49FA22133FBF002E58D5 /* VcxLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EFD49F822133FBF002E58D5 /* VcxLogger.m */; }; 8EFD93C9220269BD00A0400A /* vcx.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2566EE209705E3002EBEBA /* vcx.framework */; }; @@ -107,11 +105,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 8E1E709E221B653B00EF3CBB /* IndySdk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IndySdk.m; sourceTree = ""; }; - 8E1E70A0221B659E00EF3CBB /* IndySdk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndySdk.h; sourceTree = ""; }; - 8E1E70A5221B77D100EF3CBB /* IndyTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndyTypes.h; sourceTree = ""; }; - 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IndyCallbacks.m; sourceTree = ""; }; - 8E1E70A8221B7BC100EF3CBB /* IndyCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IndyCallbacks.h; sourceTree = ""; }; 8EFD49F722133FBF002E58D5 /* VcxLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VcxLogger.h; sourceTree = ""; }; 8EFD49F822133FBF002E58D5 /* VcxLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VcxLogger.m; sourceTree = ""; }; 8EFD93CA22026CA400A0400A /* RNIndy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNIndy.m; sourceTree = ""; }; @@ -306,11 +299,6 @@ DD858CB820A4AF7B004B3CB5 /* VcxCallbacks.mm */, DD858CB720A4AF7B004B3CB5 /* VcxErrors.h */, DD858CB920A4AF7B004B3CB5 /* VcxTypes.h */, - 8E1E709E221B653B00EF3CBB /* IndySdk.m */, - 8E1E70A0221B659E00EF3CBB /* IndySdk.h */, - 8E1E70A5221B77D100EF3CBB /* IndyTypes.h */, - 8E1E70A6221B7B8C00EF3CBB /* IndyCallbacks.m */, - 8E1E70A8221B7BC100EF3CBB /* IndyCallbacks.h */, ); path = utils; sourceTree = ""; @@ -551,9 +539,7 @@ files = ( DD858CBE20A4AF7C004B3CB5 /* VcxCallbacks.mm in Sources */, DD858C9E20A45C11004B3CB5 /* ConnectMeVcx.m in Sources */, - 8E1E709F221B653B00EF3CBB /* IndySdk.m in Sources */, DD858CC120A4AF7C004B3CB5 /* NSError+VcxError.m in Sources */, - 8E1E70A7221B7B8C00EF3CBB /* IndyCallbacks.m in Sources */, 8EFD49FA22133FBF002E58D5 /* VcxLogger.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate b/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000..710e6fe2c5 Binary files /dev/null and b/wrappers/ios_legacy/vcx/vcx.xcodeproj/project.xcworkspace/xcuserdata/abps823.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/wrappers/ios_legacy/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist b/wrappers/ios_legacy/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000..9fb0187234 --- /dev/null +++ b/wrappers/ios_legacy/vcx/vcx.xcodeproj/xcuserdata/abps823.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,24 @@ + + + + + SchemeUserState + + vcx-demo.xcscheme_^#shared#^_ + + orderHint + 1 + + vcx-objc.xcscheme_^#shared#^_ + + orderHint + 2 + + vcx.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/wrappers/ios_legacy/vcx/vcx/vcx.h b/wrappers/ios_legacy/vcx/vcx/vcx.h index 5d3c85b8d6..3d4fcc66fc 100644 --- a/wrappers/ios_legacy/vcx/vcx/vcx.h +++ b/wrappers/ios_legacy/vcx/vcx/vcx.h @@ -18,6 +18,5 @@ FOUNDATION_EXPORT const unsigned char vcxVersionString[]; #import "ConnectMeVcx.h" #import "VcxLogger.h" -#import "IndySdk.h" #include "libvcx.h"