Function indy::api::agent::indy_agent_connect [] [src]

#[no_mangle]
pub extern "C" fn indy_agent_connect(
    command_handle: i32,
    pool_handle: i32,
    wallet_handle: i32,
    sender_did: *const c_char,
    receiver_did: *const c_char,
    connection_cb: Option<extern "C" fn(_: i32, _: ErrorCode, _: i32)>,
    message_cb: Option<extern "C" fn(_: i32, _: ErrorCode, _: *const c_char)>
) -> ErrorCode

Establishes agent to agent connection.

Information about sender Identity must be saved in the wallet with indy_create_and_store_my_did call before establishing of connection.

Information about receiver Identity can be saved in the wallet with indy_store_their_did call before establishing of connection. If there is no corresponded wallet record for receiver Identity than this call will lookup Identity Ledger and cache this information in the wallet.

Note that messages encryption/decryption will be performed automatically.

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). sender_did: Id of sender Identity stored in secured Wallet. receiver_did: Id of receiver Identity. connection_cb: Callback that will be called after establishing of connection or on error. Will be called exactly once with result of connect operation. message_cb: Callback that will be called on receiving of an incoming message. Can be called multiply times: once for each incoming message.

Returns

Error code connection_cb: - xcommand_handle: command handle to map callback to caller context. - err: Error code. - connection_handle: Connection handle to use for messages sending and mapping of incomming messages to this connection. message_cb: - xconnection_handle: Connection handle. Indetnifies connection. - err: Error code. - message: Received message.