From ae1976e1a8e7aaf31a7c96d62d092aedba8e2b31 Mon Sep 17 00:00:00 2001 From: Miroslav Kovar Date: Fri, 9 Oct 2020 10:06:28 +0200 Subject: [PATCH] Revert exposing new function Signed-off-by: Miroslav Kovar --- libvcx/src/api/disclosed_proof.rs | 38 ------------------------ wrappers/node/src/api/disclosed-proof.ts | 23 -------------- wrappers/node/src/rustlib.ts | 16 +++++----- 3 files changed, 8 insertions(+), 69 deletions(-) diff --git a/libvcx/src/api/disclosed_proof.rs b/libvcx/src/api/disclosed_proof.rs index 81afa4f04b..01fcbde703 100644 --- a/libvcx/src/api/disclosed_proof.rs +++ b/libvcx/src/api/disclosed_proof.rs @@ -401,44 +401,6 @@ pub extern fn vcx_disclosed_proof_get_requests(command_handle: CommandHandle, error::SUCCESS.code_num } -#[no_mangle] -pub extern fn vcx_v2_disclosed_proof_get_requests(command_handle: CommandHandle, - connection_handle: u32, - request_name: *const c_char, - cb: Option) -> u32 { - info!("vcx_v2_disclosed_proof_get_requests >>>"); - - check_useful_opt_c_str!(request_name, VcxErrorKind::InvalidOption); - check_useful_c_callback!(cb, VcxErrorKind::InvalidOption); - - if !connection::is_valid_handle(connection_handle) { - return VcxError::from(VcxErrorKind::InvalidConnectionHandle).into(); - } - - trace!("vcx_disclosed_proof_get_requests(command_handle: {}, connection_handle: {})", - command_handle, connection_handle); - - spawn(move || { - match disclosed_proof::get_proof_request_messages(connection_handle, request_name.as_deref()) { - Ok(x) => { - trace!("vcx_v2_disclosed_proof_get_requests_cb(command_handle: {}, rc: {}, msg: {})", - command_handle, error::SUCCESS.message, x); - let msg = CStringUtils::string_to_cstring(x); - cb(command_handle, error::SUCCESS.code_num, msg.as_ptr()); - } - Err(x) => { - error!("vcx_v2_disclosed_proof_get_requests_cb(command_handle: {}, rc: {}, msg: {})", - command_handle, error::SUCCESS.message, x); - cb(command_handle, x.into(), ptr::null_mut()); - } - }; - - Ok(()) - }); - - error::SUCCESS.code_num -} - /// Get the current state of the disclosed proof object /// /// #Params diff --git a/wrappers/node/src/api/disclosed-proof.ts b/wrappers/node/src/api/disclosed-proof.ts index 5b9754bc33..e53ee1ffb6 100644 --- a/wrappers/node/src/api/disclosed-proof.ts +++ b/wrappers/node/src/api/disclosed-proof.ts @@ -295,29 +295,6 @@ export class DisclosedProof extends VCXBaseWithState { return requests } - public static async getRequestsV2 (connection: Connection, requestName: string): Promise { - const requestsStr = await createFFICallbackPromise( - (resolve, reject, cb) => { - const rc = rustAPI().vcx_v2_disclosed_proof_get_requests(0, connection.handle, requestName, cb) - if (rc) { - reject(rc) - } - }, - (resolve, reject) => Callback( - 'void', - ['uint32', 'uint32', 'string'], - (handle: number, err: number, messages: string) => { - if (err) { - reject(err) - return - } - resolve(messages) - }) - ) - const requests = JSON.parse(requestsStr) - return requests - } - protected _releaseFn = rustAPI().vcx_disclosed_proof_release protected _updateStFn = rustAPI().vcx_disclosed_proof_update_state protected _updateStFnV2 = rustAPI().vcx_v2_disclosed_proof_update_state diff --git a/wrappers/node/src/rustlib.ts b/wrappers/node/src/rustlib.ts index 7e6b84345c..62d4bd1fe7 100644 --- a/wrappers/node/src/rustlib.ts +++ b/wrappers/node/src/rustlib.ts @@ -79,7 +79,8 @@ export interface IFFIEntryPoint { vcx_wallet_get_token_info: (commandId: number, payment: number | undefined | null, cb: any) => number, vcx_wallet_create_payment_address: (commandId: number, seed: string | null, cb: any) => number, vcx_wallet_sign_with_address: (commandID: number, address: string, message: number, messageLen: number, cb: any) => number, - vcx_wallet_verify_with_address: (commandID: number, address: string, message: number, messageLen: number, signature: number, signatureLen: number, cb: any) => number, + vcx_wallet_verify_with_address: (commandID: number, address: string, message: number, messageLen: number, signature: number, + signatureLen: number, cb: any) => number, vcx_wallet_send_tokens: (commandId: number, payment: number, tokens: string, recipient: string, cb: any) => number, vcx_wallet_add_record: (commandId: number, type: string, id: string, value: string, tags: string, cb: any) => number, vcx_wallet_update_record_value: (commandId: number, type: string, id: string, value: string, cb: any) => number, @@ -180,8 +181,6 @@ export interface IFFIEntryPoint { cb: any) => number, vcx_disclosed_proof_get_state: (commandId: number, handle: number, cb: any) => number, vcx_disclosed_proof_get_requests: (commandId: number, connectionHandle: number, cb: any) => number, - vcx_v2_disclosed_proof_get_requests: (commandId: number, connectionHandle: number, requestName: string, - cb: any) => number, vcx_disclosed_proof_retrieve_credentials: (commandId: number, handle: number, cb: any) => number, vcx_disclosed_proof_generate_proof: (commandId: number, handle: number, selectedCreds: string, selfAttestedAttrs: string, cb: any) => number, @@ -325,7 +324,8 @@ export const FFIConfiguration: { [ Key in keyof IFFIEntryPoint ]: any } = { FFI_UNSIGNED_INT, FFI_CALLBACK_PTR]], vcx_connection_verify_signature: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_UNSIGNED_INT_PTR, FFI_UNSIGNED_INT, FFI_UNSIGNED_INT_PTR, FFI_UNSIGNED_INT, FFI_CALLBACK_PTR]], - vcx_connection_send_ping: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], + vcx_connection_send_ping: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, + FFI_CALLBACK_PTR]], vcx_connection_send_discovery_features: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_connection_get_pw_did: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR]], @@ -336,7 +336,8 @@ export const FFIConfiguration: { [ Key in keyof IFFIEntryPoint ]: any } = { vcx_issuer_credential_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_issuer_credential_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]], vcx_issuer_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]], - vcx_v2_issuer_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR]], + vcx_v2_issuer_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, + FFI_CALLBACK_PTR]], vcx_issuer_credential_update_state_with_message: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_issuer_credential_get_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]], @@ -393,8 +394,6 @@ export const FFIConfiguration: { [ Key in keyof IFFIEntryPoint ]: any } = { FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_disclosed_proof_get_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR]], vcx_disclosed_proof_get_requests: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR]], - vcx_v2_disclosed_proof_get_requests: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CONNECTION_HANDLE, FFI_STRING_DATA, - FFI_CALLBACK_PTR]], vcx_disclosed_proof_retrieve_credentials: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_CALLBACK_PTR]], vcx_disclosed_proof_generate_proof: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_PROOF_HANDLE, FFI_STRING_DATA, FFI_STRING_DATA, FFI_CALLBACK_PTR]], @@ -414,7 +413,8 @@ export const FFIConfiguration: { [ Key in keyof IFFIEntryPoint ]: any } = { vcx_credential_serialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]], vcx_credential_deserialize: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]], - vcx_v2_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, FFI_CALLBACK_PTR]], + vcx_v2_credential_update_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CONNECTION_HANDLE, + FFI_CALLBACK_PTR]], vcx_credential_update_state_with_message: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_STRING_DATA, FFI_CALLBACK_PTR]], vcx_credential_get_state: [FFI_ERROR_CODE, [FFI_COMMAND_HANDLE, FFI_CREDENTIAL_HANDLE, FFI_CALLBACK_PTR]],