Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8d3dd88
Implemented ledger commands
Artemkaaas May 18, 2017
d6f510b
delete serializer trait
Artemkaaas May 18, 2017
35a7910
Merge remote-tracking branch 'refs/remotes/upstream/master'
Artemkaaas May 18, 2017
79991f6
Merged branch feature/send_pool_open_ack_after_catchup into feature/l…
Artemkaaas May 18, 2017
bcfee9d
Added integration test
Artemkaaas May 19, 2017
4b67e5a
Deleted unwrap usage
Artemkaaas May 19, 2017
a1685e4
Correced ip
Artemkaaas May 19, 2017
bf330ad
Merge remote-tracking branch 'refs/remotes/upstream/master'
Artemkaaas May 19, 2017
c60d2e7
Fixed errors
Artemkaaas May 19, 2017
7d1934a
Merge remote-tracking branch 'refs/remotes/upstream/master'
Artemkaaas May 22, 2017
ecc07fa
Fix error for nym request
Artemkaaas May 22, 2017
e5915c9
Added ignor for not checked tests
Artemkaaas May 22, 2017
4a004b4
Merge remote-tracking branch 'refs/remotes/upstream/master'
Artemkaaas May 22, 2017
791559c
Fixed error
Artemkaaas May 22, 2017
8d291f2
Added unit tests for ledger service
Artemkaaas May 23, 2017
266585e
Corrected tests
Artemkaaas May 23, 2017
faf0331
fix error
Artemkaaas May 23, 2017
8141320
Remove redundant FIXME in ledger command about errors.
jovfer May 24, 2017
756bbab
* Agent to agent API draft was created
May 24, 2017
59d6a51
Merge branch 'master' into feature/agent-to-agent-api
May 24, 2017
5fad211
Remove From<GenTransaction> for RemoteNode, simplfy RemoteNode::new
jovfer May 24, 2017
e1f67a9
Make RemoteNode::connect method returning Result.
jovfer May 24, 2017
8015143
Add return Result to RemoteNode::send_* methods.
jovfer May 24, 2017
08aa2db
* Added sequence diagram that illustrates Agent 2 Agent communication…
May 24, 2017
da03a88
Merge branch 'feature/agent-to-agent-api' of github.com:vimmerru/sovr…
May 24, 2017
7219919
Remove runtime panic from services:pool::Pool.
jovfer May 24, 2017
e24c87b
* More detailed messages flow for connection establishing procedure
May 24, 2017
7228bca
* Formatting agent-2-agent sequence diagram
May 25, 2017
1b173c7
Merge pull request #14 from vimmerru/feature/agent-to-agent-api
May 25, 2017
c9ce0a9
Remove runtime panic from services:pool::PoolWorker.
jovfer May 25, 2017
d1a9d32
migrate feature/ios_wrapper from sovrin repository
cybermag May 25, 2017
e877af6
Remove runtime panic from PoolHandlers from appropriate service.
jovfer May 25, 2017
dede465
Remove runtime panic from catchup handler.
jovfer May 25, 2017
20e36f6
Update From implementation for PoolError.
jovfer May 25, 2017
2c5e1c6
Improve error handling in pool service.
jovfer May 25, 2017
89c3b9a
fix signature of sovrin_verifier_verify_proof() func
cybermag May 26, 2017
5734726
Merge branch 'master' into feature/refactor_pool_result_instead_panic
jovfer May 26, 2017
23c7341
added anoncreds test
cybermag May 26, 2017
75b4f7e
fix compile errors
cybermag May 29, 2017
056d6ce
Merge pull request #20 from cybermag/master
May 29, 2017
574a9e3
Merge branch 'master' into feature/refactor_pool_result_instead_panic
jovfer May 29, 2017
d6732b2
Merge pull request #17 from jovfer/feature/refactor_pool_result_inste…
May 30, 2017
381767a
Merged branch master into feature/ledger-commands
Artemkaaas May 31, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions doc/libsovrin-agent-2-agent.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
@startuml
skinparam ParticipantPadding 20
skinparam BoxPadding 20

title Libsovrin Agent to Agent communucation API
scale 0.9

box "Sender Agent" #LightBlue
actor "Sender Agent" as SA
participant "Sender Libsovrin" as SL
participant "Sender Wallet" as SW
participant "Sender Socket" as SS
endbox

box "Receiver Agent" #LightBlue
actor "Receiver Agent" as RA
participant "Receiver Libsovrin" as RL
participant "Receiver Wallet" as RW
participant "Receiver Socket" as RS
endbox

participant "Ledger" as L

=== Start listening ==

RA -> RL: <b>1. sovrin_create_and_store_my_did
RL -> RW: Store receiver keys

RA -> RL: <b>2. sovrin_agent_listen
RL -> RS: Start listening
RL -> RA: Listener handle (cb)

=== Establish connection ==

SA -> SL: <b>3. sovrin_create_and_store_my_did
SL -> SW: Store sender keys

SA -> SL: <b>4. sovrin_agent_connect
SL -> SW: Get sender keys
SW -> SL: Sender keys
SL -> L: GET_NYM/GET_DDO
L -> SL: Receiver keys and endpoint
SL -> SW: Store receiver keys and endpoint

SL -> SS: Receiver did, keys and endpoint. Sender did, keys

SS -> RS: PairwiseCurveCP Hello message
RS -> RL: Keys lookup request
RL -> RW: Get keys and did for request
RW -> RL: Receiver keys and did
RL -> RS: Receiver keys
RS -> SS: PairwiseCurveCP Welcome message

SS -> RS: Next PairwiseCurveCP handshake messages
RS -> SS: PairwiseCurveCP handshake messages answers

SS -> SL: PairwiseCurveCP connection established

SL -> SS: DID message
SS -> RS: DID message
RS -> RL: Sender did and public key
RL -> L: GET_NYM/GET_DDO
L -> RL: Sender keys and did (from Ledger)
RL -> RL: Connection verification
RL -> RS: DID message answer
RS -> SS: DID message answer
SS -> SL: DID message answer
SL -> SA: Connection handle (cb)
RL -> RA: Connection handle (cb)

=== Exchange messages ==

SA -> SL: <b>4. sovrin_agent_send
SL -> SS: Message
SS -> RS: Message
RS -> RL: Message
RL -> RA: Message (cb)

RA -> RL: <b>5. sovrin_agent_send
RL -> RS: Message
RS -> SS: Message
SS -> SL: Message
SL -> SA: Message (cb)

=== Clean up ==

SA -> SL: <b>5. sovrin_agent_close_connection
SL -> SS: Close socket

RA -> RL: <b>5. sovrin_agent_close_listener
RL -> RS: Close socket

@enduml
1 change: 0 additions & 1 deletion include/sovrin_anoncreds.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ extern "C" {


extern sovrin_error_t sovrin_verifier_verify_proof(sovrin_handle_t command_handle,
sovrin_handle_t wallet_handle,
const char * proof_request_json,
const char * proof_json,
const char * schemas_json,
Expand Down
5 changes: 4 additions & 1 deletion include/sovrin_mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ typedef enum

// IO error during access pool ledger files
PoolLedgerIOError,


// Pool ledger terminated
PoolLedgerTerminated,

// No concensus during ledger operation
LedgerNoConsensusError,

Expand Down
179 changes: 179 additions & 0 deletions src/api/agent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
extern crate libc;

use api::ErrorCode;
use errors::ToErrorCode;
use commands::{Command, CommandExecutor};
use utils::cstring::CStringUtils;

use self::libc::c_char;

/// Establishes agent to agent connection.
///
/// Information about sender Identity must be saved in the wallet with sovrin_create_and_store_my_did
/// call before establishing of connection.
///
/// Information about receiver Identity can be saved in the wallet with sovrin_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.
/// 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.
/// message_cb: Callback that will be called on receiving of an incomming 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.
#[no_mangle]
pub extern fn sovrin_agent_connect(command_handle: i32,
wallet_handle: i32,
sender_did: *const c_char,
receiver_did: *const c_char,
connection_cb: Option<extern fn(xcommand_handle: i32,
err: ErrorCode,
connection_handle: i32)>,
message_cb: Option<extern fn(xconnection_handle: i32,
err: ErrorCode,
message: *const c_char)>) -> ErrorCode {
unimplemented!()
}

/// Starts listening of agent connections.
///
/// On incomming connection listener performs wallet lookup to find corresponded receiver Identity
/// information. Information about receiver Identity must be saved in the wallet with
/// sovrin_create_and_store_my_did call before establishing of connection.
///
/// Information about sender Identity for incomming connection validation can be saved in the wallet
/// with sovrin_store_their_did call before establishing of connection. If there is no corresponded
/// wallet record for sender Identity than listener 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.
/// wallet_handle: wallet handle (created by open_wallet).
/// listener_cb: Callback that will be called after listening started or on error.
/// connection_cb: Callback that will be called after establishing of incomming connection.
/// message_cb: Callback that will be called on receiving of an incomming message.
///
/// #Returns
/// Error code
/// listener_cb:
/// - xcommand_handle: command handle to map callback to caller context.
/// - err: Error code
/// - listener_handle: Listener handle to use for mapping of incomming connections to this listener.
/// connection_cb:
/// - xlistener_handle: Listener handle. Identifies listener.
/// - err: Error code
/// - connection_handle: Connection handle to use for messages sending and mapping of incomming messages to to this connection.
/// - sender_did: Id of sender Identity stored in secured Wallet.
/// - receiver_did: Id of receiver Identity.
/// message_cb:
/// - xconnection_handle: Connection handle. Indetnifies connection.
/// - err: Error code.
/// - message: Received message.
#[no_mangle]
pub extern fn sovrin_agent_listen(command_handle: i32,
wallet_handle: i32,
listener_cb: Option<extern fn(xcommand_handle: i32,
err: ErrorCode,
listener_handle: i32)>,
connection_cb: Option<extern fn(xlistener_handle: i32,
err: ErrorCode,
connection_handle: i32,
sender_did: *const c_char,
receiver_did: *const c_char)>,
message_cb: Option<extern fn(xconnection_handle: i32,
err: ErrorCode,
message: *const c_char)>) -> ErrorCode {
unimplemented!()
}

/// Sends message to connected agent.
///
/// Note that this call works for both incoming and outgoing connections.
/// Note that messages encryption/decryption will be performed automatically.
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// connection_handle: Connection handle returned by sovrin_agent_connect or sovrin_agent_listen calls.
/// message: Message to send.
/// cb: Callback that will be called after message sent or on error.
///
/// #Returns
/// err: Error code
/// cb:
/// - xcommand_handle: Command handle to map callback to caller context.
/// - err: Error code
///
/// #Errors
#[no_mangle]
pub extern fn sovrin_agent_send(command_handle: i32,
connection_handle: i32,
message: *const c_char,
cb: Option<extern fn(xcommand_handle: i32,
err: ErrorCode)>) -> ErrorCode {
unimplemented!()
}

/// Closes agent connection.
///
/// Note that this call works for both incoming and outgoing connections.
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// connection_handle: Connection handle returned by sovrin_agent_connect or sovrin_agent_listen calls.
/// cb: Callback that will be called after connection closed or on error.
///
/// #Returns
/// Error code
/// cb:
/// - xcommand_handle: command handle to map callback to caller context.
/// - err: Error code
///
/// #Errors
#[no_mangle]
pub extern fn sovrin_agent_close_connection(command_handle: i32,
connection_handle: i32,
cb: Option<extern fn(xcommand_handle: i32,
err: ErrorCode)>) -> ErrorCode {
unimplemented!()
}

/// Closes listener and stops listening for agent connections.
///
/// Note that all opened incomming connections will be closed automatically.
///
/// #Params
/// command_handle: command handle to map callback to caller context.
/// listener_handle: Listener handle returned by sovrin_agent_listen call.
/// cb: Callback that will be called after listener closed or on error.
///
/// #Returns
/// Error code
/// cb:
/// - xcommand_handle: command handle to map callback to caller context.
/// - err: Error code
///
/// #Errors
#[no_mangle]
pub extern fn sovrin_agent_close_listener(command_handle: i32,
listener_handle: i32,
cb: Option<extern fn(xcommand_handle: i32,
err: ErrorCode)>) -> ErrorCode {
unimplemented!()
}
Loading