Skip to content

Commit

Permalink
Revert exposing new function
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <miroslavkovar@protonmail.com>
  • Loading branch information
mirgee committed Oct 9, 2020
1 parent 8b2ba49 commit ae1976e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 69 deletions.
38 changes: 0 additions & 38 deletions libvcx/src/api/disclosed_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<extern fn(xcommand_handle: CommandHandle, err: u32, requests: *const c_char)>) -> 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
Expand Down
23 changes: 0 additions & 23 deletions wrappers/node/src/api/disclosed-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,29 +295,6 @@ export class DisclosedProof extends VCXBaseWithState<IDisclosedProofData> {
return requests
}

public static async getRequestsV2 (connection: Connection, requestName: string): Promise<IDisclosedProofRequest[]> {
const requestsStr = await createFFICallbackPromise<string>(
(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
Expand Down
16 changes: 8 additions & 8 deletions wrappers/node/src/rustlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]],
Expand All @@ -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]],
Expand Down Expand Up @@ -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]],
Expand All @@ -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]],
Expand Down

0 comments on commit ae1976e

Please sign in to comment.