From 1df11a935447df4c94babb40f4f2745bcbfb91aa Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 15 Feb 2019 15:14:02 +0300 Subject: [PATCH 01/21] Added threading minimal support Signed-off-by: artem.ivanov --- .../src/actors/agent_connection.rs | 51 ++-- vcx/dummy-cloud-agent/src/domain/payload.rs | 73 ++++-- vcx/libvcx/Cargo.lock | 1 + vcx/libvcx/Cargo.toml | 1 + vcx/libvcx/src/connection.rs | 52 ++-- vcx/libvcx/src/credential.rs | 36 ++- vcx/libvcx/src/disclosed_proof.rs | 139 +++++----- vcx/libvcx/src/issuer_credential.rs | 248 ++++++++++-------- vcx/libvcx/src/lib.rs | 2 + vcx/libvcx/src/messages/get_message.rs | 15 +- vcx/libvcx/src/messages/invite.rs | 23 +- vcx/libvcx/src/messages/mod.rs | 175 +----------- vcx/libvcx/src/messages/payload.rs | 227 ++++++++++++++++ .../src/messages/proofs/proof_request.rs | 4 +- vcx/libvcx/src/messages/send_message.rs | 10 +- vcx/libvcx/src/proof.rs | 53 +++- vcx/libvcx/src/utils/mod.rs | 1 + vcx/libvcx/src/utils/uuid.rs | 3 + 18 files changed, 657 insertions(+), 457 deletions(-) create mode 100644 vcx/libvcx/src/messages/payload.rs create mode 100644 vcx/libvcx/src/utils/uuid.rs diff --git a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs index e2f501f0df..069bea4a44 100644 --- a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs +++ b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs @@ -7,7 +7,7 @@ use domain::status::{ConnectionStatus, MessageStatusCode}; use domain::invite::{ForwardAgentDetail, InviteDetail, SenderDetail, AgentDetail}; use domain::internal_message::InternalMessage; use domain::key_deligation_proof::KeyDlgProof; -use domain::payload::{Payload, PayloadTypes, PayloadKinds}; +use domain::payload::{PayloadV1, PayloadV2, PayloadTypes, PayloadKinds, Thread}; use domain::protocol_type::{ProtocolType, ProtocolTypes}; use failure::{err_msg, Error, Fail}; use futures::*; @@ -803,15 +803,8 @@ impl AgentConnection { let msg_uid = msg_uid.to_string(); - let msg = ftry_act!(self, self.build_payload_message(RemoteMessageType::ConnReqAnswer, &json!({"senderDetail": msg_detail.sender_detail}))); - - future::ok(()) + self.build_payload_message(RemoteMessageType::ConnReqAnswer, &json!({"senderDetail": msg_detail.sender_detail})) .into_actor(self) - .and_then(move |_, slf, _| - crypto::auth_crypt(slf.wallet_handle, &slf.agent_pairwise_verkey, &slf.owner_verkey, &msg) - .map_err(|err| err.context("Can't encode Answer Payload.").into()) - .into_actor(slf) - ) .map(move |payload, slf, _| slf.state.messages.get_mut(&msg_uid) .map(|message| message.payload = Some(payload)) @@ -1136,19 +1129,43 @@ impl AgentConnection { Ok(message) } - fn build_payload_message(&self, type_: RemoteMessageType, msg: &T) -> Result, Error> where T: ::serde::Serialize + ::std::fmt::Debug { + fn build_payload_message(&self, type_: RemoteMessageType, msg: &T) -> ResponseFuture, Error> where T: ::serde::Serialize + ::std::fmt::Debug { trace!("AgentConnection::build_payload_message >> {:?}, {:?}", type_, msg); - let msg = rmp_serde::to_vec_named(&msg)?; + match ProtocolType::get() { + ProtocolTypes::V1 => { + let msg = ftry!(rmp_serde::to_vec_named(&msg));; - let payload_msg = Payload { - type_: PayloadTypes::build(PayloadKinds::from(type_)), - msg: to_i8(&msg) - }; + let payload_msg = PayloadV1 { + type_: PayloadTypes::build_v1(PayloadKinds::from(type_), "json"), + msg: to_i8(&msg) + }; + + let message = ftry!(rmp_serde::to_vec_named(&payload_msg)); + + crypto::auth_crypt(self.wallet_handle, &self.agent_pairwise_verkey, &self.owner_verkey, &message) + .map_err(|err| err.context("Can't encode Answer Payload.").into()) + .into_box() + }, + ProtocolTypes::V2 => { + let msg = ftry!(serde_json::to_string(&msg));; + + let payload_msg = PayloadV2 { + type_: PayloadTypes::build_v2(PayloadKinds::from(type_)), + id: String::new(), + msg, + thread: Thread::new(), + }; - rmp_serde::to_vec_named(&payload_msg) - .map_err(|err| err.into()) + let message = ftry!(serde_json::to_string(&payload_msg)); + let receiver_keys = ftry!(serde_json::to_string(&vec![&self.owner_verkey])); + + crypto::pack_message(self.wallet_handle, Some(&self.agent_pairwise_verkey), &receiver_keys, &message.as_bytes()) + .map_err(|err| err.context("Can't encode Answer Payload.").into()) + .into_box() + } + } } fn build_forward_message(&self, fwd: &str, message: Vec) -> Result, Error> { diff --git a/vcx/dummy-cloud-agent/src/domain/payload.rs b/vcx/dummy-cloud-agent/src/domain/payload.rs index 590478cf61..6d4e99bb2e 100644 --- a/vcx/dummy-cloud-agent/src/domain/payload.rs +++ b/vcx/dummy-cloud-agent/src/domain/payload.rs @@ -1,15 +1,34 @@ use domain::message_type::{MessageTypeV2, MessageFamilies, MESSAGE_VERSION_V1, MESSAGE_VERSION_V2, DID}; use domain::a2a::RemoteMessageType; use domain::protocol_type::{ProtocolType, ProtocolTypes}; +use std::collections::HashMap; #[derive(Deserialize, Serialize, Debug)] -pub struct Payload { +pub enum Payloads { + PayloadV1(PayloadV1), + PayloadV2(PayloadV2), +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct PayloadV1 { #[serde(rename = "@type")] - pub type_: PayloadTypes, + pub type_: PayloadTypeV1, #[serde(rename = "@msg")] pub msg: Vec, } +#[derive(Deserialize, Serialize, Debug)] +pub struct PayloadV2 { + #[serde(rename = "@type")] + pub type_: PayloadTypeV2, + #[serde(rename = "@id")] + pub id: String, + #[serde(rename = "@msg")] + pub msg: String, + #[serde(rename = "~thread")] + pub thread: Thread, +} + #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum PayloadTypes { @@ -76,23 +95,20 @@ impl PayloadKinds { } impl PayloadTypes { - pub fn build(kind: PayloadKinds) -> PayloadTypes { - match ProtocolType::get() { - ProtocolTypes::V1 => { - PayloadTypes::PayloadTypeV1(PayloadTypeV1 { - name: kind.name().to_string(), - ver: MESSAGE_VERSION_V1.to_string(), - fmt: "json".to_string(), - }) - } - ProtocolTypes::V2 => { - PayloadTypes::PayloadTypeV2(PayloadTypeV2 { - did: DID.to_string(), - family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), - type_: kind.name().to_string(), - }) - } + pub fn build_v1(kind: PayloadKinds, fmt: &str) -> PayloadTypeV1 { + PayloadTypeV1 { + name: kind.name().to_string(), + ver: MESSAGE_VERSION_V1.to_string(), + fmt: fmt.to_string(), + } + } + + pub fn build_v2(kind: PayloadKinds) -> PayloadTypeV2 { + PayloadTypeV2 { + did: DID.to_string(), + family: kind.family(), + version: MESSAGE_VERSION_V2.to_string(), + type_: kind.name().to_string(), } } } @@ -111,3 +127,22 @@ impl From for PayloadKinds { } } } + +#[derive(Debug, Deserialize, Serialize)] +pub struct Thread { + pub thid: Option, + pub pthid: Option, + pub sender_order: u32, + pub received_orders: HashMap, +} + +impl Thread { + pub fn new() -> Thread { + Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + } + } +} \ No newline at end of file diff --git a/vcx/libvcx/Cargo.lock b/vcx/libvcx/Cargo.lock index e62a84c391..15a369b6d9 100644 --- a/vcx/libvcx/Cargo.lock +++ b/vcx/libvcx/Cargo.lock @@ -589,6 +589,7 @@ dependencies = [ "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/vcx/libvcx/Cargo.toml b/vcx/libvcx/Cargo.toml index 0591a0edf0..c1ddfa4d98 100644 --- a/vcx/libvcx/Cargo.toml +++ b/vcx/libvcx/Cargo.toml @@ -52,6 +52,7 @@ log-panics = "2.0.0" tokio-threadpool = "0.1.6" futures = "0.1.23" libloading = "0.5.0" +uuid = {version = "0.7.1", default-features = false, features = ["v4"]} [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.5" diff --git a/vcx/libvcx/src/connection.rs b/vcx/libvcx/src/connection.rs index b0e22f866e..20443a3a8f 100644 --- a/vcx/libvcx/src/connection.rs +++ b/vcx/libvcx/src/connection.rs @@ -13,8 +13,9 @@ use settings; use messages::GeneralMessage; use messages; use messages::{MessageStatusCode, RemoteMessageType}; -use messages::invite::{InviteDetail, SenderDetail}; -use messages::get_message::{Message, Payload as MessagePayload}; +use messages::invite::{InviteDetail, SenderDetail, Payload as ConnectionPayload, AcceptanceDetails}; +use messages::payload::Payloads; +use messages::get_message::Message; use serde_json::Value; use utils::json::KeyMatch; use error::connection::ConnectionError; @@ -450,27 +451,34 @@ pub fn create_connection_with_invite(source_id: &str, details: &str) -> Result Result { debug!("connection {} parsing acceptance details for message {:?}", get_source_id(handle).unwrap_or_default(), message); let my_vk = settings::get_config_value(settings::CONFIG_SDK_TO_REMOTE_VERKEY)?; - let payload = messages::to_u8( - message.payload - .as_ref() - .ok_or(ConnectionError::CommonError(error::INVALID_MSGPACK.code_num))? - ); - // TODO: check returned verkey - let (_, payload) = crypto::parse_msg(&my_vk, &payload).map_err(|e| { ConnectionError::CommonError(e) })?; - - trace!("deserializing GetMsgResponse: {:?}", payload); - - let response: MessagePayload = rmp_serde::from_slice(&payload[..]) - .map_err(|err| { - error!("Could not parse outer msg: {}", err); - ConnectionError::CommonError(error::INVALID_MSGPACK.code_num) - })?; - - let payload = messages::to_u8(&response.msg); - // TODO: Refactor Error - let details = messages::invite::parse_invitation_acceptance_details(payload).map_err(|e| { ConnectionError::CommonError(e) })?; - Ok(details) + let payload = message.payload + .as_ref() + .ok_or(ConnectionError::CommonError(error::INVALID_MSGPACK.code_num))?; + + match settings::ProtocolTypes::from(settings::get_protocol_type()) { + settings::ProtocolTypes::V1 => { + let payload = messages::to_u8(&payload); + + // TODO: check returned verkey + let (_, payload) = crypto::parse_msg(&my_vk, &payload).map_err(|e| { ConnectionError::CommonError(e) })?; + + let response: ConnectionPayload = rmp_serde::from_slice(&payload[..]) + .map_err(|err| { + error!("Could not parse outer msg: {}", err); + ConnectionError::CommonError(error::INVALID_MSGPACK.code_num) + })?; + + let payload = messages::to_u8(&response.msg); + // TODO: Refactor Error + messages::invite::parse_invitation_acceptance_details(payload).map_err(|e| { ConnectionError::CommonError(e) }) + } + settings::ProtocolTypes::V2 => { + let (payload, _) = Payloads::decrypt_payload_v2(&my_vk, &payload)?; + let response: AcceptanceDetails = serde_json::from_str(&payload).or(Err(error::INVALID_JSON.code_num))?; + Ok(response.sender_detail) + } + } } pub fn update_state(handle: u32) -> Result { diff --git a/vcx/libvcx/src/credential.rs b/vcx/libvcx/src/credential.rs index 8cd596a28c..5cc55363f4 100644 --- a/vcx/libvcx/src/credential.rs +++ b/vcx/libvcx/src/credential.rs @@ -12,8 +12,8 @@ use issuer_credential::{CredentialOffer, CredentialMessage, PaymentInfo}; use credential_request::CredentialRequest; use messages; -use messages::GeneralMessage; -use messages::{RemoteMessageType, PayloadKinds}; +use messages::{GeneralMessage, RemoteMessageType}; +use messages::payload::{Payloads, PayloadKinds, Thread}; use utils::libindy::anoncreds::{libindy_prover_create_credential_req, libindy_prover_store_credential}; use utils::libindy::anoncreds; @@ -52,11 +52,11 @@ impl Default for Credential { credential: None, payment_info: None, payment_txn: None, + thread: Thread::new(), } } } - #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Credential { source_id: String, @@ -76,6 +76,7 @@ pub struct Credential { cred_id: Option, payment_info: Option, payment_txn: Option, + thread: Thread } impl Credential { @@ -89,8 +90,7 @@ impl Credential { let prover_did = self.my_did.as_ref().ok_or(CredentialError::CommonError(error::INVALID_DID.code_num))?; let credential_offer = self.credential_offer.as_ref().ok_or(CredentialError::InvalidCredentialJson())?; - let (cred_def_id, cred_def_json) = anoncreds::get_cred_def_json(&credential_offer.cred_def_id) - .map_err(|err| CredentialError::CommonError(err))?; + let (cred_def_id, cred_def_json) = anoncreds::get_cred_def_json(&credential_offer.cred_def_id)?; /* debug!("storing credential offer: {}", credential_offer); @@ -99,8 +99,7 @@ impl Credential { let (req, req_meta) = libindy_prover_create_credential_req(&prover_did, &credential_offer.libindy_offer, - &cred_def_json) - .map_err(|ec| CredentialError::CommonError(ec))?; + &cred_def_json)?; Ok(CredentialRequest { libindy_cred_req: req, @@ -161,7 +160,7 @@ impl Credential { .msg_type(&RemoteMessageType::CredReq)? .agent_did(local_agent_did)? .agent_vk(local_agent_vk)? - .edge_agent_payload(&local_my_vk, &local_their_vk, &cred_req_json, PayloadKinds::CredReq)? + .edge_agent_payload(&local_my_vk, &local_their_vk, &cred_req_json, PayloadKinds::CredReq, Some(self.thread.clone()))? .ref_msg_id(&offer_msg_id)? .send_secure() .map_err(|err| { @@ -186,7 +185,11 @@ impl Credential { let (_, payload) = messages::get_message::get_ref_msg(msg_uid, my_did, my_vk, agent_did, agent_vk)?; - let credential = messages::Payload::decrypted(&my_vk, &payload)?; + let (credential, thread) = Payloads::decrypt(&my_vk, &payload)?; + + if let Some(_) = thread { + self.thread.increment_receiver(self.their_did.as_ref().map(String::as_str).unwrap_or("")); + } let credential_msg: CredentialMessage = serde_json::from_str(&credential) .or(Err(error::INVALID_CREDENTIAL_JSON.code_num))?; @@ -448,11 +451,16 @@ pub fn get_credential_offer_msg(connection_handle: u32, msg_id: &str) -> Result< if message[0].msg_type == RemoteMessageType::CredOffer { let payload = message.get(0).and_then(|msg| msg.payload.as_ref()) .ok_or(CredentialError::CommonError(error::INVALID_MESSAGES.code_num))?; - let offer = messages::Payload::decrypted(&my_vk, &payload).map_err(|ec| CredentialError::CommonError(ec))?; + + let (offer, thread) = Payloads::decrypt(&my_vk, &payload).map_err(|ec| CredentialError::CommonError(ec))?; let (mut offer, payment_info) = parse_json_offer(&offer)?; offer.msg_ref_id = Some(message[0].uid.to_owned()); + + if let Some(tr) = thread { + offer.thread_id = tr.thid.clone(); + } let mut payload = Vec::new(); payload.push(json!(offer)); if let Some(p) = payment_info { payload.push(json!(p)); } @@ -485,11 +493,15 @@ pub fn get_credential_offer_messages(connection_handle: u32) -> Result, agent_did: Option, agent_vk: Option, + thread: Thread } #[derive(Debug, Deserialize, Serialize)] @@ -84,7 +87,7 @@ pub struct CredInfo { } fn credential_def_identifiers(credentials: &str, proof_req: &ProofRequestData) - -> Result, ProofError> { + -> Result, ProofError> { let mut rtn = Vec::new(); @@ -123,7 +126,7 @@ fn credential_def_identifiers(credentials: &str, proof_req: &ProofRequestData) tails_file, } ); - } else { return Err(ProofError::InvalidCredData()) } + } else { return Err(ProofError::InvalidCredData()); } } } @@ -131,18 +134,15 @@ fn credential_def_identifiers(credentials: &str, proof_req: &ProofRequestData) } fn _get_revocation_interval(attr_name: &str, proof_req: &ProofRequestData) - -> Result, ProofError> { - + -> Result, ProofError> { if let Some(ref attr) = proof_req.requested_attributes.get(attr_name) { - if let Some(ref interval) = attr.non_revoked { - return Ok(Some(NonRevokedInterval {from: interval.from, to: interval.to})) - } - else if let Some(ref interval) = proof_req.non_revoked { - return Ok(Some(NonRevokedInterval { from: interval.from, to: interval.to })) + return Ok(Some(NonRevokedInterval { from: interval.from, to: interval.to })); + } else if let Some(ref interval) = proof_req.non_revoked { + return Ok(Some(NonRevokedInterval { from: interval.from, to: interval.to })); } - return Ok(None) + return Ok(None); } // Todo: Handle case for predicates @@ -157,14 +157,12 @@ fn build_rev_states_json(credentials_identifiers: &mut Vec) -> Result< for cred_info in credentials_identifiers.iter_mut() { if let (Some(rev_reg_id), Some(cred_rev_id), Some(tails_file)) = (&cred_info.rev_reg_id, &cred_info.cred_rev_id, &cred_info.tails_file) { - if rtn.get(&rev_reg_id).is_none() { let (from, to) = if let Some(ref interval) = cred_info.revocation_interval - { (interval.from, interval.to) } - else { (None, None )}; + { (interval.from, interval.to) } else { (None, None) }; -// let from = from.unwrap_or(0); -// let to = to.unwrap_or(time::get_time().sec as u64); + // let from = from.unwrap_or(0); + // let to = to.unwrap_or(time::get_time().sec as u64); let cache = get_rev_reg_cache(&rev_reg_id); let (rev_state_json, timestamp) = if let Some(cached_rev_state) = cache.rev_state { @@ -175,7 +173,7 @@ fn build_rev_states_json(credentials_identifiers: &mut Vec) -> Result< let from = match from { Some(from) if from >= cached_rev_state.timestamp => { Some(cached_rev_state.timestamp) - }, + } _ => None }; @@ -256,12 +254,10 @@ fn build_rev_states_json(credentials_identifiers: &mut Vec) -> Result< } Ok(rtn.to_string()) - } impl DisclosedProof { - - fn set_proof_request(&mut self, req: ProofRequestMessage) {self.proof_request = Some(req)} + fn set_proof_request(&mut self, req: ProofRequestMessage) { self.proof_request = Some(req) } fn get_state(&self) -> u32 { trace!("DisclosedProof::get_state >>>"); @@ -274,7 +270,7 @@ impl DisclosedProof { fn retrieve_credentials(&self) -> Result { trace!("DisclosedProof::set_state >>>"); - if settings::test_indy_mode_enabled() {return Ok(CREDS_FROM_PROOF_REQ.to_string())} + if settings::test_indy_mode_enabled() { return Ok(CREDS_FROM_PROOF_REQ.to_string()); } let proof_req = self.proof_request .as_ref() @@ -293,7 +289,7 @@ impl DisclosedProof { for ref cred_info in credentials_identifiers { if rtn.get(&cred_info.schema_id).is_none() { let (_, schema_json) = anoncreds::get_schema_json(&cred_info.schema_id) - .or( Err(ProofError::InvalidSchema()))?; + .or(Err(ProofError::InvalidSchema()))?; let schema_json = serde_json::from_str(&schema_json) .or(Err(ProofError::InvalidSchema()))?; @@ -349,7 +345,7 @@ impl DisclosedProof { trace!("DisclosedProof::generate_proof >>> credentials: {}, self_attested_attrs: {}", credentials, self_attested_attrs); debug!("generating proof {}", self.source_id); - if settings::test_indy_mode_enabled() {return Ok(error::SUCCESS.code_num)} + if settings::test_indy_mode_enabled() { return Ok(error::SUCCESS.code_num); } let proof_req = self.proof_request.as_ref() .ok_or(ProofError::CreateProofError())?; @@ -369,10 +365,10 @@ impl DisclosedProof { let proof = anoncreds::libindy_prover_create_proof(&proof_req_data_json, &requested_credentials, - &self.link_secret_alias, + &self.link_secret_alias, &schemas_json, - &credential_defs_json, - Some(&revoc_states_json)).map_err(|ec| ProofError::CommonError(ec))?; + &credential_defs_json, + Some(&revoc_states_json)).map_err(|ec| ProofError::CommonError(ec))?; let mut proof_msg = ProofMessage::new(); proof_msg.libindy_proof = proof; self.proof = Some(proof_msg); @@ -414,26 +410,28 @@ impl DisclosedProof { false => { let proof: &ProofMessage = self.proof.as_ref().ok_or(ProofError::CreateProofError())?; serde_json::to_string(&proof).or(Err(ProofError::CommonError(error::INVALID_JSON.code_num)))? - }, + } true => DEFAULT_GENERATED_PROOF.to_string(), }; + self.thread.increment_receiver(self.their_did.as_ref().map(String::as_str).unwrap_or("")); + messages::send_message() .to(local_my_did)? .to_vk(local_my_vk)? .msg_type(&RemoteMessageType::Proof)? .agent_did(local_agent_did)? .agent_vk(local_agent_vk)? - .edge_agent_payload(&local_my_vk, &local_their_vk, &proof, PayloadKinds::Proof).or(Err(ProofError::ProofConnectionError()))? + .edge_agent_payload(&local_my_vk, &local_their_vk, &proof, PayloadKinds::Proof, Some(self.thread.clone())).or(Err(ProofError::ProofConnectionError()))? .ref_msg_id(ref_msg_uid)? .send_secure() - .map_err(|err|{ + .map_err(|err| { warn!("could not send proof: {}", err); err })?; self.state = VcxStateType::VcxStateAccepted; - return Ok(error::SUCCESS.code_num) + return Ok(error::SUCCESS.code_num); } fn set_source_id(&mut self, id: &str) { self.source_id = id.to_string(); } @@ -447,9 +445,9 @@ impl DisclosedProof { } fn from_str(s: &str) -> Result { trace!("DisclosedProof::from_str >>> data: {}", s); - let s:Value = serde_json::from_str(&s) + let s: Value = serde_json::from_str(&s) .or(Err(ProofError::InvalidJson()))?; - let proof: DisclosedProof= serde_json::from_value(s["data"].clone()) + let proof: DisclosedProof = serde_json::from_value(s["data"].clone()) .or(Err(ProofError::InvalidJson()))?; Ok(proof) } @@ -461,8 +459,7 @@ impl DisclosedProof { fn handle_err(code_num: u32) -> u32 { if code_num == error::INVALID_OBJ_HANDLE.code_num { error::INVALID_DISCLOSED_PROOF_HANDLE.code_num - } - else { + } else { code_num } } @@ -491,13 +488,13 @@ pub fn get_state(handle: u32) -> Result { // update_state is just the same as get_state for disclosed_proof pub fn update_state(handle: u32) -> Result { - HANDLE_MAP.get(handle, |obj|{ + HANDLE_MAP.get(handle, |obj| { Ok(obj.get_state()) }) } pub fn to_string(handle: u32) -> Result { - HANDLE_MAP.get(handle, |obj|{ + HANDLE_MAP.get(handle, |obj| { Ok(DisclosedProof::to_string(&obj)) }) } @@ -525,19 +522,19 @@ pub fn release_all() { } pub fn send_proof(handle: u32, connection_handle: u32) -> Result { - HANDLE_MAP.get_mut(handle, |obj|{ + HANDLE_MAP.get_mut(handle, |obj| { obj.send_proof(connection_handle).map_err(|e| e.to_error_code()) }).map_err(|ec| ProofError::CommonError(ec)) } pub fn generate_proof(handle: u32, credentials: String, self_attested_attrs: String) -> Result { - HANDLE_MAP.get_mut(handle, |obj|{ + HANDLE_MAP.get_mut(handle, |obj| { obj.generate_proof(&credentials, &self_attested_attrs).map_err(|e| e.to_error_code()) }).map_err(|ec| ProofError::CommonError(ec)) } pub fn retrieve_credentials(handle: u32) -> Result { - HANDLE_MAP.get_mut(handle, |obj|{ + HANDLE_MAP.get_mut(handle, |obj| { obj.retrieve_credentials().map_err(|e| e.to_error_code()) }).map_err(|ec| ProofError::CommonError(ec)) } @@ -566,10 +563,12 @@ pub fn get_proof_request(connection_handle: u32, msg_id: &str) -> Result = Default::default(); for msg in payload { - if msg.sender_did.eq(&my_did){ continue; } + if msg.sender_did.eq(&my_did) { continue; } if msg.msg_type == RemoteMessageType::ProofReq { let payload = msg.payload.ok_or(ProofError::CommonError(error::INVALID_HTTP_RESPONSE.code_num))?; - let req = messages::Payload::decrypted(&my_vk, &payload).map_err(|ec| ProofError::CommonError(ec))?; + let (req, thread) = Payloads::decrypt(&my_vk, &payload).map_err(|ec| ProofError::CommonError(ec))?; let mut req: ProofRequestMessage = serde_json::from_str(&req) .or(Err(ProofError::CommonError(error::INVALID_HTTP_RESPONSE.code_num)))?; req.msg_ref_id = Some(msg.uid.to_owned()); + req.thread_id = thread.and_then(|tr| tr.thid.clone()); messages.push(req); } } @@ -629,8 +629,8 @@ mod tests { use serde_json::Value; use utils::{ constants::{ ADDRESS_CRED_ID, LICENCE_CRED_ID, ADDRESS_SCHEMA_ID, - ADDRESS_CRED_DEF_ID, CRED_DEF_ID, SCHEMA_ID, ADDRESS_CRED_REV_ID, - ADDRESS_REV_REG_ID, REV_REG_ID, CRED_REV_ID, TEST_TAILS_FILE, REV_STATE_JSON }, + ADDRESS_CRED_DEF_ID, CRED_DEF_ID, SCHEMA_ID, ADDRESS_CRED_REV_ID, + ADDRESS_REV_REG_ID, REV_REG_ID, CRED_REV_ID, TEST_TAILS_FILE, REV_STATE_JSON }, get_temp_dir_path }; #[cfg(feature = "pool_tests")] @@ -661,7 +661,7 @@ mod tests { #[test] fn test_create_fails() { init!("true"); - assert_eq!(create_proof("1","{}").err(), + assert_eq!(create_proof("1", "{}").err(), Some(ProofError::CommonError(error::INVALID_JSON.code_num))); } @@ -672,7 +672,7 @@ mod tests { let connection_h = connection::tests::build_test_connection(); let requests = get_proof_request_messages(connection_h, None).unwrap(); - let requests:Value = serde_json::from_str(&requests).unwrap(); + let requests: Value = serde_json::from_str(&requests).unwrap(); let requests = serde_json::to_string(&requests[0]).unwrap(); let handle = create_proof("TEST_CREDENTIAL", &requests).unwrap(); @@ -682,20 +682,20 @@ mod tests { } #[test] - fn get_state_test(){ + fn get_state_test() { init!("true"); - let proof: DisclosedProof = Default::default(); + let proof: DisclosedProof = Default::default(); assert_eq!(VcxStateType::VcxStateNone as u32, proof.get_state()); - let handle = create_proof("id",::utils::constants::PROOF_REQUEST_JSON).unwrap(); + let handle = create_proof("id", ::utils::constants::PROOF_REQUEST_JSON).unwrap(); assert_eq!(VcxStateType::VcxStateRequestReceived as u32, get_state(handle).unwrap()) } #[test] fn to_string_test() { init!("true"); - let handle = create_proof("id",::utils::constants::PROOF_REQUEST_JSON).unwrap(); + let handle = create_proof("id", ::utils::constants::PROOF_REQUEST_JSON).unwrap(); let serialized = to_string(handle).unwrap(); - let j:Value = serde_json::from_str(&serialized).unwrap(); + let j: Value = serde_json::from_str(&serialized).unwrap(); assert_eq!(j["version"], "1.0"); DisclosedProof::from_str(&serialized).unwrap(); } @@ -703,7 +703,7 @@ mod tests { #[test] fn test_deserialize_fails() { assert_eq!(from_string("{}").err(), - Some(ProofError::CommonError(error::INVALID_JSON.code_num))); + Some(ProofError::CommonError(error::INVALID_JSON.code_num))); } #[test] @@ -943,7 +943,7 @@ mod tests { // All lower case let retrieved_creds = proof.retrieve_credentials().unwrap(); assert!(retrieved_creds.contains(r#""zip":"84000""#)); - let ret_creds_as_value:Value = serde_json::from_str(&retrieved_creds).unwrap(); + let ret_creds_as_value: Value = serde_json::from_str(&retrieved_creds).unwrap(); assert_eq!(ret_creds_as_value["attrs"]["zip_1"][0]["cred_info"]["attrs"]["zip"], "84000"); // First letter upper req["requested_attributes"]["zip_1"]["name"] = json!("Zip"); @@ -992,7 +992,7 @@ mod tests { tails_file: None, timestamp: None, }; - let selected_credentials : Value = json!({ + let selected_credentials: Value = json!({ "attrs":{ "height_1":{ "credential": { @@ -1062,7 +1062,7 @@ mod tests { assert_eq!(credential_def_identifiers(r#"{"attrs":{}}"#, &proof_req_no_interval()), Ok(Vec::new())); // missing cred info - let selected_credentials : Value = json!({ + let selected_credentials: Value = json!({ "attrs":{ "height_1":{ "interval":null } }, @@ -1073,7 +1073,7 @@ mod tests { assert_eq!(credential_def_identifiers(&selected_credentials.to_string(), &proof_req_no_interval()), Err(ProofError::InvalidCredData())); // Optional Revocation - let mut selected_credentials : Value = json!({ + let mut selected_credentials: Value = json!({ "attrs":{ "height_1":{ "credential": { @@ -1114,7 +1114,7 @@ mod tests { assert_eq!(&credential_def_identifiers(&selected_credentials.to_string(), &proof_req_no_interval()).unwrap(), &creds); // Missing schema ID - let mut selected_credentials : Value = json!({ + let mut selected_credentials: Value = json!({ "attrs":{ "height_1":{ "credential": { @@ -1177,7 +1177,7 @@ mod tests { proof.link_secret_alias = "main".to_string(); let all_creds: Value = serde_json::from_str(&proof.retrieve_credentials().unwrap()).unwrap(); - let selected_credentials : Value = json!({ + let selected_credentials: Value = json!({ "attrs":{ "address1_1": { "credential": all_creds["attrs"]["address1_1"][0], @@ -1222,7 +1222,7 @@ mod tests { }).to_string(); proof_req.proof_request_data = serde_json::from_str(&indy_proof_req).unwrap(); - let selected_credentials : Value = json!({}); + let selected_credentials: Value = json!({}); let self_attested: Value = json!({ "address1_1":"attested_address", @@ -1397,7 +1397,7 @@ mod tests { rev_reg_id: rev_reg_id.clone(), cred_rev_id: cred_rev_id, tails_file: Some(get_temp_dir_path(Some(TEST_TAILS_FILE)).to_str().unwrap().to_string()), - revocation_interval: Some(NonRevokedInterval{from: Some(cached_timestamp + 1), to: None}), + revocation_interval: Some(NonRevokedInterval { from: Some(cached_timestamp + 1), to: None }), timestamp: None, }; let rev_reg_id = rev_reg_id.unwrap(); @@ -1452,7 +1452,7 @@ mod tests { rev_reg_id: rev_reg_id.clone(), cred_rev_id: cred_rev_id, tails_file: Some(get_temp_dir_path(Some(TEST_TAILS_FILE)).to_str().unwrap().to_string()), - revocation_interval: Some(NonRevokedInterval{from: None, to: Some(cached_timestamp - 1)}), + revocation_interval: Some(NonRevokedInterval { from: None, to: Some(cached_timestamp - 1) }), timestamp: None, }; let rev_reg_id = rev_reg_id.unwrap(); @@ -1489,7 +1489,6 @@ mod tests { #[test] fn test_get_credential_intervals_from_proof_req() { - let proof_req = json!({ "nonce": "123432421212", "name": "proof_req_1", @@ -1510,11 +1509,11 @@ mod tests { assert_eq!(_get_revocation_interval("not here", &proof_req), Err(ProofError::InvalidCredData())); // attribute interval overrides proof request interval - let interval = Some(NonRevokedInterval {from: Some(123), to: Some(456)}); + let interval = Some(NonRevokedInterval { from: Some(123), to: Some(456) }); assert_eq!(_get_revocation_interval("address1_1", &proof_req), Ok(interval)); // when attribute interval is None, defaults to proof req interval - let interval = Some(NonRevokedInterval {from: Some(098), to: Some(123)}); + let interval = Some(NonRevokedInterval { from: Some(098), to: Some(123) }); assert_eq!(_get_revocation_interval("zip_2", &proof_req), Ok(interval)); // No interval provided for attribute or proof req diff --git a/vcx/libvcx/src/issuer_credential.rs b/vcx/libvcx/src/issuer_credential.rs index afa411cb40..c77d36f6d1 100644 --- a/vcx/libvcx/src/issuer_credential.rs +++ b/vcx/libvcx/src/issuer_credential.rs @@ -6,9 +6,8 @@ use std::collections::HashMap; use api::VcxStateType; use messages; use settings; -use messages::{RemoteMessageType, PayloadKinds}; -use messages::MessageStatusCode; -use messages::{GeneralMessage}; +use messages::{RemoteMessageType, MessageStatusCode, GeneralMessage}; +use messages::payload::{Payloads, PayloadKinds, Thread}; use connection; use credential_request::CredentialRequest; use utils::error; @@ -24,7 +23,7 @@ use serde_json::Value; use object_cache::ObjectCache; lazy_static! { - static ref ISSUER_CREDENTIAL_MAP: ObjectCache = Default::default(); +static ref ISSUER_CREDENTIAL_MAP: ObjectCache < IssuerCredential > = Default::default(); } static CREDENTIAL_OFFER_ID_KEY: &str = "claim_offer_id"; @@ -57,27 +56,36 @@ pub struct IssuerCredential { price: u64, payment_address: Option, // the following 6 are pulled from the connection object - agent_did: String, //agent_did for this relationship + agent_did: String, + //agent_did for this relationship agent_vk: String, - issued_did: String, //my_pw_did for this relationship + issued_did: String, + //my_pw_did for this relationship issued_vk: String, - remote_did: String, //their_pw_did for this relationship + remote_did: String, + //their_pw_did for this relationship remote_vk: String, + thread: Thread } #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct CredentialOffer { pub msg_type: String, - pub version: String, //vcx version of cred_offer - pub to_did: String, //their_pw_did for this relationship - pub from_did: String, //my_pw_did for this relationship + pub version: String, + //vcx version of cred_offer + pub to_did: String, + //their_pw_did for this relationship + pub from_did: String, + //my_pw_did for this relationship pub libindy_offer: String, pub cred_def_id: String, - pub credential_attrs: serde_json::Map, //promised attributes revealed in credential + pub credential_attrs: serde_json::Map, + //promised attributes revealed in credential pub schema_seq_no: u32, pub claim_name: String, pub claim_id: String, pub msg_ref_id: Option, + pub thread_id: Option, } #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -155,10 +163,8 @@ impl IssuerCredential { }; payload.push(cred_json); - let payload = match serde_json::to_string(&payload) { - Ok(p) => p, - Err(_) => return Err(IssuerCredError::CommonError(error::INVALID_JSON.code_num)) - }; + + let payload = serde_json::to_string(&payload).or(Err(IssuerCredError::CommonError(error::INVALID_JSON.code_num)))?; debug!("credential offer data: {}", payload); @@ -167,7 +173,7 @@ impl IssuerCredential { .to(&self.issued_did)? .to_vk(&self.issued_vk)? .msg_type(&RemoteMessageType::CredOffer)? - .edge_agent_payload(&self.issued_vk, &self.remote_vk, &payload, PayloadKinds::CredOffer)? + .edge_agent_payload(&self.issued_vk, &self.remote_vk, &payload, PayloadKinds::CredOffer, Some(self.thread.clone()))? .agent_did(&self.agent_did)? .agent_vk(&self.agent_vk)? .set_title(&title)? @@ -182,6 +188,7 @@ impl IssuerCredential { self.msg_uid = response.get_msg_uid()?; self.state = VcxStateType::VcxStateOfferSent; self.credential_offer = Some(credential_offer); + debug!("sent credential offer for: {}", self.source_id); return Ok(error::SUCCESS.code_num); } @@ -214,12 +221,14 @@ impl IssuerCredential { let cred_req_msg_id = self.credential_request.as_ref().and_then(|cred_req| cred_req.msg_ref_id.as_ref()) .ok_or(IssuerCredError::InvalidCredRequest())?; + self.thread.sender_order += 1; + let response = messages::send_message() .to(&self.issued_did)? .to_vk(&self.issued_vk)? .msg_type(&RemoteMessageType::Cred)? .status_code(&MessageStatusCode::Accepted)? - .edge_agent_payload(&self.issued_vk, &self.remote_vk, &data, PayloadKinds::Cred)? + .edge_agent_payload(&self.issued_vk, &self.remote_vk, &data, PayloadKinds::Cred, Some(self.thread.clone()))? .agent_did(&self.agent_did)? .agent_vk(&self.agent_vk)? .ref_msg_id(cred_req_msg_id)? @@ -231,6 +240,7 @@ impl IssuerCredential { self.msg_uid = response.get_msg_uid()?; self.state = VcxStateType::VcxStateAccepted; + debug!("issued credential: {}", self.source_id); return Ok(error::SUCCESS.code_num); } @@ -245,7 +255,8 @@ impl IssuerCredential { debug!("updating state for credential offer: {} msg_uid: {:?}", self.source_id, self.msg_uid); if self.state == VcxStateType::VcxStateRequestReceived { return Ok(self.get_state()); - } else if self.state != VcxStateType::VcxStateOfferSent || self.msg_uid.is_empty() || self.issued_did.is_empty() { + } + if self.state != VcxStateType::VcxStateOfferSent || self.msg_uid.is_empty() || self.issued_did.is_empty() { return Ok(self.get_state()); } let (offer_uid, payload) = messages::get_message::get_ref_msg(&self.msg_uid, @@ -255,10 +266,14 @@ impl IssuerCredential { &self.agent_vk) .map_err(|wc| IssuerCredError::CommonError(wc))?; - let payload = messages::Payload::decrypted(&self.issued_vk, &payload).map_err(|ec| IssuerCredError::CommonError(ec))?; + let (payload, thread) = Payloads::decrypt(&self.issued_vk, &payload).map_err(|ec| IssuerCredError::CommonError(ec))?; + let cred_req = parse_credential_req_payload(offer_uid, payload)?; - self.credential_request = Some(parse_credential_req_payload(offer_uid, payload)?); - + if let Some(tr) = thread { + self.thread.increment_receiver(self.remote_did.as_str()); + } + + self.credential_request = Some(cred_req); debug!("received credential request for credential offer: {}", self.source_id); self.state = VcxStateType::VcxStateRequestReceived; Ok(self.get_state()) @@ -306,12 +321,9 @@ impl IssuerCredential { claim_offer_id: self.msg_uid.clone(), from_did: String::from(did), version: String::from("0.1"), - msg_type: String::from("CRED"), + msg_type: PayloadKinds::Cred.name().to_string(), libindy_cred: cred, - rev_reg_def_json: match self.rev_reg_def_json { - Some(_) => self.rev_reg_def_json.clone().unwrap(), - None => String::new(), - }, + rev_reg_def_json: self.rev_reg_def_json.clone().unwrap_or(String::new()), cred_def_id: self.cred_def_id.clone(), cred_revoc_id, revoc_reg_delta_json, @@ -324,7 +336,7 @@ impl IssuerCredential { let libindy_offer = anoncreds::libindy_issuer_create_credential_offer(&self.cred_def_id) .map_err(|err| IssuerCredError::CommonError(err))?; Ok(CredentialOffer { - msg_type: String::from("CRED_OFFER"), + msg_type: PayloadKinds::CredOffer.name().to_string(), version: String::from("0.1"), to_did: to_did.to_string(), from_did: self.issued_did.clone(), @@ -335,6 +347,7 @@ impl IssuerCredential { msg_ref_id: None, cred_def_id: self.cred_def_id.clone(), libindy_offer, + thread_id: None, }) } @@ -403,7 +416,7 @@ impl IssuerCredential { pub fn to_string(&self) -> String { json!({ "version": DEFAULT_SERIALIZE_VERSION, - "data": json!(self), + "data": json ! ( self), }).to_string() } @@ -470,7 +483,6 @@ pub fn encode_attributes(attributes: &str) -> Result { // new style input such as {"address2":"101 Wilson Lane"} serde_json::Value::String(str_type) => str_type, - // anything else is an error _ => { warn!("Invalid Json for Attribute data"); @@ -480,9 +492,9 @@ pub fn encode_attributes(attributes: &str) -> Result { let encoded = encode(&first_attr).map_err(|x| IssuerCredError::CommonError(x))?; let attrib_values = json!({ - "raw" : first_attr, - "encoded": encoded - }); +"raw": first_attr, +"encoded": encoded +}); dictionary.insert(attr, attrib_values); } @@ -524,6 +536,7 @@ fn parse_credential_req_payload(offer_uid: String, payload: String) -> Result) -> Result, u32> { @@ -238,15 +236,6 @@ impl GeneralMessage for GetMessagesBuilder { } } -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Payload { - #[serde(rename = "@type")] - msg_type: PayloadTypes, - #[serde(rename = "@msg")] - pub msg: Vec, -} - #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[serde(rename_all = "camelCase")] pub struct DeliveryDetails { @@ -320,7 +309,7 @@ pub fn get_ref_msg(msg_id: &str, pw_did: &str, pw_vk: &str, agent_did: &str, age _ => return Err(error::NOT_READY.code_num), }; - let message = get_connection_messages(pw_did, pw_vk, agent_did, agent_vk, Some(vec![msg_id]))?; + let message: Vec = get_connection_messages(pw_did, pw_vk, agent_did, agent_vk, Some(vec![msg_id]))?; trace!("checking for pending message: {:?}", message); diff --git a/vcx/libvcx/src/messages/invite.rs b/vcx/libvcx/src/messages/invite.rs index c3f9da2739..677ad5cd47 100644 --- a/vcx/libvcx/src/messages/invite.rs +++ b/vcx/libvcx/src/messages/invite.rs @@ -476,15 +476,24 @@ impl GeneralMessage for AcceptInviteBuilder { } } -pub fn parse_invitation_acceptance_details(payload: Vec) -> Result { - #[serde(rename_all = "camelCase")] - #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] - struct Details { - sender_detail: SenderDetail, - } +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Payload { + #[serde(rename = "@type")] + msg_type: ::messages::payload::PayloadTypes, + #[serde(rename = "@msg")] + pub msg: Vec, +} +#[serde(rename_all = "camelCase")] +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +pub struct AcceptanceDetails { + pub sender_detail: SenderDetail, +} + +pub fn parse_invitation_acceptance_details(payload: Vec) -> Result { debug!("parsing invitation acceptance details: {:?}", payload); - let response: Details = rmp_serde::from_slice(&payload[..]).or(Err(error::INVALID_MSGPACK.code_num))?; + let response: AcceptanceDetails = rmp_serde::from_slice(&payload[..]).or(Err(error::INVALID_MSGPACK.code_num))?; Ok(response.sender_detail) } diff --git a/vcx/libvcx/src/messages/mod.rs b/vcx/libvcx/src/messages/mod.rs index 0a7eb8c811..58c9cdef92 100644 --- a/vcx/libvcx/src/messages/mod.rs +++ b/vcx/libvcx/src/messages/mod.rs @@ -9,6 +9,7 @@ pub mod agent_utils; pub mod update_connection; pub mod update_message; pub mod message_type; +pub mod payload; use std::u8; use settings; @@ -30,7 +31,6 @@ use self::message_type::*; use serde::{de, Deserialize, Deserializer, ser, Serialize, Serializer}; use serde_json::Value; -use std::collections::HashMap; #[derive(Debug, Serialize)] #[serde(untagged)] @@ -563,90 +563,6 @@ impl<'de> Deserialize<'de> for RemoteMessageType { } } - -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] -#[serde(untagged)] -pub enum PayloadTypes { - PayloadTypeV1(PayloadTypeV1), - PayloadTypeV2(PayloadTypeV2), -} - -#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] -pub struct PayloadTypeV1 { - name: String, - ver: String, - fmt: String, -} - -type PayloadTypeV2 = MessageTypeV2; - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub enum PayloadKinds { - CredOffer, - CredReq, - Cred, - Proof, - ProofRequest, - Other(String) -} - -impl PayloadKinds { - fn family(&self) -> MessageFamilies { - match self { - PayloadKinds::CredOffer => MessageFamilies::CredentialExchange, - PayloadKinds::CredReq => MessageFamilies::CredentialExchange, - PayloadKinds::Cred => MessageFamilies::CredentialExchange, - PayloadKinds::Proof => MessageFamilies::CredentialExchange, - PayloadKinds::ProofRequest => MessageFamilies::CredentialExchange, - PayloadKinds::Other(family) => MessageFamilies::Unknown(family.to_string()), - } - } - - fn name<'a>(&'a self) -> &'a str { - match settings::get_protocol_type() { - settings::ProtocolTypes::V1 => { - match self { - PayloadKinds::CredOffer => "CRED_OFFER", - PayloadKinds::CredReq => "CRED_REQ", - PayloadKinds::Cred => "CRED", - PayloadKinds::ProofRequest => "PROOF_REQUEST", - PayloadKinds::Proof => "PROOF", - PayloadKinds::Other(kind) => kind, - } - } - settings::ProtocolTypes::V2 => { - match self { - PayloadKinds::CredOffer => "credential-offer", - PayloadKinds::CredReq => "credential-request", - PayloadKinds::Cred => "credential", - PayloadKinds::ProofRequest => "presentation-request", - PayloadKinds::Proof => "presentation", - PayloadKinds::Other(kind) => kind, - } - } - } - } -} - -impl PayloadTypes { - pub fn build_v1(kind: PayloadKinds, fmt: &str) -> PayloadTypes { - PayloadTypes::PayloadTypeV1(PayloadTypeV1 { - name: kind.name().to_string(), - ver: MESSAGE_VERSION_V1.to_string(), - fmt: fmt.to_string(), - }) - } - - pub fn build_v2(kind: PayloadKinds) -> PayloadTypes { - PayloadTypes::PayloadTypeV2(PayloadTypeV2 { - did: DID.to_string(), - family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), - type_: kind.name().to_string(), - }) - } -} - #[derive(Clone, Debug, PartialEq)] pub enum MessageStatusCode { Created, @@ -780,14 +696,6 @@ impl A2AMessageKinds { } } -#[derive(Debug, Deserialize, Serialize, PartialEq)] -pub struct Thread { - pub thid: String, - pub pthid: Option, - pub sender_order: u32, - pub received_orders: Option>, -} - pub fn prepare_message_for_agency(message: &A2AMessage, agency_did: &str) -> Result, u32> { match settings::get_protocol_type() { settings::ProtocolTypes::V1 => bundle_for_agency_v1(message, &agency_did), @@ -907,87 +815,6 @@ pub fn bundle_from_u8(data: Vec) -> Result>, u32> { }) } -#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] -pub struct Payload { - #[serde(rename = "@type")] - pub type_: PayloadTypes, - #[serde(rename = "@msg")] - pub msg: String, -} - -impl Payload { - // TODO: Refactor Error - // this will become a CommonError, because multiple types (Connection/Issuer Credential) use this function - // Possibly this function moves out of this file. - // On second thought, this should stick as a ConnectionError. - pub fn encrypted(my_vk: &str, their_vk: &str, data: &str, msg_type: PayloadKinds) -> Result, u32> { - match settings::ProtocolTypes::from(settings::get_protocol_type()) { - settings::ProtocolTypes::V1 => { - let payload = ::messages::Payload { - type_: PayloadTypes::build_v1(msg_type, "json"), - msg: data.to_string(), - }; - - let bytes = rmp_serde::to_vec_named(&payload) - .map_err(|err| { - error!("could not encode create_keys msg: {}", err); - error::INVALID_MSGPACK.code_num - })?; - - trace!("Sending payload: {:?}", bytes); - ::utils::libindy::crypto::prep_msg(&my_vk, &their_vk, &bytes) - } - settings::ProtocolTypes::V2 => { - let payload = ::messages::Payload { - type_: PayloadTypes::build_v2(msg_type), - msg: data.to_string(), - }; - - let message = serde_json::to_string(&payload) - .map_err(|err| { - error!("could not serialize create_keys msg: {}", err); - error::INVALID_MSGPACK.code_num - })?; - - let receiver_keys = serde_json::to_string(&vec![&their_vk]).or(Err(error::SERIALIZATION_ERROR.code_num))?; - - trace!("Sending payload: {:?}", message.as_bytes()); - ::utils::libindy::crypto::pack_message(Some(my_vk), &receiver_keys, message.as_bytes()) - } - } - } - - pub fn decrypted(my_vk: &str, payload: &Vec) -> Result { - match settings::ProtocolTypes::from(settings::get_protocol_type()) { - settings::ProtocolTypes::V1 => { - let (_, data) = crypto::parse_msg(&my_vk, &to_u8(payload))?; - - let my_payload: Payload = rmp_serde::from_slice(&data[..]) - .map_err(|err| { - error!("could not deserialize bundle with i8 or u8: {}", err); - error::INVALID_MSGPACK.code_num - })?; - Ok(my_payload.msg) - } - settings::ProtocolTypes::V2 => { - let unpacked_msg = crypto::unpack_message(&to_u8(payload))?; - - let message: Value = ::serde_json::from_slice(unpacked_msg.as_slice()) - .or(Err(error::INVALID_JSON.code_num))?; - - let message = message["message"].as_str().ok_or(error::INVALID_JSON.code_num)?.to_string(); - - let my_payload: Payload = serde_json::from_str(&message) - .map_err(|err| { - error!("could not deserialize bundle with i8 or u8: {}", err); - error::INVALID_MSGPACK.code_num - })?; - Ok(my_payload.msg) - } - } - } -} - fn prepare_forward_message(message: Vec, did: &str) -> Result, u32> { let agency_vk = settings::get_config_value(settings::CONFIG_AGENCY_VERKEY)?; diff --git a/vcx/libvcx/src/messages/payload.rs b/vcx/libvcx/src/messages/payload.rs new file mode 100644 index 0000000000..62c045ba78 --- /dev/null +++ b/vcx/libvcx/src/messages/payload.rs @@ -0,0 +1,227 @@ +use messages::message_type::*; +use messages::to_u8; +use settings::{ProtocolTypes, get_protocol_type}; +use utils::error; +use utils::libindy::crypto; + +use std::collections::HashMap; + +#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] +pub enum Payloads { + PayloadV1(PayloadV1), + PayloadV2(PayloadV2), +} + +#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] +pub struct PayloadV1 { + #[serde(rename = "@type")] + pub type_: PayloadTypeV1, + #[serde(rename = "@msg")] + pub msg: String, +} + +#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] +pub struct PayloadV2 { + #[serde(rename = "@type")] + pub type_: PayloadTypeV2, + #[serde(rename = "@id")] + pub id: String, + #[serde(rename = "@msg")] + pub msg: String, + #[serde(rename = "~thread")] + pub thread: Thread, +} + +impl Payloads { + // TODO: Refactor Error + // this will become a CommonError, because multiple types (Connection/Issuer Credential) use this function + // Possibly this function moves out of this file. + // On second thought, this should stick as a ConnectionError. + pub fn encrypt(my_vk: &str, their_vk: &str, data: &str, msg_type: PayloadKinds, thread: Option) -> Result, u32> { + match ProtocolTypes::from(get_protocol_type()) { + ProtocolTypes::V1 => { + let payload = PayloadV1 { + type_: PayloadTypes::build_v1(msg_type, "json"), + msg: data.to_string(), + }; + + let bytes = rmp_serde::to_vec_named(&payload) + .map_err(|err| { + error!("could not encode create_keys msg: {}", err); + error::INVALID_MSGPACK.code_num + })?; + + trace!("Sending payload: {:?}", bytes); + crypto::prep_msg(&my_vk, &their_vk, &bytes) + } + ProtocolTypes::V2 => { + let thread = thread.ok_or(error::INVALID_CONNECTION_HANDLE.code_num)?; + + let payload = PayloadV2 { + type_: PayloadTypes::build_v2(msg_type), + id: String::new(), + msg: data.to_string(), + thread, + }; + + let message = ::serde_json::to_string(&payload) + .map_err(|err| { + error!("could not serialize create_keys msg: {}", err); + error::INVALID_MSGPACK.code_num + })?; + + let receiver_keys = ::serde_json::to_string(&vec![&their_vk]).or(Err(error::SERIALIZATION_ERROR.code_num))?; + + trace!("Sending payload: {:?}", message.as_bytes()); + crypto::pack_message(Some(my_vk), &receiver_keys, message.as_bytes()) + } + } + } + + pub fn decrypt(my_vk: &str, payload: &Vec) -> Result<(String, Option), u32> { + match ProtocolTypes::from(get_protocol_type()) { + ProtocolTypes::V1 => { + let (_, data) = crypto::parse_msg(&my_vk, &to_u8(payload))?; + + let my_payload: PayloadV1 = rmp_serde::from_slice(&data[..]) + .map_err(|err| { + error!("could not deserialize bundle with i8 or u8: {}", err); + error::INVALID_MSGPACK.code_num + })?; + Ok((my_payload.msg, None)) + } + ProtocolTypes::V2 => { + Payloads::decrypt_payload_v2(my_vk, payload) + } + } + } + + pub fn decrypt_payload_v2(my_vk: &str, payload: &Vec) -> Result<(String, Option), u32> { + let unpacked_msg = crypto::unpack_message(&to_u8(payload))?; + + let message: ::serde_json::Value = ::serde_json::from_slice(unpacked_msg.as_slice()) + .or(Err(error::INVALID_JSON.code_num))?; + + let message = message["message"].as_str().ok_or(error::INVALID_JSON.code_num)?.to_string(); + + let mut my_payload: PayloadV2 = serde_json::from_str(&message) + .map_err(|err| { + error!("could not deserialize bundle with i8 or u8: {}", err); + error::INVALID_MSGPACK.code_num + })?; + + if my_payload.thread.thid.is_none() { + my_payload.thread.thid = Some(my_payload.id); + } + + Ok((my_payload.msg, Some(my_payload.thread))) + } +} + +#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] +#[serde(untagged)] +pub enum PayloadTypes { + PayloadTypeV1(PayloadTypeV1), + PayloadTypeV2(PayloadTypeV2), +} + +#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] +pub struct PayloadTypeV1 { + name: String, + ver: String, + fmt: String, +} + +type PayloadTypeV2 = MessageTypeV2; + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub enum PayloadKinds { + CredOffer, + CredReq, + Cred, + Proof, + ProofRequest, + Other(String) +} + +impl PayloadKinds { + fn family(&self) -> MessageFamilies { + match self { + PayloadKinds::CredOffer => MessageFamilies::CredentialExchange, + PayloadKinds::CredReq => MessageFamilies::CredentialExchange, + PayloadKinds::Cred => MessageFamilies::CredentialExchange, + PayloadKinds::Proof => MessageFamilies::CredentialExchange, + PayloadKinds::ProofRequest => MessageFamilies::CredentialExchange, + PayloadKinds::Other(family) => MessageFamilies::Unknown(family.to_string()), + } + } + + pub fn name<'a>(&'a self) -> &'a str { + match get_protocol_type() { + ProtocolTypes::V1 => { + match self { + PayloadKinds::CredOffer => "CRED_OFFER", + PayloadKinds::CredReq => "CRED_REQ", + PayloadKinds::Cred => "CRED", + PayloadKinds::ProofRequest => "PROOF_REQUEST", + PayloadKinds::Proof => "PROOF", + PayloadKinds::Other(kind) => kind, + } + } + ProtocolTypes::V2 => { + match self { + PayloadKinds::CredOffer => "credential-offer", + PayloadKinds::CredReq => "credential-request", + PayloadKinds::Cred => "credential", + PayloadKinds::ProofRequest => "presentation-request", + PayloadKinds::Proof => "presentation", + PayloadKinds::Other(kind) => kind, + } + } + } + } +} + +impl PayloadTypes { + pub fn build_v1(kind: PayloadKinds, fmt: &str) -> PayloadTypeV1 { + PayloadTypeV1 { + name: kind.name().to_string(), + ver: MESSAGE_VERSION_V1.to_string(), + fmt: fmt.to_string(), + } + } + + pub fn build_v2(kind: PayloadKinds) -> PayloadTypeV2 { + PayloadTypeV2 { + did: DID.to_string(), + family: kind.family(), + version: MESSAGE_VERSION_V2.to_string(), + type_: kind.name().to_string(), + } + } +} + +#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)] +pub struct Thread { + pub thid: Option, + pub pthid: Option, + pub sender_order: u32, + pub received_orders: HashMap, +} + +impl Thread { + pub fn new() -> Thread { + Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + } + } + + pub fn increment_receiver(&mut self, did: &str) { + self.received_orders.entry(did.to_string()) + .and_modify(|e| *e += 1) + .or_insert(0); + } +} \ No newline at end of file diff --git a/vcx/libvcx/src/messages/proofs/proof_request.rs b/vcx/libvcx/src/messages/proofs/proof_request.rs index 7c61467b52..526228d27e 100644 --- a/vcx/libvcx/src/messages/proofs/proof_request.rs +++ b/vcx/libvcx/src/messages/proofs/proof_request.rs @@ -88,7 +88,8 @@ pub struct ProofRequestMessage{ validate_rc: u32, pub msg_ref_id: Option, from_timestamp: Option, - to_timestamp: Option + to_timestamp: Option, + pub thread_id: Option } impl ProofPredicates { @@ -122,6 +123,7 @@ impl ProofRequestMessage { msg_ref_id: None, from_timestamp: None, to_timestamp: None, + thread_id: None, } } diff --git a/vcx/libvcx/src/messages/send_message.rs b/vcx/libvcx/src/messages/send_message.rs index 1af63bf9a2..f0ca9cb0c8 100644 --- a/vcx/libvcx/src/messages/send_message.rs +++ b/vcx/libvcx/src/messages/send_message.rs @@ -3,9 +3,9 @@ use connection; use api::VcxStateType; use messages::*; use messages::message_type::MessageTypes; +use messages::payload::{Payloads, PayloadKinds, Thread}; use utils::{httpclient, error}; - #[derive(Debug)] pub struct SendMessageBuilder { mtype: RemoteMessageType, @@ -58,9 +58,9 @@ impl SendMessageBuilder { Ok(self) } - pub fn edge_agent_payload(&mut self, my_vk: &str, their_vk: &str, data: &str, payload_type: PayloadKinds) -> Result<&mut Self, u32> { + pub fn edge_agent_payload(&mut self, my_vk: &str, their_vk: &str, data: &str, payload_type: PayloadKinds, thread: Option) -> Result<&mut Self, u32> { //todo: is this a json value, String?? - self.payload = Payload::encrypted(my_vk, their_vk, data, payload_type)?; + self.payload = Payloads::encrypt(my_vk, their_vk, data, payload_type, thread)?; Ok(self) } @@ -105,7 +105,7 @@ impl SendMessageBuilder { return Err(error::INVALID_HTTP_RESPONSE.code_num); } 1 - }, + } settings::ProtocolTypes::V2 => 0 }; @@ -198,7 +198,7 @@ pub fn send_generic_message(connection_handle: u32, msg: &str, msg_type: &str, m .to(&did)? .to_vk(&vk)? .msg_type(&RemoteMessageType::Other(msg_type.to_string()))? - .edge_agent_payload(&vk, &remote_vk, &msg, PayloadKinds::Other(msg_type.to_string()))? + .edge_agent_payload(&vk, &remote_vk, &msg, PayloadKinds::Other(msg_type.to_string()), None)? .agent_did(&agent_did)? .agent_vk(&agent_vk)? .set_title(&msg_title)? diff --git a/vcx/libvcx/src/proof.rs b/vcx/libvcx/src/proof.rs index cdab2931ea..9a0e90553f 100644 --- a/vcx/libvcx/src/proof.rs +++ b/vcx/libvcx/src/proof.rs @@ -9,7 +9,8 @@ use connection; use api::{VcxStateType, ProofStateType}; use messages::proofs::proof_message::{ProofMessage, CredInfo}; use messages; -use messages::{RemoteMessageType, PayloadKinds}; +use messages::RemoteMessageType; +use messages::payload::{Payloads, PayloadKinds, Thread}; use messages::proofs::proof_request::ProofRequestMessage; use messages::GeneralMessage; use utils::error; @@ -53,7 +54,8 @@ pub struct Proof { remote_vk: String, agent_did: String, agent_vk: String, - revocation_interval: RevocationInterval + revocation_interval: RevocationInterval, + thread: Thread } impl Proof { @@ -286,7 +288,7 @@ impl Proof { .set_title(&title)? .set_detail(&title)? .agent_vk(&self.agent_vk)? - .edge_agent_payload(&self.prover_vk, &self.remote_vk, &proof_request, PayloadKinds::ProofRequest).or(Err(ProofError::ProofConnectionError()))? + .edge_agent_payload(&self.prover_vk, &self.remote_vk, &proof_request, PayloadKinds::ProofRequest, Some(self.thread.clone())).or(Err(ProofError::ProofConnectionError()))? .send_secure() .map_err(|err| { warn!("{} could not send proofReq: {}", self.source_id, err); @@ -315,13 +317,17 @@ impl Proof { &self.agent_vk) .map_err(|ec| ProofError::ProofMessageError(ec))?; - let payload = messages::Payload::decrypted(&self.prover_vk, &payload).map_err(|ec| ProofError::CommonError(ec))?; + let (payload, thread) = Payloads::decrypt(&self.prover_vk, &payload).map_err(|ec| ProofError::CommonError(ec))?; self.proof = match parse_proof_payload(&payload) { Err(err) => return Ok(self.get_state()), Ok(x) => Some(x), }; + if let Some(tr) = thread { + self.thread.increment_receiver(self.remote_did.as_str()); + } + self.state = VcxStateType::VcxStateAccepted; match self.proof_validation() { @@ -416,7 +422,8 @@ pub fn create_proof(source_id: String, remote_vk: String::new(), agent_did: String::new(), agent_vk: String::new(), - revocation_interval: revocation_details + revocation_interval: revocation_details, + thread: Thread::new(), }; new_proof.validate_proof_request().map_err(|ec| ProofError::CommonError(ec))?; @@ -535,6 +542,7 @@ mod tests { use utils::httpclient; use connection::tests::build_test_connection; use utils::libindy::{pool, set_libindy_rc}; + use std::collections::HashMap; static PROOF_MSG: &str = r#"{"msg_type":"proof","version":"0.1","to_did":"BnRXf8yDMUwGyZVDkSENeq","from_did":"GxtnGN6ypZYgEqcftSQFnC","proof_request_id":"cCanHnpFAD","proofs":{"claim::e5fec91f-d03d-4513-813c-ab6db5715d55":{"proof":{"primary_proof":{"eq_proof":{"revealed_attrs":{"state":"96473275571522321025213415717206189191162"},"a_prime":"22605045280481376895214546474258256134055560453004805058368015338423404000586901936329279496160366852115900235316791489357953785379851822281248296428005020302405076144264617943389810572564188437603815231794326272302243703078443007359698858400857606408856314183672828086906560155576666631125808137726233827430076624897399072853872527464581329767287002222137559918765406079546649258389065217669558333867707240780369514832185660287640444094973804045885379406641474693993903268791773620198293469768106363470543892730424494655747935463337367735239405840517696064464669905860189004121807576749786474060694597244797343224031","e":"70192089123105616042684481760592174224585053817450673797400202710878562748001698340846985261463026529360990669802293480312441048965520897","v":"1148619141217957986496757711054111791862691178309410923416837802801708689012670430650138736456223586898110113348220116209094530854607083005898964558239710027534227973983322542548800291320747321452329327824406430787211689678096549398458892087551551587767498991043777397791000822007896620414888602588897806008609113730393639807814070738699614969916095861363383223421727858670289337712185089527052065958362840287749622133424503902085247641830693297082507827948006947829401008622239294382186995101394791468192083810475776455445579931271665980788474331866572497866962452476638881287668931141052552771328556458489781734943404258692308937784221642452132005267809852656378394530342203469943982066011466088478895643800295937901139711103301249691253510784029114718919483272055970725860849610885050165709968510696738864528287788491998027072378656038991754015693216663830793243584350961586874315757599094357535856429087122365865868729","m":{"address2":"11774234640096848605908744857306447015748098256395922562149769943967941106193320512788344020652220849708117081570187385467979956319507248530701654682748372348387275979419669108338","city":"4853213962270369118453000522408430296589146124488849630769837449684434138367659379663124155088827069418193027370932024893343033367076071757003149452226758383807126385017161888440","address1":"12970590675851114145396120869959510754345567924518524026685086869487243290925032320159287997675756075512889990901552679591155319959039145119122576164798225386578339739435869622811","zip":"8333721522340131864419931745588776943042067606218561135102011966361165456174036379901390244538991611895455576519950813910672825465382312504250936740379785802177629077591444977329"},"m1":"92853615502250003546205004470333326341901175168428906399291824325990659330595200000112546157141090642053863739870044907457400076448073272490169488870502566172795456430489790324815765612798273406119873266684053517977802902202155082987833343670942161987285661291655743810590661447300059024966135828466539810035","m2":"14442362430453309930284822850357071315613831915865367971974791350454381198894252834180803515368579729220423713315556807632571621646127926114010380486713602821529657583905131582938"},"ge_proofs":[]},"non_revoc_proof":null},"schema_seq_no":15,"issuer_did":"4fUDR9R7fjwELRvH9JT6HH"}},"aggregated_proof":{"c_hash":"68430476900085482958838239880418115228681348197588159723604944078288347793331","c_list":[[179,17,2,242,194,227,92,203,28,32,255,113,112,20,5,243,9,111,220,111,21,210,116,12,167,119,253,181,37,40,143,215,140,42,179,97,75,229,96,94,54,248,206,3,48,14,61,219,160,122,139,227,166,183,37,43,197,200,28,220,217,10,65,42,6,195,124,44,164,65,114,206,51,231,254,156,170,141,21,153,50,251,237,65,147,97,243,17,157,116,213,201,80,119,106,70,88,60,55,36,33,160,135,106,60,212,191,235,116,57,78,177,61,86,44,226,205,100,134,118,93,6,26,58,220,66,232,166,202,62,90,174,231,207,19,239,233,223,70,191,199,100,157,62,139,176,28,184,9,70,116,199,142,237,198,183,12,32,53,84,207,202,77,56,97,177,154,169,223,201,212,163,212,101,184,255,215,167,16,163,136,44,25,123,49,15,229,41,149,133,159,86,106,208,234,73,207,154,194,162,141,63,159,145,94,47,174,51,225,91,243,2,221,202,59,11,212,243,197,208,116,42,242,131,221,137,16,169,203,215,239,78,254,150,42,169,202,132,172,106,179,130,178,130,147,24,173,213,151,251,242,44,54,47,208,223]]},"requested_proof":{"revealed_attrs":{"sdf":["claim::e5fec91f-d03d-4513-813c-ab6db5715d55","UT","96473275571522321025213415717206189191162"]},"unrevealed_attrs":{},"self_attested_attrs":{},"predicates":{}}}"#; @@ -564,7 +572,14 @@ mod tests { remote_vk: VERKEY.to_string(), agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), - revocation_interval: RevocationInterval { from: None, to: None } + revocation_interval: RevocationInterval { from: None, to: None }, + + thread: Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + }, }) } @@ -726,7 +741,14 @@ mod tests { remote_vk: VERKEY.to_string(), agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), - revocation_interval: RevocationInterval { from: None, to: None } + revocation_interval: RevocationInterval { from: None, to: None }, + + thread: Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + }, }); httpclient::set_next_u8_response(PROOF_RESPONSE.to_vec()); @@ -761,7 +783,14 @@ mod tests { remote_vk: VERKEY.to_string(), agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), - revocation_interval: RevocationInterval { from: None, to: None } + revocation_interval: RevocationInterval { from: None, to: None }, + + thread: Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + }, }); httpclient::set_next_u8_response(PROOF_RESPONSE.to_vec()); @@ -935,7 +964,13 @@ mod tests { remote_vk: VERKEY.to_string(), agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), - revocation_interval: RevocationInterval { from: None, to: None } + revocation_interval: RevocationInterval { from: None, to: None }, + thread: Thread { + thid: None, + pthid: None, + sender_order: 0, + received_orders: HashMap::new(), + }, }; let rc = proof.proof_validation(); assert!(rc.is_ok()); diff --git a/vcx/libvcx/src/utils/mod.rs b/vcx/libvcx/src/utils/mod.rs index d1243e721d..b3b9e86a8e 100644 --- a/vcx/libvcx/src/utils/mod.rs +++ b/vcx/libvcx/src/utils/mod.rs @@ -18,6 +18,7 @@ pub mod openssl; pub mod json; pub mod libindy; pub mod threadpool; +pub mod uuid; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; use std::path::PathBuf; diff --git a/vcx/libvcx/src/utils/uuid.rs b/vcx/libvcx/src/utils/uuid.rs new file mode 100644 index 0000000000..6bdfc75e04 --- /dev/null +++ b/vcx/libvcx/src/utils/uuid.rs @@ -0,0 +1,3 @@ +pub fn uuid() -> String { + uuid::Uuid::new_v4().to_string() +} \ No newline at end of file From 0ef03b974a0339f7f0dac3da71a398a7bf3971ba Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 18 Feb 2019 09:40:39 +0300 Subject: [PATCH 02/21] Fixed code review comments Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 3 +- Jenkinsfile.ci | 5 +- vcx/dummy-cloud-agent/sample-config.json | 3 +- .../src/actors/agent_connection.rs | 30 +++++----- vcx/dummy-cloud-agent/src/domain/a2a.rs | 28 +++++----- .../src/domain/message_type.rs | 26 +++++---- vcx/dummy-cloud-agent/src/domain/payload.rs | 4 +- .../src/domain/protocol_type.rs | 4 +- vcx/libvcx/src/lib.rs | 6 +- vcx/libvcx/src/messages/agent_utils.rs | 56 +++++++++---------- vcx/libvcx/src/messages/create_key.rs | 4 +- vcx/libvcx/src/messages/invite.rs | 21 ++++--- vcx/libvcx/src/messages/message_type.rs | 30 +++++----- vcx/libvcx/src/messages/mod.rs | 16 +++--- vcx/libvcx/src/messages/payload.rs | 6 +- vcx/libvcx/src/messages/send_message.rs | 5 +- 16 files changed, 129 insertions(+), 118 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index f1d6457ded..2b57a4e158 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -387,7 +387,8 @@ def linuxVcxBuild(file, env_name, network_name, stashBuildResults) { testEnv.inside("--network=${network_name}") { sh ''' cd vcx/dummy-cloud-agent - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info PROTOCOL_TYPE=2.0 cargo run sample-config.json & + sed -i 's/\\("protocol_type": "\\)1.0/\\12.0/' sample-config.json + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run sample-config.json & ''' echo "${env_name} Libvcx Test: Run vcx demo test for protocol version 2.0" diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 5014a48978..269e9bb7db 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -13,7 +13,7 @@ def testing() { 'android-test': { androidTesting() }, 'macos-test' : { macosTesting() }, 'ios-test' : { iosTesting() }, -'redhat-test' : { rhelTesting() }, + 'redhat-test' : { rhelTesting() }, 'windows-test': { windowsTesting() } ]) } @@ -507,7 +507,8 @@ def linuxVcxBuild(file, env_name, network_name) { testEnv.inside("--network=${network_name}") { sh ''' cd vcx/dummy-cloud-agent - LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info PROTOCOL_TYPE=2.0 cargo run sample-config.json & + sed -i 's/\\("protocol_type": "\\)1.0/\\12.0/' sample-config.json + LIBRARY_PATH=./ LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy=info cargo run sample-config.json & ''' echo "${env_name} Libvcx Test: Run tests" diff --git a/vcx/dummy-cloud-agent/sample-config.json b/vcx/dummy-cloud-agent/sample-config.json index de229e0b1d..8f5d5bb35b 100644 --- a/vcx/dummy-cloud-agent/sample-config.json +++ b/vcx/dummy-cloud-agent/sample-config.json @@ -20,5 +20,6 @@ "config": null, "credentials": null, "type": null - } + }, + "protocol_type": "1.0" } \ No newline at end of file diff --git a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs index 069bea4a44..8836057116 100644 --- a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs +++ b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs @@ -241,7 +241,7 @@ impl AgentConnection { A2AMessageV2::UpdateMessageStatus(msg) => slf.handle_update_message_status(msg), _ => err_act!(slf, err_msg("Unsupported message")) } - }, + } _ => err_act!(slf, err_msg("Unsupported message")) }.map(|msgs, _, _| (msgs, sender_vk)) }) @@ -367,13 +367,13 @@ impl AgentConnection { let send_msg = msg.send_msg; let reply_to_msg_id = msg.reply_to_msg_id.clone(); - let msg_uid = msg.uid.clone(); + let msg_uid = msg.id.clone(); let sender_verkey = sender_verkey.to_string(); future::ok(()) .into_actor(self) .and_then(move |_, slf, _| { - slf.handle_create_connection_request_answer(msg.into(), reply_to_msg_id.clone(), msg_uid, sender_verkey) + slf.handle_create_connection_request_answer(msg.into(), reply_to_msg_id.clone(), Some(msg_uid), sender_verkey) .map(|(msg_uid, a2a_msgs), _, _| (msg_uid, a2a_msgs, reply_to_msg_id)) }) .and_then(move |(msg_uid, a2a_msgs, reply_to_msg_id), slf, _| { @@ -414,14 +414,14 @@ impl AgentConnection { let send_msg = msg.send_msg; let mtype = msg.mtype.clone(); - let uid = msg.uid.clone(); + let uid = msg.id.clone(); let reply_to_msg_id = msg.reply_to_msg_id.clone(); let sender_verkey = sender_verkey.to_string(); future::ok(()) .into_actor(self) .and_then(move |_, slf, _| { - slf.handle_create_general_message(mtype, msg.into(), reply_to_msg_id.clone(), uid, sender_verkey) + slf.handle_create_general_message(mtype, msg.into(), reply_to_msg_id.clone(), Some(uid), sender_verkey) .map(|(msg_uid, a2a_msgs), _, _| (msg_uid, a2a_msgs, reply_to_msg_id)) }) .and_then(move |(msg_uid, a2a_msgs, reply_to_msg_id), slf, _| { @@ -468,7 +468,7 @@ impl AgentConnection { let message = match ProtocolType::get() { ProtocolTypes::V1 => A2AMessage::Version1(A2AMessageV1::MessageCreated(MessageCreated { uid: msg.uid.clone() })), - ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::SendRemoteMessageResponse(SendRemoteMessageResponse { uid: msg.uid.clone(), sent: true })), + ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::SendRemoteMessageResponse(SendRemoteMessageResponse { id: msg.uid.clone(), sent: true })), }; ok_act!(self, (msg.uid, vec![message])) @@ -681,7 +681,7 @@ impl AgentConnection { .map(|uid, _, _| { let message = match ProtocolType::get() { ProtocolTypes::V1 => A2AMessage::Version1(A2AMessageV1::MessageCreated(MessageCreated { uid: uid.clone() })), - ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(ConnectionRequestAnswerResponse { uid: uid.clone(), sent: true })) + ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(ConnectionRequestAnswerResponse { id: uid.clone(), sent: true })) }; (uid, vec![message]) }) @@ -744,7 +744,7 @@ impl AgentConnection { .map(|uid, _, _| { let message = match ProtocolType::get() { ProtocolTypes::V1 => A2AMessage::Version1(A2AMessageV1::MessageCreated(MessageCreated { uid: uid.clone() })), - ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(ConnectionRequestAnswerResponse { uid: uid.clone(), sent: true })) + ProtocolTypes::V2 => A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(ConnectionRequestAnswerResponse { id: uid.clone(), sent: true })) }; (uid, vec![message]) }) @@ -1135,7 +1135,8 @@ impl AgentConnection { match ProtocolType::get() { ProtocolTypes::V1 => { - let msg = ftry!(rmp_serde::to_vec_named(&msg));; + let msg = ftry!(rmp_serde::to_vec_named(&msg)); + ; let payload_msg = PayloadV1 { type_: PayloadTypes::build_v1(PayloadKinds::from(type_), "json"), @@ -1147,9 +1148,10 @@ impl AgentConnection { crypto::auth_crypt(self.wallet_handle, &self.agent_pairwise_verkey, &self.owner_verkey, &message) .map_err(|err| err.context("Can't encode Answer Payload.").into()) .into_box() - }, + } ProtocolTypes::V2 => { - let msg = ftry!(serde_json::to_string(&msg));; + let msg = ftry!(serde_json::to_string(&msg)); + ; let payload_msg = PayloadV2 { type_: PayloadTypes::build_v2(PayloadKinds::from(type_)), @@ -1213,7 +1215,7 @@ impl AgentConnection { } ProtocolTypes::V2 => { let message = ConnectionRequestResponse { - uid: msg.uid.clone(), + id: msg.uid.clone(), invite_detail, url_to_invite_detail: "".to_string(), // format!("{}/agency/invite/{}?msg_uid{}", AGENCY_DOMAIN_URL_PREFIX, self.agent_pairwise_did, msg_uid) @@ -1265,7 +1267,7 @@ impl AgentConnection { ProtocolTypes::V2 => { let msg = ConnectionRequestAnswer { send_msg: false, - uid: Some(message.uid.clone()), + id: message.uid.clone(), reply_to_msg_id: Some(reply_to.to_string()), key_dlg_proof: None, sender_detail, @@ -1307,8 +1309,8 @@ impl AgentConnection { ProtocolTypes::V2 => { let msg = SendRemoteMessage { mtype: message._type, + id: message.uid, send_msg: false, - uid: Some(message.uid), reply_to_msg_id: reply_to.map(String::from), msg, title, diff --git a/vcx/dummy-cloud-agent/src/domain/a2a.rs b/vcx/dummy-cloud-agent/src/domain/a2a.rs index e6bc2025c4..d70b70a7c7 100644 --- a/vcx/dummy-cloud-agent/src/domain/a2a.rs +++ b/vcx/dummy-cloud-agent/src/domain/a2a.rs @@ -467,8 +467,8 @@ pub struct ConfigsRemoved {} pub struct ConnectionRequest { #[serde(rename = "sendMsg")] pub send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - pub uid: Option, + #[serde(rename = "@id")] + id: String, #[serde(rename = "replyToMsgId")] pub reply_to_msg_id: Option, #[serde(rename = "keyDlgProof")] @@ -483,7 +483,8 @@ pub struct ConnectionRequest { #[derive(Debug, Deserialize, Serialize)] pub struct ConnectionRequestResponse { - pub uid: String, + #[serde(rename = "@id")] + pub id: String, #[serde(rename = "inviteDetail")] pub invite_detail: InviteDetail, #[serde(rename = "urlToInviteDetail")] @@ -495,8 +496,8 @@ pub struct ConnectionRequestResponse { pub struct ConnectionRequestAnswer { #[serde(rename = "sendMsg")] pub send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - pub uid: Option, + #[serde(rename = "@id")] + pub id: String, #[serde(rename = "replyToMsgId")] pub reply_to_msg_id: Option, #[serde(rename = "keyDlgProof")] @@ -511,7 +512,8 @@ pub struct ConnectionRequestAnswer { #[derive(Debug, Deserialize, Serialize)] pub struct ConnectionRequestAnswerResponse { - pub uid: String, + #[serde(rename = "@id")] + pub id: String, pub sent: bool, } @@ -519,13 +521,13 @@ pub struct ConnectionRequestAnswerResponse { #[serde(rename_all = "camelCase")] pub struct SendRemoteMessage { pub mtype: RemoteMessageType, + #[serde(rename = "@id")] + pub id: String, #[serde(rename = "replyToMsgId")] #[serde(skip_serializing_if = "Option::is_none")] pub reply_to_msg_id: Option, #[serde(rename = "sendMsg")] pub send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - pub uid: Option, #[serde(rename = "@msg")] pub msg: Vec, #[serde(skip_serializing_if = "Option::is_none")] @@ -537,7 +539,8 @@ pub struct SendRemoteMessage { #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SendRemoteMessageResponse { - pub uid: String, + #[serde(rename = "@id")] + pub id: String, pub sent: bool, } @@ -1006,16 +1009,15 @@ impl<'de> Deserialize<'de> for A2AMessage { let value = Value::deserialize(deserializer).map_err(de::Error::custom)?; let message_type: MessageTypes = serde_json::from_value(value["@type"].clone()).map_err(de::Error::custom)?; - match message_type.version() { - "1.0" => + match message_type { + MessageTypes::MessageTypeV1(_) => A2AMessageV1::deserialize(value) .map(|msg| A2AMessage::Version1(msg)) .map_err(de::Error::custom), - "2.0" => + MessageTypes::MessageTypeV2(_) => A2AMessageV2::deserialize(value) .map(|msg| A2AMessage::Version2(msg)) .map_err(de::Error::custom), - _ => Err(de::Error::custom("Unexpected @type field structure.")) } } } diff --git a/vcx/dummy-cloud-agent/src/domain/message_type.rs b/vcx/dummy-cloud-agent/src/domain/message_type.rs index 0d27a83968..e0eac9893d 100644 --- a/vcx/dummy-cloud-agent/src/domain/message_type.rs +++ b/vcx/dummy-cloud-agent/src/domain/message_type.rs @@ -4,10 +4,8 @@ use regex::Regex; use failure::{err_msg, Error}; use domain::a2a::A2AMessageKinds; -pub const MESSAGE_VERSION_V1: &str = "1.0"; -pub const MESSAGE_VERSION_V2: &str = "2.0"; - pub const DID: &str = "did:sov:123456789abcdefghi1234"; +pub const MESSAGE_VERSION_V1: &str = "1.0"; #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] @@ -28,17 +26,10 @@ impl MessageTypes { MessageTypes::MessageTypeV2(MessageTypeV2 { did: DID.to_string(), family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), + version: kind.family().version().to_string(), type_: kind.name(), }) } - - pub fn version<'a>(&'a self) -> &'a str { - match self { - MessageTypes::MessageTypeV1(type_) => type_.ver.as_str(), - MessageTypes::MessageTypeV2(type_) => type_.version.as_str(), - } - } } #[derive(Deserialize, Serialize, Debug)] @@ -65,6 +56,19 @@ pub enum MessageFamilies { Other(String), } +impl MessageFamilies { + pub fn version(&self) -> &'static str { + match self { + MessageFamilies::Routing => "2.0", + MessageFamilies::Onboarding => "2.0", + MessageFamilies::Pairwise => "2.0", + MessageFamilies::Configs => "2.0", + MessageFamilies::CredentialExchange => "2.0", + _ => "2.0" + } + } +} + impl From for MessageFamilies { fn from(family: String) -> Self { match family.as_str() { diff --git a/vcx/dummy-cloud-agent/src/domain/payload.rs b/vcx/dummy-cloud-agent/src/domain/payload.rs index 6d4e99bb2e..6a7464ce7f 100644 --- a/vcx/dummy-cloud-agent/src/domain/payload.rs +++ b/vcx/dummy-cloud-agent/src/domain/payload.rs @@ -1,4 +1,4 @@ -use domain::message_type::{MessageTypeV2, MessageFamilies, MESSAGE_VERSION_V1, MESSAGE_VERSION_V2, DID}; +use domain::message_type::{MessageTypeV2, MessageFamilies, MESSAGE_VERSION_V1, DID}; use domain::a2a::RemoteMessageType; use domain::protocol_type::{ProtocolType, ProtocolTypes}; use std::collections::HashMap; @@ -107,7 +107,7 @@ impl PayloadTypes { PayloadTypeV2 { did: DID.to_string(), family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), + version: kind.family().version().to_string(), type_: kind.name().to_string(), } } diff --git a/vcx/dummy-cloud-agent/src/domain/protocol_type.rs b/vcx/dummy-cloud-agent/src/domain/protocol_type.rs index d1633e6e16..687a3da7d6 100644 --- a/vcx/dummy-cloud-agent/src/domain/protocol_type.rs +++ b/vcx/dummy-cloud-agent/src/domain/protocol_type.rs @@ -8,9 +8,7 @@ pub struct ProtocolType {} impl ProtocolType { pub fn set(protocol_type_config: Option) { - let protocol_type = protocol_type_config.or( - std::env::var("PROTOCOL_TYPE").ok().map(ProtocolTypes::from)) - .unwrap_or(ProtocolTypes::default()); + let protocol_type = protocol_type_config.map(ProtocolTypes::from).unwrap_or(ProtocolTypes::default()); let mut p_t = PROTOCOL_TYPE.lock().unwrap(); *p_t = protocol_type; } diff --git a/vcx/libvcx/src/lib.rs b/vcx/libvcx/src/lib.rs index a7ccaf18d9..baa39c90d5 100644 --- a/vcx/libvcx/src/lib.rs +++ b/vcx/libvcx/src/lib.rs @@ -252,7 +252,7 @@ mod tests { assert_ne!(delta, delta_after_revoke); } - fn real_proof_demo() { + fn _real_proof_demo() { let number_of_attributes = 10; let institution_did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap(); @@ -316,7 +316,7 @@ mod tests { fn test_real_proof() { init!("agency"); - real_proof_demo(); + _real_proof_demo(); teardown!("agency"); } @@ -411,7 +411,7 @@ mod tests { fn test_real_proof_for_protocol_type_v2() { init!("agency_2_0"); - real_proof_demo(); + _real_proof_demo(); teardown!("agency"); } diff --git a/vcx/libvcx/src/messages/agent_utils.rs b/vcx/libvcx/src/messages/agent_utils.rs index a3c3d1f6f3..c0752a214d 100644 --- a/vcx/libvcx/src/messages/agent_utils.rs +++ b/vcx/libvcx/src/messages/agent_utils.rs @@ -9,11 +9,11 @@ use utils::libindy::signus::create_and_store_my_did; #[derive(Serialize, Deserialize, Debug)] pub struct Connect { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, #[serde(rename = "fromDID")] - pub from_did: String, + from_did: String, #[serde(rename = "fromDIDVerKey")] - pub from_vk: String, + from_vk: String, } impl Connect { @@ -29,17 +29,17 @@ impl Connect { #[derive(Serialize, Deserialize, Debug)] pub struct ConnectResponse { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, #[serde(rename = "withPairwiseDID")] - pub from_did: String, + from_did: String, #[serde(rename = "withPairwiseDIDVerKey")] - pub from_vk: String, + from_vk: String, } #[derive(Serialize, Deserialize, Debug)] pub struct SignUp { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, } impl SignUp { @@ -53,13 +53,13 @@ impl SignUp { #[derive(Serialize, Deserialize, Debug)] pub struct SignUpResponse { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, } #[derive(Serialize, Deserialize, Debug)] pub struct CreateAgent { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, } impl CreateAgent { @@ -73,19 +73,19 @@ impl CreateAgent { #[derive(Serialize, Deserialize, Debug)] pub struct CreateAgentResponse { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, #[serde(rename = "withPairwiseDID")] - pub from_did: String, + from_did: String, #[serde(rename = "withPairwiseDIDVerKey")] - pub from_vk: String, + from_vk: String, } #[derive(Serialize, Deserialize, Debug)] pub struct UpdateConnectionMethod { #[serde(rename = "@type")] - pub msg_type: MessageTypes, + msg_type: MessageTypes, #[serde(rename = "comMethod")] - pub com_method: ComMethod, + com_method: ComMethod, } impl UpdateConnectionMethod { @@ -155,7 +155,7 @@ pub fn connect_register_provision(config: &str) -> Result { settings::set_config_value(settings::CONFIG_WALLET_STORAGE_CREDS, _storage_credentials); } - wallet::init_wallet(&wallet_name, my_config.wallet_type.as_ref().map(String::as_str), + wallet::init_wallet(&wallet_name, my_config.wallet_type.as_ref().map(String::as_str), my_config.storage_config.as_ref().map(String::as_str), my_config.storage_credentials.as_ref().map(String::as_str))?; trace!("initialized wallet"); @@ -345,7 +345,7 @@ pub fn update_agent_info(id: &str, value: &str) -> Result<(), u32> { } } -pub fn update_agent_info_v1(to_did: &str, com_method: ComMethod) -> Result<(), u32> { +fn update_agent_info_v1(to_did: &str, com_method: ComMethod) -> Result<(), u32> { if settings::test_agency_mode_enabled() { httpclient::set_next_u8_response(REGISTER_RESPONSE.to_vec()); } @@ -357,7 +357,7 @@ pub fn update_agent_info_v1(to_did: &str, com_method: ComMethod) -> Result<(), u Ok(()) } -pub fn update_agent_info_v2(to_did: &str, com_method: ComMethod) -> Result<(), u32> { +fn update_agent_info_v2(to_did: &str, com_method: ComMethod) -> Result<(), u32> { let message = A2AMessage::Version2( A2AMessageV2::UpdateConnectionMethod(UpdateConnectionMethod::build(com_method)) ); @@ -365,7 +365,7 @@ pub fn update_agent_info_v2(to_did: &str, com_method: ComMethod) -> Result<(), u Ok(()) } -pub fn send_message_to_agency(message: &A2AMessage, did: &str) -> Result, u32> { +fn send_message_to_agency(message: &A2AMessage, did: &str) -> Result, u32> { let data = prepare_message_for_agency(message, &did)?; let response = httpclient::post_u8(&data).or(Err(error::INVALID_HTTP_RESPONSE.code_num))?; @@ -386,11 +386,11 @@ mod tests { let host = "http://www.whocares.org"; let wallet_key = "test_key"; let config = json!({ -"agency_url": host.to_string(), -"agency_did": agency_did.to_string(), -"agency_verkey": agency_vk.to_string(), -"wallet_key": wallet_key.to_string(), -}); + "agency_url": host.to_string(), + "agency_did": agency_did.to_string(), + "agency_verkey": agency_vk.to_string(), + "wallet_key": wallet_key.to_string(), + }); let result = connect_register_provision(&config.to_string()).unwrap(); assert!(result.len() > 0); @@ -406,11 +406,11 @@ mod tests { let host = "http://localhost:8080"; let wallet_key = "test_key"; let config = json!({ -"agency_url": host.to_string(), -"agency_did": agency_did.to_string(), -"agency_verkey": agency_vk.to_string(), -"wallet_key": wallet_key.to_string(), -}); + "agency_url": host.to_string(), + "agency_did": agency_did.to_string(), + "agency_verkey": agency_vk.to_string(), + "wallet_key": wallet_key.to_string(), + }); let result = connect_register_provision(&config.to_string()).unwrap(); assert!(result.len() > 0); diff --git a/vcx/libvcx/src/messages/create_key.rs b/vcx/libvcx/src/messages/create_key.rs index 93abdc5083..3ac99a9a09 100644 --- a/vcx/libvcx/src/messages/create_key.rs +++ b/vcx/libvcx/src/messages/create_key.rs @@ -30,9 +30,9 @@ pub struct CreateKeyResponse { #[serde(rename = "@type")] msg_type: MessageTypes, #[serde(rename = "withPairwiseDID")] - pub for_did: String, + for_did: String, #[serde(rename = "withPairwiseDIDVerKey")] - pub for_verkey: String, + for_verkey: String, } #[derive(Debug)] diff --git a/vcx/libvcx/src/messages/invite.rs b/vcx/libvcx/src/messages/invite.rs index 677ad5cd47..7edf02b5c4 100644 --- a/vcx/libvcx/src/messages/invite.rs +++ b/vcx/libvcx/src/messages/invite.rs @@ -3,6 +3,7 @@ use messages::*; use messages::message_type::{MessageTypes, MessageTypeV1, MessageTypeV2}; use utils::{httpclient, error}; use utils::constants::*; +use utils::uuid::uuid; #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] pub struct SendInviteMessageDetails { @@ -24,8 +25,8 @@ pub struct ConnectionRequest { msg_type: MessageTypeV2, #[serde(rename = "sendMsg")] send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - uid: Option, + #[serde(rename = "@id")] + id: String, #[serde(rename = "replyToMsgId")] reply_to_msg_id: Option, #[serde(rename = "keyDlgProof")] @@ -42,7 +43,8 @@ pub struct ConnectionRequest { pub struct ConnectionRequestResponse { #[serde(rename = "@type")] msg_type: MessageTypeV2, - uid: String, + #[serde(rename = "@id")] + id: String, #[serde(rename = "inviteDetail")] invite_detail: InviteDetail, #[serde(rename = "urlToInviteDetail")] @@ -70,8 +72,8 @@ pub struct ConnectionRequestAnswer { msg_type: MessageTypeV2, #[serde(rename = "sendMsg")] send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - uid: Option, + #[serde(rename = "@id")] + id: String, #[serde(rename = "replyToMsgId")] reply_to_msg_id: Option, #[serde(rename = "keyDlgProof")] @@ -156,7 +158,8 @@ pub struct SendInviteBuilder { pub struct ConnectionRequestAnswerResponse { #[serde(rename = "@type")] msg_type: MessageTypeV2, - uid: String, + #[serde(rename = "@id")] + id: String, sent: bool, } @@ -357,7 +360,7 @@ impl AcceptInviteBuilder { match response.remove(0) { A2AMessage::Version1(A2AMessageV1::MessageCreated(res)) => Ok(res.uid), - A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(res)) => Ok(res.uid), + A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswerResponse(res)) => Ok(res.id), _ => return Err(error::INVALID_HTTP_RESPONSE.code_num) } } @@ -405,7 +408,7 @@ impl GeneralMessage for SendInviteBuilder { let msg = ConnectionRequest { msg_type: MessageTypes::build_v2(A2AMessageKinds::ConnectionRequest), send_msg: true, - uid: None, + id: uuid(), reply_to_msg_id: None, key_dlg_proof: self.payload.key_dlg_proof.clone(), target_name: self.payload.target_name.clone(), @@ -460,7 +463,7 @@ impl GeneralMessage for AcceptInviteBuilder { let msg = ConnectionRequestAnswer { msg_type: MessageTypes::build_v2(A2AMessageKinds::ConnectionRequestAnswer), send_msg: true, - uid: None, + id: uuid(), reply_to_msg_id: self.reply_to_msg_id.clone(), key_dlg_proof: self.payload.key_dlg_proof.clone(), sender_detail: self.payload.sender_detail.clone(), diff --git a/vcx/libvcx/src/messages/message_type.rs b/vcx/libvcx/src/messages/message_type.rs index fd9519e5f5..c69a8c8c38 100644 --- a/vcx/libvcx/src/messages/message_type.rs +++ b/vcx/libvcx/src/messages/message_type.rs @@ -7,7 +7,6 @@ use messages::A2AMessageKinds; use utils::error; pub const MESSAGE_VERSION_V1: &str = "1.0"; -pub const MESSAGE_VERSION_V2: &str = "2.0"; pub const DID: &str = "did:sov:123456789abcdefghi1234"; #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] @@ -29,7 +28,7 @@ impl MessageTypes { MessageTypeV2 { did: DID.to_string(), family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), + version: kind.family().version().to_string(), type_: kind.name(), } } @@ -40,20 +39,6 @@ impl MessageTypes { settings::ProtocolTypes::V2 => MessageTypes::MessageTypeV2(MessageTypes::build_v2(kind)) } } - - pub fn name<'a>(&'a self) -> &'a str { - match self { - MessageTypes::MessageTypeV1(type_) => type_.name.as_str(), - MessageTypes::MessageTypeV2(type_) => type_.type_.as_str(), - } - } - - pub fn version<'a>(&'a self) -> &'a str { - match self { - MessageTypes::MessageTypeV1(type_) => type_.ver.as_str(), - MessageTypes::MessageTypeV2(type_) => type_.version.as_str(), - } - } } #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] @@ -80,6 +65,19 @@ pub enum MessageFamilies { Unknown(String), } +impl MessageFamilies { + pub fn version(&self) -> &'static str { + match self { + MessageFamilies::Routing => "2.0", + MessageFamilies::Onboarding => "2.0", + MessageFamilies::Pairwise => "2.0", + MessageFamilies::Configs => "2.0", + MessageFamilies::CredentialExchange => "2.0", + _ => "2.0" + } + } +} + impl From for MessageFamilies { fn from(family: String) -> Self { match family.as_str() { diff --git a/vcx/libvcx/src/messages/mod.rs b/vcx/libvcx/src/messages/mod.rs index 58c9cdef92..2710dd5f77 100644 --- a/vcx/libvcx/src/messages/mod.rs +++ b/vcx/libvcx/src/messages/mod.rs @@ -405,16 +405,15 @@ impl<'de> Deserialize<'de> for A2AMessage { let value = Value::deserialize(deserializer).map_err(de::Error::custom)?; let message_type: MessageTypes = serde_json::from_value(value["@type"].clone()).map_err(de::Error::custom)?; - match message_type.version() { - "1.0" => + match message_type { + MessageTypes::MessageTypeV1(_) => A2AMessageV1::deserialize(value) .map(|msg| A2AMessage::Version1(msg)) .map_err(de::Error::custom), - "2.0" => + MessageTypes::MessageTypeV2(_) => A2AMessageV2::deserialize(value) .map(|msg| A2AMessage::Version2(msg)) - .map_err(de::Error::custom), - _ => Err(de::Error::custom("Unexpected @type field structure.")) + .map_err(de::Error::custom) } } } @@ -493,14 +492,14 @@ pub enum MessageDetail { pub struct SendRemoteMessage { #[serde(rename = "@type")] pub msg_type: MessageTypeV2, + #[serde(rename = "@id")] + pub id: String, pub mtype: RemoteMessageType, #[serde(rename = "replyToMsgId")] #[serde(skip_serializing_if = "Option::is_none")] pub reply_to_msg_id: Option, #[serde(rename = "sendMsg")] pub send_msg: bool, - #[serde(skip_serializing_if = "Option::is_none")] - pub uid: Option, #[serde(rename = "@msg")] msg: Vec, #[serde(skip_serializing_if = "Option::is_none")] @@ -514,7 +513,8 @@ pub struct SendRemoteMessage { pub struct SendRemoteMessageResponse { #[serde(rename = "@type")] msg_type: MessageTypes, - pub uid: String, + #[serde(rename = "@id")] + pub id: String, pub sent: bool, } diff --git a/vcx/libvcx/src/messages/payload.rs b/vcx/libvcx/src/messages/payload.rs index 62c045ba78..d1e0cdedf3 100644 --- a/vcx/libvcx/src/messages/payload.rs +++ b/vcx/libvcx/src/messages/payload.rs @@ -15,7 +15,7 @@ pub enum Payloads { #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] pub struct PayloadV1 { #[serde(rename = "@type")] - pub type_: PayloadTypeV1, + type_: PayloadTypeV1, #[serde(rename = "@msg")] pub msg: String, } @@ -23,7 +23,7 @@ pub struct PayloadV1 { #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] pub struct PayloadV2 { #[serde(rename = "@type")] - pub type_: PayloadTypeV2, + type_: PayloadTypeV2, #[serde(rename = "@id")] pub id: String, #[serde(rename = "@msg")] @@ -195,7 +195,7 @@ impl PayloadTypes { PayloadTypeV2 { did: DID.to_string(), family: kind.family(), - version: MESSAGE_VERSION_V2.to_string(), + version: kind.family().version().to_string(), type_: kind.name().to_string(), } } diff --git a/vcx/libvcx/src/messages/send_message.rs b/vcx/libvcx/src/messages/send_message.rs index f0ca9cb0c8..b40f7fd843 100644 --- a/vcx/libvcx/src/messages/send_message.rs +++ b/vcx/libvcx/src/messages/send_message.rs @@ -5,6 +5,7 @@ use messages::*; use messages::message_type::MessageTypes; use messages::payload::{Payloads, PayloadKinds, Thread}; use utils::{httpclient, error}; +use utils::uuid::uuid; #[derive(Debug)] pub struct SendMessageBuilder { @@ -113,7 +114,7 @@ impl SendMessageBuilder { A2AMessage::Version1(A2AMessageV1::MessageSent(res)) => Ok(SendResponse { uid: res.uid, uids: res.uids }), A2AMessage::Version2(A2AMessageV2::SendRemoteMessageResponse(res)) => - Ok(SendResponse { uid: Some(res.uid.clone()), uids: if res.sent { vec![res.uid] } else { vec![] } }), + Ok(SendResponse { uid: Some(res.id.clone()), uids: if res.sent { vec![res.id] } else { vec![] } }), _ => return Err(error::INVALID_HTTP_RESPONSE.code_num) } } @@ -151,10 +152,10 @@ impl GeneralMessage for SendMessageBuilder { settings::ProtocolTypes::V2 => { let message = SendRemoteMessage { msg_type: MessageTypes::build_v2(A2AMessageKinds::SendRemoteMessage), + id: uuid(), mtype: self.mtype.clone(), reply_to_msg_id: self.ref_msg_id.clone(), send_msg: true, - uid: self.uid.clone(), msg: self.payload.clone(), title: self.title.clone(), detail: self.detail.clone(), From 1fc989335238e0044110f85bdbd6cde91a4622f8 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 18 Feb 2019 13:19:48 +0300 Subject: [PATCH 03/21] Added threading to connection request messages Signed-off-by: artem.ivanov --- .../src/actors/agent_connection.rs | 22 ++++++++++---- vcx/dummy-cloud-agent/src/domain/a2a.rs | 10 +++++++ .../src/domain/internal_message.rs | 10 ++++--- vcx/dummy-cloud-agent/src/domain/invite.rs | 2 ++ vcx/dummy-cloud-agent/src/domain/payload.rs | 2 +- vcx/dummy-cloud-agent/src/utils/tests.rs | 4 ++- vcx/libvcx/src/connection.rs | 19 ++++++++++-- vcx/libvcx/src/messages/invite.rs | 29 ++++++++++++++++--- 8 files changed, 80 insertions(+), 18 deletions(-) diff --git a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs index 8836057116..a48cc962e4 100644 --- a/vcx/dummy-cloud-agent/src/actors/agent_connection.rs +++ b/vcx/dummy-cloud-agent/src/actors/agent_connection.rs @@ -349,7 +349,8 @@ impl AgentConnection { &sender_did, None, None, - Some(map! { "phone_no".to_string() => msg_detail.phone_no.clone() })); + Some(map! { "phone_no".to_string() => msg_detail.phone_no.clone() }), + None); (msg, msg_detail) }) @@ -460,7 +461,8 @@ impl AgentConnection { &sender_did, None, Some(msg_detail.msg), - Some(map! {"detail".to_string() => msg_detail.detail, "title".to_string()=> msg_detail.title})); + Some(map! {"detail".to_string() => msg_detail.detail, "title".to_string()=> msg_detail.title}), + None); if let Some(msg_id) = reply_to_msg_id.as_ref() { self.answer_message(msg_id, &msg.uid, &MessageStatusCode::Accepted).unwrap(); @@ -639,6 +641,7 @@ impl AgentConnection { &msg_detail.sender_detail.did, None, None, + None, None); let sender_did = slf.user_pairwise_did.clone(); @@ -648,7 +651,8 @@ impl AgentConnection { &sender_did, Some(conn_req_msg.uid.as_str()), None, - None); + None, + msg_detail.thread.clone()); slf.state.agent_key_dlg_proof = Some(key_dlg_proof); slf.state.remote_connection_detail = Some(RemoteConnectionDetail { @@ -709,7 +713,8 @@ impl AgentConnection { &msg_detail.sender_detail.did, None, None, - None); + None, + msg_detail.thread.clone()); slf.state.remote_connection_detail = Some(RemoteConnectionDetail { forward_agent_detail: msg_detail.sender_agency_detail.clone(), @@ -758,7 +763,8 @@ impl AgentConnection { sender_did: &str, ref_msg_id: Option<&str>, payload: Option>, - sending_data: Option>>) -> InternalMessage { + sending_data: Option>>, + thread: Option) -> InternalMessage { trace!("AgentConnection::create_and_store_internal_message >> {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}", uid, mtype, status_code, sender_did, ref_msg_id, payload, sending_data); @@ -768,7 +774,8 @@ impl AgentConnection { sender_did, ref_msg_id, payload, - sending_data); + sending_data, + thread); self.state.messages.insert(msg.uid.to_string(), msg.clone()); msg } @@ -1200,6 +1207,7 @@ impl AgentConnection { }, status_code: msg.status_code.clone(), status_msg: msg.status_code.message().to_string(), + thread_id: msg_detail.thread_id.clone(), }; match ProtocolType::get() { @@ -1259,6 +1267,7 @@ impl AgentConnection { sender_detail, sender_agency_detail: self.forward_agent_detail.clone(), answer_status_code: MessageStatusCode::Accepted, + thread: None, }; vec![A2AMessage::Version1(A2AMessageV1::CreateMessage(msg_create)), @@ -1273,6 +1282,7 @@ impl AgentConnection { sender_detail, sender_agency_detail: self.forward_agent_detail.clone(), answer_status_code: MessageStatusCode::Accepted, + thread: message.thread.clone().unwrap_or(Thread::new()), }; vec![A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswer(msg))] } diff --git a/vcx/dummy-cloud-agent/src/domain/a2a.rs b/vcx/dummy-cloud-agent/src/domain/a2a.rs index d70b70a7c7..d98a5c052c 100644 --- a/vcx/dummy-cloud-agent/src/domain/a2a.rs +++ b/vcx/dummy-cloud-agent/src/domain/a2a.rs @@ -12,6 +12,7 @@ use domain::key_deligation_proof::KeyDlgProof; use domain::status::{MessageStatusCode, ConnectionStatus}; use domain::message_type::*; use domain::protocol_type::{ProtocolType, ProtocolTypes}; +use domain::payload::Thread; #[derive(Debug)] pub enum A2AMessageV1 { @@ -359,6 +360,7 @@ pub struct ConnectionRequestMessageDetail { pub phone_no: Option, #[serde(rename = "usePublicDID")] pub use_public_did: Option, + pub thread_id: Option, } impl From for ConnectionRequestMessageDetail { @@ -368,6 +370,7 @@ impl From for ConnectionRequestMessageDetail { target_name: con_req.target_name, phone_no: con_req.phone_no, use_public_did: Some(con_req.include_public_did), + thread_id: Some(con_req.id), } } } @@ -390,6 +393,8 @@ pub struct ConnectionRequestAnswerMessageDetail { pub sender_agency_detail: ForwardAgentDetail, #[serde(rename = "answerStatusCode")] pub answer_status_code: MessageStatusCode, + #[serde(skip_serializing_if = "Option::is_none")] + pub thread: Option } impl From for ConnectionRequestAnswerMessageDetail { @@ -399,6 +404,7 @@ impl From for ConnectionRequestAnswerMessageDetail { sender_detail: con_req_answer.sender_detail, sender_agency_detail: con_req_answer.sender_agency_detail, answer_status_code: con_req_answer.answer_status_code, + thread: Some(con_req_answer.thread), } } } @@ -479,6 +485,8 @@ pub struct ConnectionRequest { pub phone_no: Option, #[serde(rename = "usePublicDID")] pub include_public_did: bool, + #[serde(rename = "~thread")] + pub thread: Thread, } #[derive(Debug, Deserialize, Serialize)] @@ -508,6 +516,8 @@ pub struct ConnectionRequestAnswer { pub sender_agency_detail: ForwardAgentDetail, #[serde(rename = "answerStatusCode")] pub answer_status_code: MessageStatusCode, + #[serde(rename = "~thread")] + pub thread: Thread, } #[derive(Debug, Deserialize, Serialize)] diff --git a/vcx/dummy-cloud-agent/src/domain/internal_message.rs b/vcx/dummy-cloud-agent/src/domain/internal_message.rs index 1771c96e31..3b55e880ba 100644 --- a/vcx/dummy-cloud-agent/src/domain/internal_message.rs +++ b/vcx/dummy-cloud-agent/src/domain/internal_message.rs @@ -1,5 +1,6 @@ use domain::a2a::RemoteMessageType; use domain::status::MessageStatusCode; +use domain::payload::Thread; use utils::rand::rand_string; @@ -12,9 +13,9 @@ pub struct InternalMessage { pub sender_did: String, pub status_code: MessageStatusCode, pub ref_msg_id: Option, - pub seq_no: Option, // ? pub payload: Option>, - pub sending_data: HashMap> + pub sending_data: HashMap>, + pub thread: Option } impl InternalMessage { @@ -24,16 +25,17 @@ impl InternalMessage { sender_did: &str, ref_msg_id: Option<&str>, payload: Option>, - sending_data: Option>>) -> InternalMessage { + sending_data: Option>>, + thread: Option) -> InternalMessage { InternalMessage { uid: uid.map(String::from).unwrap_or(rand_string(10)), _type: mtype.clone(), sender_did: sender_did.to_string(), status_code, ref_msg_id: ref_msg_id.map(String::from), - seq_no: None, payload, sending_data: sending_data.unwrap_or(HashMap::new()), + thread, } } } diff --git a/vcx/dummy-cloud-agent/src/domain/invite.rs b/vcx/dummy-cloud-agent/src/domain/invite.rs index 99af4f011c..1d43ccd875 100644 --- a/vcx/dummy-cloud-agent/src/domain/invite.rs +++ b/vcx/dummy-cloud-agent/src/domain/invite.rs @@ -15,6 +15,8 @@ pub struct InviteDetail { pub status_code: MessageStatusCode, #[serde(rename = "statusMsg")] pub status_msg: String, + #[serde(rename = "threadId")] + pub thread_id: Option } #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/vcx/dummy-cloud-agent/src/domain/payload.rs b/vcx/dummy-cloud-agent/src/domain/payload.rs index 6a7464ce7f..7e99c17fec 100644 --- a/vcx/dummy-cloud-agent/src/domain/payload.rs +++ b/vcx/dummy-cloud-agent/src/domain/payload.rs @@ -128,7 +128,7 @@ impl From for PayloadKinds { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct Thread { pub thid: Option, pub pthid: Option, diff --git a/vcx/dummy-cloud-agent/src/utils/tests.rs b/vcx/dummy-cloud-agent/src/utils/tests.rs index 5fc2bbc229..8e0caee951 100644 --- a/vcx/dummy-cloud-agent/src/utils/tests.rs +++ b/vcx/dummy-cloud-agent/src/utils/tests.rs @@ -341,6 +341,7 @@ pub fn compose_create_connection_request(wallet_handle: i32, target_name: None, phone_no: Some(PHONE_NO.to_string()), use_public_did: Some(true), + thread_id: None, }))); let msgs = [create_msg, msg_details]; @@ -390,7 +391,8 @@ pub fn compose_create_connection_request_answer(wallet_handle: i32, verkey: FORWARD_AGENT_DID_VERKEY.to_string(), endpoint: FORWARD_AGENT_ENDPOINT.to_string(), }, - answer_status_code: MessageStatusCode::Accepted + answer_status_code: MessageStatusCode::Accepted, + thread: None, } ))); diff --git a/vcx/libvcx/src/connection.rs b/vcx/libvcx/src/connection.rs index 20443a3a8f..591d53e8fc 100644 --- a/vcx/libvcx/src/connection.rs +++ b/vcx/libvcx/src/connection.rs @@ -14,7 +14,7 @@ use messages::GeneralMessage; use messages; use messages::{MessageStatusCode, RemoteMessageType}; use messages::invite::{InviteDetail, SenderDetail, Payload as ConnectionPayload, AcceptanceDetails}; -use messages::payload::Payloads; +use messages::payload::{Payloads, Thread}; use messages::get_message::Message; use serde_json::Value; use utils::json::KeyMatch; @@ -22,6 +22,7 @@ use error::connection::ConnectionError; use error::ToErrorCode; use object_cache::ObjectCache; use utils::constants::DEFAULT_SERIALIZE_VERSION; +use std::collections::HashMap; lazy_static! { static ref CONNECTION_MAP: ObjectCache = Default::default(); @@ -79,6 +80,7 @@ impl Connection { .agent_did(&self.agent_did)? .agent_vk(&self.agent_vk)? .public_did(self.public_did.as_ref().map(String::as_str))? + .thread(&Thread::new())? .send_secure()?; self.state = VcxStateType::VcxStateOfferSent; @@ -106,7 +108,7 @@ impl Connection { fn _connect_accept_invite(&mut self) -> Result { debug!("accepting invite for connection {}", self.source_id); - let details = self.invite_detail.as_ref() + let details: &InviteDetail = self.invite_detail.as_ref() .ok_or_else(|| { warn!("{} can not connect without invite details", self.source_id); // TODO: Refactor Error @@ -123,12 +125,25 @@ impl Connection { .sender_agency_details(&details.sender_agency_detail)? .answer_status_code(&MessageStatusCode::Accepted)? .reply_to(&details.conn_req_id)? + .thread(&self._build_thread(&details))? .send_secure()?; self.state = VcxStateType::VcxStateAccepted; Ok(error::SUCCESS.code_num) } + fn _build_thread(&self, invite_detail: &InviteDetail) -> Thread { + let mut received_orders = HashMap::new(); + received_orders.insert(invite_detail.sender_detail.did.clone(), 0); + + Thread { + thid: invite_detail.thread_id.clone(), + pthid: None, + sender_order: 0, + received_orders, + } + } + fn connect(&mut self, options: &ConnectionOptions) -> Result { trace!("Connection::connect >>> options: {:?}", options); match self.state { diff --git a/vcx/libvcx/src/messages/invite.rs b/vcx/libvcx/src/messages/invite.rs index 7edf02b5c4..c93151fc67 100644 --- a/vcx/libvcx/src/messages/invite.rs +++ b/vcx/libvcx/src/messages/invite.rs @@ -1,6 +1,7 @@ use settings; use messages::*; use messages::message_type::{MessageTypes, MessageTypeV1, MessageTypeV2}; +use messages::payload::Thread; use utils::{httpclient, error}; use utils::constants::*; use utils::uuid::uuid; @@ -37,6 +38,8 @@ pub struct ConnectionRequest { phone_no: Option, #[serde(rename = "usePublicDID")] include_public_did: bool, + #[serde(rename = "~thread")] + pub thread: Thread, } #[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] @@ -84,6 +87,8 @@ pub struct ConnectionRequestAnswer { sender_agency_detail: Option, #[serde(rename = "answerStatusCode")] answer_status_code: Option, + #[serde(rename = "~thread")] + pub thread: Thread, } #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] @@ -131,6 +136,7 @@ pub struct InviteDetail { pub sender_agency_detail: SenderAgencyDetail, pub target_name: String, pub status_msg: String, + pub thread_id: Option } #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] @@ -152,6 +158,7 @@ pub struct SendInviteBuilder { agent_did: String, agent_vk: String, public_did: Option, + thread: Thread } #[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] @@ -187,6 +194,7 @@ impl InviteDetail { }, target_name: String::new(), status_msg: String::new(), + thread_id: None, } } } @@ -208,6 +216,7 @@ impl SendInviteBuilder { agent_did: String::new(), agent_vk: String::new(), public_did: None, + thread: Thread::new(), } } @@ -233,6 +242,11 @@ impl SendInviteBuilder { Ok(self) } + pub fn thread(&mut self, thread: &Thread) -> Result<&mut Self, u32> { + self.thread = thread.clone(); + Ok(self) + } + pub fn generate_signature(&mut self) -> Result<(), u32> { let signature = format!("{}{}", self.payload.key_dlg_proof.agent_did, self.payload.key_dlg_proof.agent_delegated_key); let signature = ::utils::libindy::crypto::sign(&self.to_vk, signature.as_bytes())?; @@ -283,7 +297,8 @@ pub struct AcceptInviteBuilder { payload: AcceptInviteMessageDetails, agent_did: String, agent_vk: String, - reply_to_msg_id: Option + reply_to_msg_id: Option, + thread: Thread } impl AcceptInviteBuilder { @@ -304,6 +319,7 @@ impl AcceptInviteBuilder { agent_did: String::new(), agent_vk: String::new(), reply_to_msg_id: None, + thread: Thread::new(), } } @@ -333,6 +349,11 @@ impl AcceptInviteBuilder { Ok(self) } + pub fn thread(&mut self, thread: &Thread) -> Result<&mut Self, u32> { + self.thread = thread.clone(); + Ok(self) + } + pub fn generate_signature(&mut self) -> Result<(), u32> { let signature = format!("{}{}", self.payload.key_dlg_proof.agent_did, self.payload.key_dlg_proof.agent_delegated_key); let signature = crypto::sign(&self.to_vk, signature.as_bytes())?; @@ -414,6 +435,7 @@ impl GeneralMessage for SendInviteBuilder { target_name: self.payload.target_name.clone(), phone_no: self.payload.phone_no.clone(), include_public_did: self.payload.include_public_did, + thread: self.thread.clone(), }; vec![A2AMessage::Version2(A2AMessageV2::ConnectionRequest(msg))] @@ -454,10 +476,8 @@ impl GeneralMessage for AcceptInviteBuilder { uid: None, }; - let details = self.payload.clone(); - vec![A2AMessage::Version1(A2AMessageV1::CreateMessage(msg_created)), - A2AMessage::Version1(A2AMessageV1::MessageDetail(MessageDetail::ConnectionRequestAnswer(details)))] + A2AMessage::Version1(A2AMessageV1::MessageDetail(MessageDetail::ConnectionRequestAnswer(self.payload.clone())))] } settings::ProtocolTypes::V2 => { let msg = ConnectionRequestAnswer { @@ -469,6 +489,7 @@ impl GeneralMessage for AcceptInviteBuilder { sender_detail: self.payload.sender_detail.clone(), sender_agency_detail: self.payload.sender_agency_detail.clone(), answer_status_code: self.payload.answer_status_code.clone(), + thread: self.thread.clone(), }; vec![A2AMessage::Version2(A2AMessageV2::ConnectionRequestAnswer(msg))] From 2901e9126164e66310f0771452648b6eff7b48e8 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Fri, 22 Feb 2019 08:55:58 +0300 Subject: [PATCH 04/21] Set thread as an optional Signed-off-by: artem.ivanov --- vcx/libvcx/src/credential.rs | 9 ++++--- vcx/libvcx/src/disclosed_proof.rs | 9 ++++--- vcx/libvcx/src/issuer_credential.rs | 34 +++++++----------------- vcx/libvcx/src/proof.rs | 41 +++++++---------------------- 4 files changed, 29 insertions(+), 64 deletions(-) diff --git a/vcx/libvcx/src/credential.rs b/vcx/libvcx/src/credential.rs index 5cc55363f4..07ee4c6f9a 100644 --- a/vcx/libvcx/src/credential.rs +++ b/vcx/libvcx/src/credential.rs @@ -52,7 +52,7 @@ impl Default for Credential { credential: None, payment_info: None, payment_txn: None, - thread: Thread::new(), + thread: Some(Thread::new()) } } } @@ -76,7 +76,7 @@ pub struct Credential { cred_id: Option, payment_info: Option, payment_txn: Option, - thread: Thread + thread: Option } impl Credential { @@ -160,7 +160,7 @@ impl Credential { .msg_type(&RemoteMessageType::CredReq)? .agent_did(local_agent_did)? .agent_vk(local_agent_vk)? - .edge_agent_payload(&local_my_vk, &local_their_vk, &cred_req_json, PayloadKinds::CredReq, Some(self.thread.clone()))? + .edge_agent_payload(&local_my_vk, &local_their_vk, &cred_req_json, PayloadKinds::CredReq, self.thread.clone())? .ref_msg_id(&offer_msg_id)? .send_secure() .map_err(|err| { @@ -188,7 +188,8 @@ impl Credential { let (credential, thread) = Payloads::decrypt(&my_vk, &payload)?; if let Some(_) = thread { - self.thread.increment_receiver(self.their_did.as_ref().map(String::as_str).unwrap_or("")); + let their_did = self.their_did.as_ref().map(String::as_str).unwrap_or(""); + self.thread.as_mut().map(|thread| thread.increment_receiver(&their_did)); } let credential_msg: CredentialMessage = serde_json::from_str(&credential) diff --git a/vcx/libvcx/src/disclosed_proof.rs b/vcx/libvcx/src/disclosed_proof.rs index 4e8e1903a8..d8c92b5132 100644 --- a/vcx/libvcx/src/disclosed_proof.rs +++ b/vcx/libvcx/src/disclosed_proof.rs @@ -45,7 +45,7 @@ impl Default for DisclosedProof { their_vk: None, agent_did: None, agent_vk: None, - thread: Thread::new() + thread: Some(Thread::new()) } } } @@ -63,7 +63,7 @@ pub struct DisclosedProof { their_vk: Option, agent_did: Option, agent_vk: Option, - thread: Thread + thread: Option } #[derive(Debug, Deserialize, Serialize)] @@ -414,7 +414,8 @@ impl DisclosedProof { true => DEFAULT_GENERATED_PROOF.to_string(), }; - self.thread.increment_receiver(self.their_did.as_ref().map(String::as_str).unwrap_or("")); + let their_did = self.their_did.as_ref().map(String::as_str).unwrap_or(""); + self.thread.as_mut().map(|thread| thread.increment_receiver(&their_did)); messages::send_message() .to(local_my_did)? @@ -422,7 +423,7 @@ impl DisclosedProof { .msg_type(&RemoteMessageType::Proof)? .agent_did(local_agent_did)? .agent_vk(local_agent_vk)? - .edge_agent_payload(&local_my_vk, &local_their_vk, &proof, PayloadKinds::Proof, Some(self.thread.clone())).or(Err(ProofError::ProofConnectionError()))? + .edge_agent_payload(&local_my_vk, &local_their_vk, &proof, PayloadKinds::Proof, self.thread.clone()).or(Err(ProofError::ProofConnectionError()))? .ref_msg_id(ref_msg_uid)? .send_secure() .map_err(|err| { diff --git a/vcx/libvcx/src/issuer_credential.rs b/vcx/libvcx/src/issuer_credential.rs index c77d36f6d1..d3ad449b2b 100644 --- a/vcx/libvcx/src/issuer_credential.rs +++ b/vcx/libvcx/src/issuer_credential.rs @@ -65,7 +65,7 @@ pub struct IssuerCredential { remote_did: String, //their_pw_did for this relationship remote_vk: String, - thread: Thread + thread: Option } #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] @@ -173,7 +173,7 @@ impl IssuerCredential { .to(&self.issued_did)? .to_vk(&self.issued_vk)? .msg_type(&RemoteMessageType::CredOffer)? - .edge_agent_payload(&self.issued_vk, &self.remote_vk, &payload, PayloadKinds::CredOffer, Some(self.thread.clone()))? + .edge_agent_payload(&self.issued_vk, &self.remote_vk, &payload, PayloadKinds::CredOffer, self.thread.clone())? .agent_did(&self.agent_did)? .agent_vk(&self.agent_vk)? .set_title(&title)? @@ -221,14 +221,14 @@ impl IssuerCredential { let cred_req_msg_id = self.credential_request.as_ref().and_then(|cred_req| cred_req.msg_ref_id.as_ref()) .ok_or(IssuerCredError::InvalidCredRequest())?; - self.thread.sender_order += 1; + self.thread.as_mut().map(|thread| thread.sender_order += 1); let response = messages::send_message() .to(&self.issued_did)? .to_vk(&self.issued_vk)? .msg_type(&RemoteMessageType::Cred)? .status_code(&MessageStatusCode::Accepted)? - .edge_agent_payload(&self.issued_vk, &self.remote_vk, &data, PayloadKinds::Cred, Some(self.thread.clone()))? + .edge_agent_payload(&self.issued_vk, &self.remote_vk, &data, PayloadKinds::Cred, self.thread.clone())? .agent_did(&self.agent_did)? .agent_vk(&self.agent_vk)? .ref_msg_id(cred_req_msg_id)? @@ -270,7 +270,8 @@ impl IssuerCredential { let cred_req = parse_credential_req_payload(offer_uid, payload)?; if let Some(tr) = thread { - self.thread.increment_receiver(self.remote_did.as_str()); + let remote_did = self.remote_did.as_str(); + self.thread.as_mut().map(|thread| thread.increment_receiver(&remote_did)); } self.credential_request = Some(cred_req); @@ -582,7 +583,7 @@ pub fn issuer_credential_create(cred_def_handle: u32, agent_vk: String::new(), cred_def_id, cred_def_handle, - thread: Thread::new(), + thread: Some(Thread::new()), }; new_issuer_credential.validate_credential_offer()?; @@ -787,12 +788,7 @@ pub mod tests { agent_vk: VERKEY.to_string(), cred_def_id: CRED_DEF_ID.to_string(), cred_def_handle: 0, - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }; issuer_credential } @@ -848,12 +844,7 @@ pub mod tests { agent_vk: String::new(), cred_def_id, cred_def_handle, - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }; let payment = issuer_credential.generate_payment_info().unwrap(); @@ -1023,12 +1014,7 @@ pub mod tests { remote_vk: VERKEY.to_string(), agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }; ::utils::httpclient::set_next_u8_response(CREDENTIAL_REQ_RESPONSE.to_vec()); diff --git a/vcx/libvcx/src/proof.rs b/vcx/libvcx/src/proof.rs index 9a0e90553f..18022a2083 100644 --- a/vcx/libvcx/src/proof.rs +++ b/vcx/libvcx/src/proof.rs @@ -55,7 +55,7 @@ pub struct Proof { agent_did: String, agent_vk: String, revocation_interval: RevocationInterval, - thread: Thread + thread: Option } impl Proof { @@ -288,7 +288,7 @@ impl Proof { .set_title(&title)? .set_detail(&title)? .agent_vk(&self.agent_vk)? - .edge_agent_payload(&self.prover_vk, &self.remote_vk, &proof_request, PayloadKinds::ProofRequest, Some(self.thread.clone())).or(Err(ProofError::ProofConnectionError()))? + .edge_agent_payload(&self.prover_vk, &self.remote_vk, &proof_request, PayloadKinds::ProofRequest, self.thread.clone()).or(Err(ProofError::ProofConnectionError()))? .send_secure() .map_err(|err| { warn!("{} could not send proofReq: {}", self.source_id, err); @@ -325,7 +325,8 @@ impl Proof { }; if let Some(tr) = thread { - self.thread.increment_receiver(self.remote_did.as_str()); + let remote_did = self.remote_did.as_str(); + self.thread.as_mut().map(|thread| thread.increment_receiver(&remote_did)); } self.state = VcxStateType::VcxStateAccepted; @@ -423,7 +424,7 @@ pub fn create_proof(source_id: String, agent_did: String::new(), agent_vk: String::new(), revocation_interval: revocation_details, - thread: Thread::new(), + thread: Some(Thread::new()), }; new_proof.validate_proof_request().map_err(|ec| ProofError::CommonError(ec))?; @@ -542,7 +543,6 @@ mod tests { use utils::httpclient; use connection::tests::build_test_connection; use utils::libindy::{pool, set_libindy_rc}; - use std::collections::HashMap; static PROOF_MSG: &str = r#"{"msg_type":"proof","version":"0.1","to_did":"BnRXf8yDMUwGyZVDkSENeq","from_did":"GxtnGN6ypZYgEqcftSQFnC","proof_request_id":"cCanHnpFAD","proofs":{"claim::e5fec91f-d03d-4513-813c-ab6db5715d55":{"proof":{"primary_proof":{"eq_proof":{"revealed_attrs":{"state":"96473275571522321025213415717206189191162"},"a_prime":"22605045280481376895214546474258256134055560453004805058368015338423404000586901936329279496160366852115900235316791489357953785379851822281248296428005020302405076144264617943389810572564188437603815231794326272302243703078443007359698858400857606408856314183672828086906560155576666631125808137726233827430076624897399072853872527464581329767287002222137559918765406079546649258389065217669558333867707240780369514832185660287640444094973804045885379406641474693993903268791773620198293469768106363470543892730424494655747935463337367735239405840517696064464669905860189004121807576749786474060694597244797343224031","e":"70192089123105616042684481760592174224585053817450673797400202710878562748001698340846985261463026529360990669802293480312441048965520897","v":"1148619141217957986496757711054111791862691178309410923416837802801708689012670430650138736456223586898110113348220116209094530854607083005898964558239710027534227973983322542548800291320747321452329327824406430787211689678096549398458892087551551587767498991043777397791000822007896620414888602588897806008609113730393639807814070738699614969916095861363383223421727858670289337712185089527052065958362840287749622133424503902085247641830693297082507827948006947829401008622239294382186995101394791468192083810475776455445579931271665980788474331866572497866962452476638881287668931141052552771328556458489781734943404258692308937784221642452132005267809852656378394530342203469943982066011466088478895643800295937901139711103301249691253510784029114718919483272055970725860849610885050165709968510696738864528287788491998027072378656038991754015693216663830793243584350961586874315757599094357535856429087122365865868729","m":{"address2":"11774234640096848605908744857306447015748098256395922562149769943967941106193320512788344020652220849708117081570187385467979956319507248530701654682748372348387275979419669108338","city":"4853213962270369118453000522408430296589146124488849630769837449684434138367659379663124155088827069418193027370932024893343033367076071757003149452226758383807126385017161888440","address1":"12970590675851114145396120869959510754345567924518524026685086869487243290925032320159287997675756075512889990901552679591155319959039145119122576164798225386578339739435869622811","zip":"8333721522340131864419931745588776943042067606218561135102011966361165456174036379901390244538991611895455576519950813910672825465382312504250936740379785802177629077591444977329"},"m1":"92853615502250003546205004470333326341901175168428906399291824325990659330595200000112546157141090642053863739870044907457400076448073272490169488870502566172795456430489790324815765612798273406119873266684053517977802902202155082987833343670942161987285661291655743810590661447300059024966135828466539810035","m2":"14442362430453309930284822850357071315613831915865367971974791350454381198894252834180803515368579729220423713315556807632571621646127926114010380486713602821529657583905131582938"},"ge_proofs":[]},"non_revoc_proof":null},"schema_seq_no":15,"issuer_did":"4fUDR9R7fjwELRvH9JT6HH"}},"aggregated_proof":{"c_hash":"68430476900085482958838239880418115228681348197588159723604944078288347793331","c_list":[[179,17,2,242,194,227,92,203,28,32,255,113,112,20,5,243,9,111,220,111,21,210,116,12,167,119,253,181,37,40,143,215,140,42,179,97,75,229,96,94,54,248,206,3,48,14,61,219,160,122,139,227,166,183,37,43,197,200,28,220,217,10,65,42,6,195,124,44,164,65,114,206,51,231,254,156,170,141,21,153,50,251,237,65,147,97,243,17,157,116,213,201,80,119,106,70,88,60,55,36,33,160,135,106,60,212,191,235,116,57,78,177,61,86,44,226,205,100,134,118,93,6,26,58,220,66,232,166,202,62,90,174,231,207,19,239,233,223,70,191,199,100,157,62,139,176,28,184,9,70,116,199,142,237,198,183,12,32,53,84,207,202,77,56,97,177,154,169,223,201,212,163,212,101,184,255,215,167,16,163,136,44,25,123,49,15,229,41,149,133,159,86,106,208,234,73,207,154,194,162,141,63,159,145,94,47,174,51,225,91,243,2,221,202,59,11,212,243,197,208,116,42,242,131,221,137,16,169,203,215,239,78,254,150,42,169,202,132,172,106,179,130,178,130,147,24,173,213,151,251,242,44,54,47,208,223]]},"requested_proof":{"revealed_attrs":{"sdf":["claim::e5fec91f-d03d-4513-813c-ab6db5715d55","UT","96473275571522321025213415717206189191162"]},"unrevealed_attrs":{},"self_attested_attrs":{},"predicates":{}}}"#; @@ -573,13 +573,7 @@ mod tests { agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), revocation_interval: RevocationInterval { from: None, to: None }, - - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }) } @@ -742,13 +736,7 @@ mod tests { agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), revocation_interval: RevocationInterval { from: None, to: None }, - - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }); httpclient::set_next_u8_response(PROOF_RESPONSE.to_vec()); @@ -784,13 +772,7 @@ mod tests { agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), revocation_interval: RevocationInterval { from: None, to: None }, - - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }); httpclient::set_next_u8_response(PROOF_RESPONSE.to_vec()); @@ -965,12 +947,7 @@ mod tests { agent_did: DID.to_string(), agent_vk: VERKEY.to_string(), revocation_interval: RevocationInterval { from: None, to: None }, - thread: Thread { - thid: None, - pthid: None, - sender_order: 0, - received_orders: HashMap::new(), - }, + thread: Some(Thread::new()), }; let rc = proof.proof_validation(); assert!(rc.is_ok()); From f21a25bf59d52590404a9e5c22b225449d6d3939 Mon Sep 17 00:00:00 2001 From: Axel Nennker Date: Thu, 28 Feb 2019 11:48:11 +0100 Subject: [PATCH 05/21] Introduce CommandHandle WalletHandle etc Signed-off-by: Axel Nennker --- libindy/src/api/anoncreds.rs | 140 ++++++++++++++--------------- libindy/src/api/blob_storage.rs | 10 +-- libindy/src/api/crypto.rs | 56 ++++++------ libindy/src/api/did.rs | 84 +++++++++--------- libindy/src/api/ledger.rs | 144 +++++++++++++++--------------- libindy/src/api/mod.rs | 8 +- libindy/src/api/non_secrets.rs | 68 +++++++-------- libindy/src/api/pairwise.rs | 34 ++++---- libindy/src/api/payments.rs | 150 ++++++++++++++++---------------- libindy/src/api/pool.rs | 38 ++++---- libindy/src/api/wallet.rs | 90 +++++++++---------- 11 files changed, 414 insertions(+), 408 deletions(-) diff --git a/libindy/src/api/anoncreds.rs b/libindy/src/api/anoncreds.rs index bf65e300f6..19f5d11cd8 100644 --- a/libindy/src/api/anoncreds.rs +++ b/libindy/src/api/anoncreds.rs @@ -1,7 +1,7 @@ extern crate libc; extern crate serde_json; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, IndyHandle, CommandHandle, WalletHandle, SearchHandle}; use errors::prelude::*; use commands::{Command, CommandExecutor}; use commands::anoncreds::AnoncredsCommand; @@ -52,12 +52,12 @@ use std::collections::HashMap; /// Common* /// Anoncreds* #[no_mangle] -pub extern fn indy_issuer_create_schema(command_handle: IndyHandle, +pub extern fn indy_issuer_create_schema(command_handle: CommandHandle, issuer_did: *const c_char, name: *const c_char, version: *const c_char, attrs: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_issuer_create_schema: >>> issuer_did: {:?}, name: {:?}, version: {:?}, attrs: {:?}", issuer_did, name, version, attrs); @@ -129,14 +129,14 @@ pub extern fn indy_issuer_create_schema(command_handle: IndyHandle, /// Wallet* /// Anoncreds* #[no_mangle] -pub extern fn indy_issuer_create_and_store_credential_def(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_create_and_store_credential_def(command_handle: CommandHandle, + wallet_handle: WalletHandle, issuer_did: *const c_char, schema_json: *const c_char, tag: *const c_char, signature_type: *const c_char, config_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_issuer_create_and_store_credential_def: >>> wallet_handle: {:?}, issuer_did: {:?}, schema_json: {:?}, tag: {:?}, \ @@ -224,15 +224,15 @@ pub extern fn indy_issuer_create_and_store_credential_def(command_handle: IndyHa /// Wallet* /// Anoncreds* #[no_mangle] -pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: CommandHandle, + wallet_handle: WalletHandle, issuer_did: *const c_char, revoc_def_type: *const c_char, tag: *const c_char, cred_def_id: *const c_char, config_json: *const c_char, tails_writer_handle: IndyHandle, - cb: Option) -> ErrorCode { @@ -303,10 +303,10 @@ pub extern fn indy_issuer_create_and_store_revoc_reg(command_handle: IndyHandle, /// Wallet* /// Anoncreds* #[no_mangle] -pub extern fn indy_issuer_create_credential_offer(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_create_credential_offer(command_handle: CommandHandle, + wallet_handle: WalletHandle, cred_def_id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_issuer_create_credential_offer: >>> wallet_handle: {:?}, cred_def_id: {:?}", wallet_handle, cred_def_id); @@ -381,14 +381,14 @@ pub extern fn indy_issuer_create_credential_offer(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_issuer_create_credential(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_create_credential(command_handle: CommandHandle, + wallet_handle: WalletHandle, cred_offer_json: *const c_char, cred_req_json: *const c_char, cred_values_json: *const c_char, rev_reg_id: *const c_char, blob_storage_reader_handle: IndyHandle, - cb: Option) -> ErrorCode { @@ -460,12 +460,12 @@ pub extern fn indy_issuer_create_credential(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_issuer_revoke_credential(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_revoke_credential(command_handle: CommandHandle, + wallet_handle: WalletHandle, blob_storage_reader_cfg_handle: IndyHandle, rev_reg_id: *const c_char, cred_revoc_id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_issuer_revoke_credential: >>> wallet_handle: {:?}, blob_storage_reader_cfg_handle: {:?}, rev_reg_id: {:?}, cred_revoc_id: {:?}", wallet_handle, blob_storage_reader_cfg_handle, rev_reg_id, cred_revoc_id); @@ -524,12 +524,12 @@ pub extern fn indy_issuer_revoke_credential(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_issuer_recover_credential(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_issuer_recover_credential(command_handle: CommandHandle, + wallet_handle: WalletHandle, blob_storage_reader_cfg_handle: IndyHandle, rev_reg_id: *const c_char, cred_revoc_id: *const c_char, - cb: Option) -> ErrorCode { check_useful_c_str!(rev_reg_id, ErrorCode::CommonInvalidParam4); @@ -571,10 +571,10 @@ pub extern fn indy_issuer_recover_credential(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_issuer_merge_revocation_registry_deltas(command_handle: IndyHandle, +pub extern fn indy_issuer_merge_revocation_registry_deltas(command_handle: CommandHandle, rev_reg_delta_json: *const c_char, other_rev_reg_delta_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_issuer_merge_revocation_registry_deltas: >>> rev_reg_delta_json: {:?}, other_rev_reg_delta_json: {:?}", rev_reg_delta_json, other_rev_reg_delta_json); @@ -623,10 +623,10 @@ pub extern fn indy_issuer_merge_revocation_registry_deltas(command_handle: IndyH /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_create_master_secret(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_create_master_secret(command_handle: CommandHandle, + wallet_handle: WalletHandle, master_secret_id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_prover_create_master_secret: >>> wallet_handle: {:?}, master_secret_id: {:?}", wallet_handle, master_secret_id); @@ -689,13 +689,13 @@ pub extern fn indy_prover_create_master_secret(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_create_credential_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_create_credential_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, prover_did: *const c_char, cred_offer_json: *const c_char, cred_def_json: *const c_char, master_secret_id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_prover_create_credential_req: >>> wallet_handle: {:?}, prover_did: {:?}, cred_offer_json: {:?}, cred_def_json: {:?}, master_secret_id: {:?}", @@ -770,14 +770,14 @@ pub extern fn indy_prover_create_credential_req(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_store_credential(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_store_credential(command_handle: CommandHandle, + wallet_handle: WalletHandle, cred_id: *const c_char, cred_req_metadata_json: *const c_char, cred_json: *const c_char, cred_def_json: *const c_char, rev_reg_def_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_prover_store_credential: >>> wallet_handle: {:?}, cred_id: {:?}, cred_req_metadata_json: {:?}, cred_json: {:?}, cred_def_json: {:?}, \ cred_def_json: {:?}", wallet_handle, cred_id, cred_req_metadata_json, cred_json, cred_def_json, rev_reg_def_json); @@ -840,11 +840,11 @@ pub extern fn indy_prover_store_credential(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_get_credential(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_get_credential(command_handle: CommandHandle, + wallet_handle: WalletHandle, cred_id: *const c_char, cb: Option) -> ErrorCode { trace!("indy_prover_get_credential: >>> wallet_handle: {:?}, cred_id: {:?}", wallet_handle, cred_id); @@ -911,11 +911,11 @@ pub extern fn indy_prover_get_credential(command_handle: IndyHandle, /// Wallet* #[no_mangle] #[deprecated(since="1.6.1", note="Please use indy_prover_search_credentials instead!")] -pub extern fn indy_prover_get_credentials(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_get_credentials(command_handle: CommandHandle, + wallet_handle: WalletHandle, filter_json: *const c_char, cb: Option) -> ErrorCode { trace!("indy_prover_get_credentials: >>> wallet_handle: {:?}, filter_json: {:?}", wallet_handle, filter_json); @@ -967,12 +967,12 @@ pub extern fn indy_prover_get_credentials(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_search_credentials(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_search_credentials(command_handle: CommandHandle, + wallet_handle: WalletHandle, query_json: *const c_char, cb: Option) -> ErrorCode { trace!("indy_prover_search_credentials: >>> wallet_handle: {:?}, query_json: {:?}", wallet_handle, query_json); @@ -1024,10 +1024,10 @@ pub extern fn indy_prover_search_credentials(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_fetch_credentials(command_handle: IndyHandle, - search_handle: IndyHandle, +pub extern fn indy_prover_fetch_credentials(command_handle: CommandHandle, + search_handle: SearchHandle, count: usize, - cb: Option) -> ErrorCode { trace!("indy_prover_fetch_credentials: >>> search_handle: {:?}, count: {:?}", search_handle, count); @@ -1066,9 +1066,9 @@ pub extern fn indy_prover_fetch_credentials(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_close_credentials_search(command_handle: IndyHandle, - search_handle: IndyHandle, - cb: Option) -> ErrorCode { +pub extern fn indy_prover_close_credentials_search(command_handle: CommandHandle, + search_handle: SearchHandle, + cb: Option) -> ErrorCode { trace!("indy_prover_close_credentials_search: >>> search_handle: {:?}", search_handle); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -1177,11 +1177,11 @@ pub extern fn indy_prover_close_credentials_search(command_handle: IndyHandle, /// Wallet* #[deprecated(since="1.6.1", note="Please use indy_prover_search_credentials_for_proof_req instead!")] #[no_mangle] -pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, proof_request_json: *const c_char, cb: Option) -> ErrorCode { trace!("indy_prover_get_credentials_for_proof_req: >>> wallet_handle: {:?}, proof_request_json: {:?}", wallet_handle, proof_request_json); @@ -1254,13 +1254,13 @@ pub extern fn indy_prover_get_credentials_for_proof_req(command_handle: IndyHand /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_search_credentials_for_proof_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_search_credentials_for_proof_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, proof_request_json: *const c_char, extra_query_json: *const c_char, cb: Option) -> ErrorCode { + command_handle_: CommandHandle, err: ErrorCode, + search_handle: SearchHandle)>) -> ErrorCode { trace!("indy_prover_search_credentials_for_proof_req: >>> wallet_handle: {:?}, proof_request_json: {:?}, extra_query_json: {:?}", wallet_handle, proof_request_json, extra_query_json); check_useful_json!(proof_request_json, ErrorCode::CommonInvalidParam3, ProofRequest); @@ -1329,11 +1329,11 @@ pub extern fn indy_prover_search_credentials_for_proof_req(command_handle: IndyH /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_fetch_credentials_for_proof_req(command_handle: IndyHandle, - search_handle: IndyHandle, +pub extern fn indy_prover_fetch_credentials_for_proof_req(command_handle: CommandHandle, + search_handle: SearchHandle, item_referent: *const c_char, count: usize, - cb: Option) -> ErrorCode { trace!("indy_prover_fetch_credentials_for_proof_req: >>> search_handle: {:?}, count: {:?}", search_handle, count); @@ -1374,9 +1374,9 @@ pub extern fn indy_prover_fetch_credentials_for_proof_req(command_handle: IndyH /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle: IndyHandle, - search_handle: IndyHandle, - cb: Option) -> ErrorCode { +pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle: CommandHandle, + search_handle: SearchHandle, + cb: Option) -> ErrorCode { trace!("indy_prover_close_credentials_search_for_proof_req: >>> search_handle: {:?}", search_handle); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -1537,15 +1537,15 @@ pub extern fn indy_prover_close_credentials_search_for_proof_req(command_handle /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_prover_create_proof(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_prover_create_proof(command_handle: CommandHandle, + wallet_handle: WalletHandle, proof_req_json: *const c_char, requested_credentials_json: *const c_char, master_secret_id: *const c_char, schemas_json: *const c_char, credential_defs_json: *const c_char, rev_states_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_prover_create_proof: >>> wallet_handle: {:?}, proof_req_json: {:?}, requested_credentials_json: {:?}, master_secret_id: {:?}, \ schemas_json: {:?}, credential_defs_json: {:?}, rev_states_json: {:?}", @@ -1676,14 +1676,14 @@ pub extern fn indy_prover_create_proof(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_verifier_verify_proof(command_handle: IndyHandle, +pub extern fn indy_verifier_verify_proof(command_handle: CommandHandle, proof_request_json: *const c_char, proof_json: *const c_char, schemas_json: *const c_char, credential_defs_json: *const c_char, rev_reg_defs_json: *const c_char, rev_regs_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_verifier_verify_proof: >>> proof_request_json: {:?}, proof_json: {:?}, schemas_json: {:?}, credential_defs_json: {:?}, \ rev_reg_defs_json: {:?}, rev_regs_json: {:?}", proof_request_json, proof_json, schemas_json, credential_defs_json, rev_reg_defs_json, rev_regs_json); @@ -1746,14 +1746,14 @@ pub extern fn indy_verifier_verify_proof(command_handle: IndyHandle, /// Wallet* /// Anoncreds* #[no_mangle] -pub extern fn indy_create_revocation_state(command_handle: IndyHandle, +pub extern fn indy_create_revocation_state(command_handle: CommandHandle, blob_storage_reader_handle: IndyHandle, rev_reg_def_json: *const c_char, rev_reg_delta_json: *const c_char, timestamp: u64, cred_rev_id: *const c_char, cb: Option) -> ErrorCode { trace!("indy_create_revocation_state: >>> blob_storage_reader_handle: {:?}, rev_reg_def_json: {:?}, rev_reg_delta_json: {:?}, timestamp: {:?}, \ cred_rev_id: {:?}", blob_storage_reader_handle, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id); @@ -1814,7 +1814,7 @@ pub extern fn indy_create_revocation_state(command_handle: IndyHandle, /// Wallet* /// Anoncreds* #[no_mangle] -pub extern fn indy_update_revocation_state(command_handle: IndyHandle, +pub extern fn indy_update_revocation_state(command_handle: CommandHandle, blob_storage_reader_handle: IndyHandle, rev_state_json: *const c_char, rev_reg_def_json: *const c_char, @@ -1822,7 +1822,7 @@ pub extern fn indy_update_revocation_state(command_handle: IndyHandle, timestamp: u64, cred_rev_id: *const c_char, cb: Option) -> ErrorCode { trace!("indy_update_revocation_state: >>> blob_storage_reader_handle: {:?}, rev_state_json: {:?}, rev_reg_def_json: {:?}, rev_reg_delta_json: {:?}, \ timestamp: {:?}, cred_rev_id: {:?}", blob_storage_reader_handle, rev_state_json, rev_reg_def_json, rev_reg_delta_json, timestamp, cred_rev_id); diff --git a/libindy/src/api/blob_storage.rs b/libindy/src/api/blob_storage.rs index 3be086b688..bd6973d7c2 100644 --- a/libindy/src/api/blob_storage.rs +++ b/libindy/src/api/blob_storage.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, IndyHandle, CommandHandle}; use commands::{Command, CommandExecutor}; use commands::blob_storage::BlobStorageCommand; use errors::prelude::*; @@ -9,10 +9,10 @@ use utils::ctypes; use self::libc::c_char; #[no_mangle] -pub extern fn indy_open_blob_storage_reader(command_handle: IndyHandle, +pub extern fn indy_open_blob_storage_reader(command_handle: CommandHandle, type_: *const c_char, config_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_open_blob_storage_reader: >>> type_: {:?}, config_json: {:?}", type_, config_json); @@ -42,10 +42,10 @@ pub extern fn indy_open_blob_storage_reader(command_handle: IndyHandle, } #[no_mangle] -pub extern fn indy_open_blob_storage_writer(command_handle: IndyHandle, +pub extern fn indy_open_blob_storage_writer(command_handle: CommandHandle, type_: *const c_char, config_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_open_blob_storage_writer: >>> type_: {:?}, config_json: {:?}", type_, config_json); diff --git a/libindy/src/api/crypto.rs b/libindy/src/api/crypto.rs index 77fef1f1fa..b8df089406 100644 --- a/libindy/src/api/crypto.rs +++ b/libindy/src/api/crypto.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle}; use commands::{Command, CommandExecutor}; use commands::crypto::CryptoCommand; use domain::crypto::key::KeyInfo; @@ -36,10 +36,10 @@ use self::libc::c_char; /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_create_key(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_create_key(command_handle: CommandHandle, + wallet_handle: WalletHandle, key_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_create_key: >>> wallet_handle: {:?}, key_json: {:?}", wallet_handle, key_json); @@ -88,11 +88,11 @@ pub extern fn indy_create_key(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_set_key_metadata(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_set_key_metadata(command_handle: CommandHandle, + wallet_handle: WalletHandle, verkey: *const c_char, metadata: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_set_key_metadata: >>> wallet_handle: {:?}, verkey: {:?}, metadata: {:?}", wallet_handle, verkey, metadata); @@ -141,10 +141,10 @@ pub extern fn indy_set_key_metadata(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_get_key_metadata(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_get_key_metadata(command_handle: CommandHandle, + wallet_handle: WalletHandle, verkey: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_key_metadata: >>> wallet_handle: {:?}, verkey: {:?}", wallet_handle, verkey); @@ -194,12 +194,12 @@ pub extern fn indy_get_key_metadata(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_crypto_sign(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_crypto_sign(command_handle: CommandHandle, + wallet_handle: WalletHandle, signer_vk: *const c_char, message_raw: *const u8, message_len: u32, - cb: Option) -> ErrorCode { @@ -256,13 +256,13 @@ pub extern fn indy_crypto_sign(command_handle: IndyHandle, /// Ledger* /// Crypto* #[no_mangle] -pub extern fn indy_crypto_verify(command_handle: IndyHandle, +pub extern fn indy_crypto_verify(command_handle: CommandHandle, signer_vk: *const c_char, message_raw: *const u8, message_len: u32, signature_raw: *const u8, signature_len: u32, - cb: Option) -> ErrorCode { trace!("indy_crypto_verify: >>> signer_vk: {:?}, message_raw: {:?}, message_len: {:?}, signature_raw: {:?}, signature_len: {:?}", @@ -325,13 +325,13 @@ pub extern fn indy_crypto_verify(command_handle: IndyHandle, /// Ledger* /// Crypto* #[no_mangle] -pub extern fn indy_crypto_auth_crypt(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_crypto_auth_crypt(command_handle: CommandHandle, + wallet_handle: WalletHandle, sender_vk: *const c_char, recipient_vk: *const c_char, msg_data: *const u8, msg_len: u32, - cb: Option) -> ErrorCode { @@ -395,12 +395,12 @@ pub extern fn indy_crypto_auth_crypt(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_crypto_auth_decrypt(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_crypto_auth_decrypt(command_handle: CommandHandle, + wallet_handle: WalletHandle, recipient_vk: *const c_char, encrypted_msg: *const u8, encrypted_len: u32, - cb: Option) -> ErrorCode { @@ -523,12 +523,12 @@ pub extern fn indy_crypto_anon_crypt(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_crypto_anon_decrypt(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_crypto_anon_decrypt(command_handle: CommandHandle, + wallet_handle: WalletHandle, recipient_vk: *const c_char, encrypted_msg: *const u8, encrypted_len: u32, - cb: Option) -> ErrorCode { @@ -630,8 +630,8 @@ pub extern fn indy_crypto_anon_decrypt(command_handle: IndyHandle, /// Crypto* #[no_mangle] pub extern fn indy_pack_message( - command_handle: IndyHandle, - wallet_handle: IndyHandle, + command_handle: CommandHandle, + wallet_handle: WalletHandle, message: *const u8, message_len: u32, receiver_keys: *const c_char, diff --git a/libindy/src/api/did.rs b/libindy/src/api/did.rs index 6ed2c7ef7a..30a7ba7895 100644 --- a/libindy/src/api/did.rs +++ b/libindy/src/api/did.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle, PoolHandle}; use commands::{Command, CommandExecutor}; use commands::did::DidCommand; use domain::crypto::did::{MyDidInfo, TheirDidInfo}; @@ -52,10 +52,10 @@ use domain::ledger::attrib::Endpoint; /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_create_and_store_my_did(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_create_and_store_my_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, did_info: *const c_char, - cb: Option) -> ErrorCode { @@ -115,11 +115,11 @@ pub extern fn indy_create_and_store_my_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_replace_keys_start(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_replace_keys_start(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, key_info: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_replace_keys_start: >>> wallet_handle: {:?}, did: {:?}, identity_json: {:?}", wallet_handle, did, key_info); @@ -169,10 +169,10 @@ pub extern fn indy_replace_keys_start(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_replace_keys_apply(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_replace_keys_apply(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_replace_keys_apply: >>> wallet_handle: {:?}, did: {:?}", wallet_handle, did); @@ -223,10 +223,10 @@ pub extern fn indy_replace_keys_apply(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_store_their_did(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_store_their_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, identity_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_store_their_did: >>> wallet_handle: {:?}, identity_json: {:?}", wallet_handle, identity_json); @@ -285,11 +285,11 @@ pub extern fn indy_store_their_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_key_for_did(command_handle: IndyHandle, - pool_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_key_for_did(command_handle: CommandHandle, + pool_handle: PoolHandle, + wallet_handle: WalletHandle, did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_key_for_did: >>> pool_handle: {:?}, wallet_handle: {:?}, did: {:?}", pool_handle, wallet_handle, did); @@ -348,10 +348,10 @@ pub extern fn indy_key_for_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_key_for_local_did(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_key_for_local_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_key_for_local_did: >>> wallet_handle: {:?}, did: {:?}", wallet_handle, did); @@ -401,12 +401,12 @@ pub extern fn indy_key_for_local_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_set_endpoint_for_did(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_set_endpoint_for_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, address: *const c_char, transport_key: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_set_endpoint_for_did: >>> wallet_handle: {:?}, did: {:?}, address: {:?}, transport_key: {:?}", wallet_handle, did, address, transport_key); @@ -460,11 +460,11 @@ pub extern fn indy_set_endpoint_for_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_get_endpoint_for_did(command_handle: IndyHandle, - wallet_handle: IndyHandle, - pool_handle: IndyHandle, +pub extern fn indy_get_endpoint_for_did(command_handle: CommandHandle, + wallet_handle: WalletHandle, + pool_handle: PoolHandle, did: *const c_char, - cb: Option) -> ErrorCode { @@ -517,11 +517,11 @@ pub extern fn indy_get_endpoint_for_did(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_set_did_metadata(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_set_did_metadata(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, metadata: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_set_did_metadata: >>> wallet_handle: {:?}, did: {:?}, metadata: {:?}", wallet_handle, did, metadata); @@ -570,10 +570,10 @@ pub extern fn indy_set_did_metadata(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_get_did_metadata(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_get_did_metadata(command_handle: CommandHandle, + wallet_handle: WalletHandle, did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_did_metadata: >>> wallet_handle: {:?}, did: {:?}", wallet_handle, did); @@ -628,10 +628,10 @@ pub extern fn indy_get_did_metadata(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_get_my_did_with_meta(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_get_my_did_with_meta(command_handle: CommandHandle, + wallet_handle: WalletHandle, my_did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_my_did_with_meta: >>> wallet_handle: {:?}, my_did: {:?}", wallet_handle, my_did); @@ -683,9 +683,9 @@ pub extern fn indy_get_my_did_with_meta(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_list_my_dids_with_meta(command_handle: IndyHandle, - wallet_handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_list_my_dids_with_meta: >>> wallet_handle: {:?}", wallet_handle); @@ -731,10 +731,10 @@ pub extern fn indy_list_my_dids_with_meta(command_handle: IndyHandle, /// Wallet* /// Crypto* #[no_mangle] -pub extern fn indy_abbreviate_verkey(command_handle: IndyHandle, +pub extern fn indy_abbreviate_verkey(command_handle: CommandHandle, did: *const c_char, full_verkey: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_abbreviate_verkey: >>> did: {:?}, full_verkey: {:?}", did, full_verkey); @@ -762,4 +762,4 @@ pub extern fn indy_abbreviate_verkey(command_handle: IndyHandle, trace!("indy_abbreviate_verkey: <<< res: {:?}", res); res -} \ No newline at end of file +} diff --git a/libindy/src/api/ledger.rs b/libindy/src/api/ledger.rs index e310f98285..48ff888af7 100644 --- a/libindy/src/api/ledger.rs +++ b/libindy/src/api/ledger.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle, PoolHandle}; use errors::prelude::*; use commands::{Command, CommandExecutor}; use commands::ledger::LedgerCommand; @@ -37,12 +37,12 @@ use self::libc::c_char; /// Ledger* /// Crypto* #[no_mangle] -pub extern fn indy_sign_and_submit_request(command_handle: IndyHandle, - pool_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_sign_and_submit_request(command_handle: CommandHandle, + pool_handle: PoolHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, request_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_sign_and_submit_request: >>> pool_handle: {:?}, wallet_handle: {:?}, submitter_did: {:?}, request_json: {:?}", @@ -93,10 +93,10 @@ pub extern fn indy_sign_and_submit_request(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_submit_request(command_handle: IndyHandle, - pool_handle: IndyHandle, +pub extern fn indy_submit_request(command_handle: CommandHandle, + pool_handle: PoolHandle, request_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_submit_request: >>> pool_handle: {:?}, request_json: {:?}", pool_handle, request_json); @@ -150,12 +150,12 @@ pub extern fn indy_submit_request(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_submit_action(command_handle: IndyHandle, - pool_handle: IndyHandle, +pub extern fn indy_submit_action(command_handle: CommandHandle, + pool_handle: PoolHandle, request_json: *const c_char, nodes: *const c_char, timeout: i32, - cb: Option) -> ErrorCode { trace!("indy_submit_action: >>> pool_handle: {:?}, request_json: {:?}, nodes: {:?}, timeout: {:?}", pool_handle, request_json, nodes, timeout); @@ -211,11 +211,11 @@ pub extern fn indy_submit_action(command_handle: IndyHandle, /// Ledger* /// Crypto* #[no_mangle] -pub extern fn indy_sign_request(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_sign_request(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, request_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_sign_request: >>> wallet_handle: {:?}, submitter_did: {:?}, request_json: {:?}", wallet_handle, submitter_did, request_json); @@ -267,11 +267,11 @@ pub extern fn indy_sign_request(command_handle: IndyHandle, /// Ledger* /// Crypto* #[no_mangle] -pub extern fn indy_multi_sign_request(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_multi_sign_request(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, request_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_multi_sign_request: >>> wallet_handle: {:?}, submitter_did: {:?}, request_json: {:?}", wallet_handle, submitter_did, request_json); @@ -316,10 +316,10 @@ pub extern fn indy_multi_sign_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_ddo_request(command_handle: IndyHandle, +pub extern fn indy_build_get_ddo_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_ddo_request: >>> submitter_did: {:?}, target_did: {:?}", submitter_did, target_did); @@ -373,13 +373,13 @@ pub extern fn indy_build_get_ddo_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_nym_request(command_handle: IndyHandle, +pub extern fn indy_build_nym_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, verkey: *const c_char, alias: *const c_char, role: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_nym_request: >>> submitter_did: {:?}, target_did: {:?}, verkey: {:?}, alias: {:?}, role: {:?}", @@ -431,10 +431,10 @@ pub extern fn indy_build_nym_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_nym_request(command_handle: IndyHandle, +pub extern fn indy_build_get_nym_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_nym_request: >>> submitter_did: {:?}, target_did: {:?}", submitter_did, target_did); @@ -481,13 +481,13 @@ pub extern fn indy_build_get_nym_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_attrib_request(command_handle: IndyHandle, +pub extern fn indy_build_attrib_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, hash: *const c_char, raw: *const c_char, enc: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_attrib_request: >>> submitter_did: {:?}, target_did: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", @@ -542,13 +542,13 @@ pub extern fn indy_build_attrib_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_attrib_request(command_handle: IndyHandle, +pub extern fn indy_build_get_attrib_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, raw: *const c_char, hash: *const c_char, enc: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_attrib_request: >>> submitter_did: {:?}, target_did: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", @@ -607,10 +607,10 @@ pub extern fn indy_build_get_attrib_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_schema_request(command_handle: IndyHandle, +pub extern fn indy_build_schema_request(command_handle: CommandHandle, submitter_did: *const c_char, data: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_schema_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -654,10 +654,10 @@ pub extern fn indy_build_schema_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_schema_request(command_handle: IndyHandle, +pub extern fn indy_build_get_schema_request(command_handle: CommandHandle, submitter_did: *const c_char, id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_schema_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -707,9 +707,9 @@ pub extern fn indy_build_get_schema_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_parse_get_schema_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_schema_response(command_handle: CommandHandle, get_schema_response: *const c_char, - cb: Option) -> ErrorCode { @@ -765,10 +765,10 @@ pub extern fn indy_parse_get_schema_response(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_cred_def_request(command_handle: IndyHandle, +pub extern fn indy_build_cred_def_request(command_handle: CommandHandle, submitter_did: *const c_char, data: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_cred_def_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -813,10 +813,10 @@ pub extern fn indy_build_cred_def_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_cred_def_request(command_handle: IndyHandle, +pub extern fn indy_build_get_cred_def_request(command_handle: CommandHandle, submitter_did: *const c_char, id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_cred_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -870,9 +870,9 @@ pub extern fn indy_build_get_cred_def_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_parse_get_cred_def_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_cred_def_response(command_handle: CommandHandle, get_cred_def_response: *const c_char, - cb: Option) -> ErrorCode { @@ -926,11 +926,11 @@ pub extern fn indy_parse_get_cred_def_response(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_node_request(command_handle: IndyHandle, +pub extern fn indy_build_node_request(command_handle: CommandHandle, submitter_did: *const c_char, target_did: *const c_char, data: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_node_request: >>> submitter_did: {:?}, target_did: {:?}, data: {:?}", submitter_did, target_did, data); @@ -975,9 +975,9 @@ pub extern fn indy_build_node_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_validator_info_request(command_handle: IndyHandle, +pub extern fn indy_build_get_validator_info_request(command_handle: CommandHandle, submitter_did: *const c_char, - cb: Option) -> ErrorCode { check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam2); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4); @@ -1014,11 +1014,11 @@ pub extern fn indy_build_get_validator_info_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_txn_request(command_handle: IndyHandle, +pub extern fn indy_build_get_txn_request(command_handle: CommandHandle, submitter_did: *const c_char, ledger_type: *const c_char, seq_no: i32, - cb: Option) -> ErrorCode { trace!("indy_build_get_txn_request: >>> submitter_did: {:?}, ledger_type: {:?}, seq_no: {:?}", submitter_did, ledger_type, seq_no); @@ -1066,11 +1066,11 @@ pub extern fn indy_build_get_txn_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_pool_config_request(command_handle: IndyHandle, +pub extern fn indy_build_pool_config_request(command_handle: CommandHandle, submitter_did: *const c_char, writes: bool, force: bool, - cb: Option) -> ErrorCode { trace!("indy_build_pool_config_request: >>> submitter_did: {:?}, writes: {:?}, force: {:?}", submitter_did, writes, force); @@ -1115,11 +1115,11 @@ pub extern fn indy_build_pool_config_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_pool_restart_request(command_handle: IndyHandle, +pub extern fn indy_build_pool_restart_request(command_handle: CommandHandle, submitter_did: *const c_char, action: *const c_char, datetime: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_pool_restart_request: >>> submitter_did: {:?}, action: {:?}, datetime: {:?}", submitter_did, action, datetime); @@ -1178,7 +1178,7 @@ pub extern fn indy_build_pool_restart_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_pool_upgrade_request(command_handle: IndyHandle, +pub extern fn indy_build_pool_upgrade_request(command_handle: CommandHandle, submitter_did: *const c_char, name: *const c_char, version: *const c_char, @@ -1190,7 +1190,7 @@ pub extern fn indy_build_pool_upgrade_request(command_handle: IndyHandle, reinstall: bool, force: bool, package: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_pool_upgrade_request: >>> submitter_did: {:?}, name: {:?}, version: {:?}, action: {:?}, sha256: {:?}, timeout: {:?}, \ @@ -1271,10 +1271,10 @@ pub extern fn indy_build_pool_upgrade_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_revoc_reg_def_request(command_handle: IndyHandle, +pub extern fn indy_build_revoc_reg_def_request(command_handle: CommandHandle, submitter_did: *const c_char, data: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_revoc_reg_def_request: >>> submitter_did: {:?}, data: {:?}", submitter_did, data); @@ -1319,10 +1319,10 @@ pub extern fn indy_build_revoc_reg_def_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_revoc_reg_def_request(command_handle: IndyHandle, +pub extern fn indy_build_get_revoc_reg_def_request(command_handle: CommandHandle, submitter_did: *const c_char, id: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_revoc_reg_def_request: >>> submitter_did: {:?}, id: {:?}", submitter_did, id); @@ -1380,9 +1380,9 @@ pub extern fn indy_build_get_revoc_reg_def_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_parse_get_revoc_reg_def_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_revoc_reg_def_response(command_handle: CommandHandle, get_revoc_reg_def_response: *const c_char, - cb: Option) -> ErrorCode { @@ -1441,12 +1441,12 @@ pub extern fn indy_parse_get_revoc_reg_def_response(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_revoc_reg_entry_request(command_handle: IndyHandle, +pub extern fn indy_build_revoc_reg_entry_request(command_handle: CommandHandle, submitter_did: *const c_char, revoc_reg_def_id: *const c_char, rev_def_type: *const c_char, value: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_revoc_reg_entry_request: >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, rev_def_type: {:?}, value: {:?}", @@ -1498,11 +1498,11 @@ pub extern fn indy_build_revoc_reg_entry_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_build_get_revoc_reg_request(command_handle: IndyHandle, +pub extern fn indy_build_get_revoc_reg_request(command_handle: CommandHandle, submitter_did: *const c_char, revoc_reg_def_id: *const c_char, timestamp: i64, - cb: Option) -> ErrorCode { trace!("indy_build_get_revoc_reg_request: >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, timestamp: {:?}", submitter_did, revoc_reg_def_id, timestamp); @@ -1552,9 +1552,9 @@ pub extern fn indy_build_get_revoc_reg_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_parse_get_revoc_reg_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_revoc_reg_response(command_handle: CommandHandle, get_revoc_reg_response: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_revoc_reg_request: >>> submitter_did: {:?}, revoc_reg_def_id: {:?}, from: {:?}, to: {:?}", @@ -1668,9 +1668,9 @@ pub extern fn indy_build_get_revoc_reg_delta_request(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_parse_get_revoc_reg_delta_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_revoc_reg_delta_response(command_handle: CommandHandle, get_revoc_reg_delta_response: *const c_char, - cb: Option ErrorCode; /// # errors /// Common* #[no_mangle] -pub extern fn indy_register_transaction_parser_for_sp(command_handle: IndyHandle, +pub extern fn indy_register_transaction_parser_for_sp(command_handle: CommandHandle, txn_type: *const c_char, parser: Option, free: Option, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_register_transaction_parser_for_sp: >>> txn_type {:?}, parser {:?}, free {:?}", txn_type, parser, free); @@ -1804,9 +1804,9 @@ pub extern fn indy_register_transaction_parser_for_sp(command_handle: IndyHandle /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_get_response_metadata(command_handle: IndyHandle, +pub extern fn indy_get_response_metadata(command_handle: CommandHandle, response: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_response_metadata: >>> response: {:?}", response); @@ -1833,4 +1833,4 @@ pub extern fn indy_get_response_metadata(command_handle: IndyHandle, trace!("indy_get_response_metadata: <<< res: {:?}", res); res -} \ No newline at end of file +} diff --git a/libindy/src/api/mod.rs b/libindy/src/api/mod.rs index 4c3d6e33c6..241d57d897 100644 --- a/libindy/src/api/mod.rs +++ b/libindy/src/api/mod.rs @@ -19,6 +19,12 @@ use utils::ctypes; pub type IndyHandle = i32; +pub type WalletHandle = i32; +pub type PoolHandle = i32; +pub type CommandHandle = i32; +pub type StorageHandle = i32; +pub type SearchHandle = i32; + #[derive(Debug, PartialEq, Eq, Copy, Clone)] #[repr(i32)] pub enum ErrorCode @@ -292,4 +298,4 @@ pub extern fn indy_get_current_error(error_json_p: *mut *const c_char) { unsafe { *error_json_p = error }; trace!("indy_get_current_error: <<<"); -} \ No newline at end of file +} diff --git a/libindy/src/api/non_secrets.rs b/libindy/src/api/non_secrets.rs index 06b222933d..353f3ded99 100644 --- a/libindy/src/api/non_secrets.rs +++ b/libindy/src/api/non_secrets.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle, SearchHandle}; use commands::{Command, CommandExecutor}; use commands::non_secrets::NonSecretsCommand; use domain::wallet::Tags; @@ -30,13 +30,13 @@ use self::libc::c_char; /// usage of this tag in complex search queries (comparison, predicates) /// Encrypted tags can be searched only for exact matching #[no_mangle] -pub extern fn indy_add_wallet_record(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_add_wallet_record(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, value: *const c_char, tags_json: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_add_wallet_record: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, value: {:?}, tags_json: {:?}", wallet_handle, type_, id, value, tags_json); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -78,12 +78,12 @@ pub extern fn indy_add_wallet_record(command_handle: IndyHandle, /// id: the id of record /// value: the new value of record #[no_mangle] -pub extern fn indy_update_wallet_record_value(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_update_wallet_record_value(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, value: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_update_wallet_record_value: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, value: {:?}", wallet_handle, type_, id, value); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -132,12 +132,12 @@ pub extern fn indy_update_wallet_record_value(command_handle: IndyHandle, /// usage of this tag in complex search queries (comparison, predicates) /// Encrypted tags can be searched only for exact matching #[no_mangle] -pub extern fn indy_update_wallet_record_tags(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_update_wallet_record_tags(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, tags_json: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_update_wallet_record_tags: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, tags_json: {:?}", wallet_handle, type_, id, tags_json); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -188,12 +188,12 @@ pub extern fn indy_update_wallet_record_tags(command_handle: IndyHandle, /// Note if some from provided tags already assigned to the record than /// corresponding tags values will be replaced #[no_mangle] -pub extern fn indy_add_wallet_record_tags(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_add_wallet_record_tags(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, tags_json: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_add_wallet_record_tags: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, tags_json: {:?}", wallet_handle, type_, id, tags_json); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -234,12 +234,12 @@ pub extern fn indy_add_wallet_record_tags(command_handle: IndyHandle, /// tag_names_json: the list of tag names to remove from the record as json array: /// ["tagName1", "tagName2", ...] #[no_mangle] -pub extern fn indy_delete_wallet_record_tags(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_delete_wallet_record_tags(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, tag_names_json: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_delete_wallet_record_tags: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, tag_names_json: {:?}", wallet_handle, type_, id, tag_names_json); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -278,11 +278,11 @@ pub extern fn indy_delete_wallet_record_tags(command_handle: IndyHandle, /// type_: record type /// id: the id of record #[no_mangle] -pub extern fn indy_delete_wallet_record(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_delete_wallet_record(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_delete_wallet_record: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}", wallet_handle, type_, id); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -333,12 +333,12 @@ pub extern fn indy_delete_wallet_record(command_handle: IndyHandle, /// tags: , // present only if retrieveTags set to true /// } #[no_mangle] -pub extern fn indy_get_wallet_record(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_get_wallet_record(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, id: *const c_char, options_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_wallet_record: >>> wallet_handle: {:?}, type_: {:?}, id: {:?}, options_json: {:?}", wallet_handle, type_, id, options_json); @@ -400,13 +400,13 @@ pub extern fn indy_get_wallet_record(command_handle: IndyHandle, /// search_handle: Wallet search handle that can be used later /// to fetch records by small batches (with indy_fetch_wallet_search_next_records) #[no_mangle] -pub extern fn indy_open_wallet_search(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_open_wallet_search(command_handle: CommandHandle, + wallet_handle: WalletHandle, type_: *const c_char, query_json: *const c_char, options_json: *const c_char, - cb: Option) -> ErrorCode { + cb: Option) -> ErrorCode { trace!("indy_open_wallet_search: >>> wallet_handle: {:?}, type_: {:?}, query_json: {:?}, options_json: {:?}", wallet_handle, type_, query_json, options_json); check_useful_c_str!(type_, ErrorCode::CommonInvalidParam3); @@ -458,11 +458,11 @@ pub extern fn indy_open_wallet_search(command_handle: IndyHandle, /// }], /// } #[no_mangle] -pub extern fn indy_fetch_wallet_search_next_records(command_handle: IndyHandle, - wallet_handle: IndyHandle, - wallet_search_handle: IndyHandle, +pub extern fn indy_fetch_wallet_search_next_records(command_handle: CommandHandle, + wallet_handle: WalletHandle, + wallet_search_handle: SearchHandle, count: usize, - cb: Option) -> ErrorCode { trace!("indy_fetch_wallet_search_next_records: >>> wallet_handle: {:?}, wallet_search_handle: {:?}, count: {:?}", wallet_handle, wallet_search_handle, count); @@ -496,9 +496,9 @@ pub extern fn indy_fetch_wallet_search_next_records(command_handle: IndyHandle, /// #Params /// wallet_search_handle: wallet search handle #[no_mangle] -pub extern fn indy_close_wallet_search(command_handle: IndyHandle, - wallet_search_handle: IndyHandle, - cb: Option) -> ErrorCode { +pub extern fn indy_close_wallet_search(command_handle: CommandHandle, + wallet_search_handle: SearchHandle, + cb: Option) -> ErrorCode { trace!("indy_close_wallet_search: >>> wallet_search_handle: {:?}", wallet_search_handle); check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5); @@ -521,4 +521,4 @@ pub extern fn indy_close_wallet_search(command_handle: IndyHandle, trace!("indy_close_wallet_search: <<< res: {:?}", res); res -} \ No newline at end of file +} diff --git a/libindy/src/api/pairwise.rs b/libindy/src/api/pairwise.rs index 844eb42e52..3ad8396d90 100644 --- a/libindy/src/api/pairwise.rs +++ b/libindy/src/api/pairwise.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle}; use commands::{Command, CommandExecutor}; use commands::pairwise::PairwiseCommand; use errors::prelude::*; @@ -24,10 +24,10 @@ use self::libc::c_char; /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_is_pairwise_exists(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_is_pairwise_exists(command_handle: CommandHandle, + wallet_handle: WalletHandle, their_did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_is_pairwise_exists: >>> wallet_handle: {:?}, their_did: {:?}", wallet_handle, their_did); @@ -72,12 +72,12 @@ pub extern fn indy_is_pairwise_exists(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_create_pairwise(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_create_pairwise(command_handle: CommandHandle, + wallet_handle: WalletHandle, their_did: *const c_char, my_did: *const c_char, metadata: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_create_pairwise: >>> wallet_handle: {:?}, their_did: {:?}, my_did: {:?}, metadata: {:?}", wallet_handle, their_did, my_did, metadata); @@ -122,9 +122,9 @@ pub extern fn indy_create_pairwise(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_list_pairwise(command_handle: IndyHandle, - wallet_handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_list_pairwise: >>> wallet_handle: {:?}", wallet_handle); @@ -166,10 +166,10 @@ pub extern fn indy_list_pairwise(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_get_pairwise(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_get_pairwise(command_handle: CommandHandle, + wallet_handle: WalletHandle, their_did: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_get_pairwise: >>> wallet_handle: {:?}, their_did: {:?}", wallet_handle, their_did); @@ -214,11 +214,11 @@ pub extern fn indy_get_pairwise(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_set_pairwise_metadata(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_set_pairwise_metadata(command_handle: CommandHandle, + wallet_handle: WalletHandle, their_did: *const c_char, metadata: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_set_pairwise_metadata: >>> wallet_handle: {:?}, their_did: {:?}, metadata: {:?}", wallet_handle, their_did, metadata); @@ -245,4 +245,4 @@ pub extern fn indy_set_pairwise_metadata(command_handle: IndyHandle, trace!("indy_set_pairwise_metadata: <<< res: {:?}", res); res -} \ No newline at end of file +} diff --git a/libindy/src/api/payments.rs b/libindy/src/api/payments.rs index fa492fea7d..ad407c5c5e 100644 --- a/libindy/src/api/payments.rs +++ b/libindy/src/api/payments.rs @@ -1,7 +1,7 @@ extern crate libc; use self::libc::c_char; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, WalletHandle}; use commands::{Command, CommandExecutor}; use commands::payments::PaymentsCommand; use services::payments::PaymentsMethodCBs; @@ -27,10 +27,10 @@ use utils::ctypes; /// /// #Returns /// payment_address - public identifier of payment address in fully resolvable payment address format -pub type CreatePaymentAddressCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type CreatePaymentAddressCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, config: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -62,14 +62,14 @@ pub type CreatePaymentAddressCB = extern fn(command_handle: IndyHandle, /// /// #Returns /// req_with_fees_json - modified Indy request with added fees info -pub type AddRequestFeesCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type AddRequestFeesCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, req_json: *const c_char, inputs_json: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -87,9 +87,9 @@ pub type AddRequestFeesCB = extern fn(command_handle: IndyHandle, /// amount: , // amount /// extra: , // optional data from payment transaction /// }] -pub type ParseResponseWithFeesCB = extern fn(command_handle: IndyHandle, +pub type ParseResponseWithFeesCB = extern fn(command_handle: CommandHandle, resp_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -104,11 +104,11 @@ pub type ParseResponseWithFeesCB = extern fn(command_handle: IndyHandle, /// /// #Returns /// get_sources_txn_json - Indy request for getting sources list for payment address -pub type BuildGetPaymentSourcesRequestCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildGetPaymentSourcesRequestCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, payment_address: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -126,9 +126,9 @@ pub type BuildGetPaymentSourcesRequestCB = extern fn(command_handle: IndyHandle, /// amount: , // amount /// extra: , // optional data from payment transaction /// }] -pub type ParseGetPaymentSourcesResponseCB = extern fn(command_handle: IndyHandle, +pub type ParseGetPaymentSourcesResponseCB = extern fn(command_handle: CommandHandle, resp_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -156,13 +156,13 @@ pub type ParseGetPaymentSourcesResponseCB = extern fn(command_handle: IndyHandle /// /// #Returns /// payment_req_json - Indy request for doing payment -pub type BuildPaymentReqCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildPaymentReqCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, inputs_json: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -180,9 +180,9 @@ pub type BuildPaymentReqCB = extern fn(command_handle: IndyHandle, /// amount: , // amount /// extra: , // optional data from payment transaction /// }] -pub type ParsePaymentResponseCB = extern fn(command_handle: IndyHandle, +pub type ParsePaymentResponseCB = extern fn(command_handle: CommandHandle, resp_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -202,12 +202,12 @@ pub type ParsePaymentResponseCB = extern fn(command_handle: IndyHandle, /// /// #Returns /// mint_req_json - Indy request for doing minting -pub type BuildMintReqCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildMintReqCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -226,11 +226,11 @@ pub type BuildMintReqCB = extern fn(command_handle: IndyHandle, /// /// # Return /// set_txn_fees_json - Indy request for setting fees for transactions in the ledger -pub type BuildSetTxnFeesReqCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildSetTxnFeesReqCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, fees_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -243,10 +243,10 @@ pub type BuildSetTxnFeesReqCB = extern fn(command_handle: IndyHandle, /// /// # Return /// get_txn_fees_json - Indy request for getting fees for transactions in the ledger -pub type BuildGetTxnFeesReqCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildGetTxnFeesReqCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -263,9 +263,9 @@ pub type BuildGetTxnFeesReqCB = extern fn(command_handle: IndyHandle, /// ................. /// txnTypeN: amountN, /// } -pub type ParseGetTxnFeesResponseCB = extern fn(command_handle: IndyHandle, +pub type ParseGetTxnFeesResponseCB = extern fn(command_handle: CommandHandle, resp_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -279,11 +279,11 @@ pub type ParseGetTxnFeesResponseCB = extern fn(command_handle: IndyHandle, /// /// # Return /// verify_txn_json -- request to be sent to ledger -pub type BuildVerifyPaymentReqCB = extern fn(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub type BuildVerifyPaymentReqCB = extern fn(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, receipt: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -303,9 +303,9 @@ pub type BuildVerifyPaymentReqCB = extern fn(command_handle: IndyHandle, /// }, ] /// extra: , //optional data /// } -pub type ParseVerifyPaymentResponseCB = extern fn(command_handle: IndyHandle, +pub type ParseVerifyPaymentResponseCB = extern fn(command_handle: CommandHandle, resp_json: *const c_char, - cb: Option ErrorCode>) -> ErrorCode; @@ -333,7 +333,7 @@ pub type ParseVerifyPaymentResponseCB = extern fn(command_handle: IndyHandle, /// #Returns /// Error code #[no_mangle] -pub extern fn indy_register_payment_method(command_handle: IndyHandle, +pub extern fn indy_register_payment_method(command_handle: CommandHandle, payment_method: *const c_char, create_payment_address: Option, add_request_fees: Option, @@ -348,7 +348,7 @@ pub extern fn indy_register_payment_method(command_handle: IndyHandle, parse_get_txn_fees_response: Option, build_verify_payment_req: Option, parse_verify_payment_response: Option, - cb: Option) -> ErrorCode { trace!("indy_register_payment_method: >>> payment_method: {:?}", payment_method); @@ -425,11 +425,11 @@ pub extern fn indy_register_payment_method(command_handle: IndyHandle, /// #Returns /// payment_address - public identifier of payment address in fully resolvable payment address format #[no_mangle] -pub extern fn indy_create_payment_address(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_create_payment_address(command_handle: CommandHandle, + wallet_handle: WalletHandle, payment_method: *const c_char, config: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_create_payment_address: >>> wallet_handle: {:?}, payment_method: {:?}, config: {:?}", wallet_handle, payment_method, config); @@ -471,9 +471,9 @@ pub extern fn indy_create_payment_address(command_handle: IndyHandle, /// #Returns /// payment_addresses_json - json array of string with json addresses #[no_mangle] -pub extern fn indy_list_payment_addresses(command_handle: IndyHandle, - wallet_handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_list_payment_address: >>> wallet_handle: {:?}", wallet_handle); @@ -533,14 +533,14 @@ pub extern fn indy_list_payment_addresses(command_handle: IndyHandle, /// req_with_fees_json - modified Indy request with added fees info /// payment_method - used payment method #[no_mangle] -pub extern fn indy_add_request_fees(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_add_request_fees(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, req_json: *const c_char, inputs_json: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option) -> ErrorCode { @@ -598,10 +598,10 @@ pub extern fn indy_add_request_fees(command_handle: IndyHandle, /// extra: , // optional data from payment transaction /// }] #[no_mangle] -pub extern fn indy_parse_response_with_fees(command_handle: IndyHandle, +pub extern fn indy_parse_response_with_fees(command_handle: CommandHandle, payment_method: *const c_char, resp_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_parse_response_with_fees: >>> payment_method: {:?}, resp_json: {:?}", payment_method, resp_json); @@ -642,11 +642,11 @@ pub extern fn indy_parse_response_with_fees(command_handle: IndyHandle, /// get_sources_txn_json - Indy request for getting sources list for payment address /// payment_method - used payment method #[no_mangle] -pub extern fn indy_build_get_payment_sources_request(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_get_payment_sources_request(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, payment_address: *const c_char, - cb: Option) -> ErrorCode { @@ -696,10 +696,10 @@ pub extern fn indy_build_get_payment_sources_request(command_handle: IndyHandle, /// extra: , // optional data from payment transaction /// }] #[no_mangle] -pub extern fn indy_parse_get_payment_sources_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_payment_sources_response(command_handle: CommandHandle, payment_method: *const c_char, resp_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_parse_get_payment_sources_response: >>> payment_method: {:?}, resp_json: {:?}", payment_method, resp_json); @@ -756,13 +756,13 @@ pub extern fn indy_parse_get_payment_sources_response(command_handle: IndyHandle /// payment_req_json - Indy request for doing payment /// payment_method - used payment method #[no_mangle] -pub extern fn indy_build_payment_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_payment_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, inputs_json: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option) -> ErrorCode { @@ -818,10 +818,10 @@ pub extern fn indy_build_payment_req(command_handle: IndyHandle, /// extra: , // optional data from payment transaction /// }] #[no_mangle] -pub extern fn indy_parse_payment_response(command_handle: IndyHandle, +pub extern fn indy_parse_payment_response(command_handle: CommandHandle, payment_method: *const c_char, resp_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_parse_payment_response: >>> payment_method: {:?}, resp_json: {:?}", payment_method, resp_json); @@ -870,12 +870,12 @@ pub extern fn indy_parse_payment_response(command_handle: IndyHandle, /// mint_req_json - Indy request for doing minting /// payment_method - used payment method #[no_mangle] -pub extern fn indy_build_mint_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_mint_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, outputs_json: *const c_char, extra: *const c_char, - cb: Option) -> ErrorCode { @@ -927,12 +927,12 @@ pub extern fn indy_build_mint_req(command_handle: IndyHandle, /// # Return /// set_txn_fees_json - Indy request for setting fees for transactions in the ledger #[no_mangle] -pub extern fn indy_build_set_txn_fees_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_set_txn_fees_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, payment_method: *const c_char, fees_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_set_txn_fees_req: >>> wallet_handle: {:?}, submitter_did: {:?}, payment_method: {:?}, fees_json: {:?}", wallet_handle, submitter_did, payment_method, fees_json); @@ -977,11 +977,11 @@ pub extern fn indy_build_set_txn_fees_req(command_handle: IndyHandle, /// # Return /// get_txn_fees_json - Indy request for getting fees for transactions in the ledger #[no_mangle] -pub extern fn indy_build_get_txn_fees_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_get_txn_fees_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, payment_method: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_build_get_txn_fees_req: >>> wallet_handle: {:?}, submitter_did: {:?}, payment_method: {:?}", wallet_handle, submitter_did, payment_method); @@ -1028,10 +1028,10 @@ pub extern fn indy_build_get_txn_fees_req(command_handle: IndyHandle, /// txnTypeN: amountN, /// } #[no_mangle] -pub extern fn indy_parse_get_txn_fees_response(command_handle: IndyHandle, +pub extern fn indy_parse_get_txn_fees_response(command_handle: CommandHandle, payment_method: *const c_char, resp_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_parse_get_txn_fees_response: >>> payment_method: {:?}, resp_json: {:?}", payment_method, resp_json); @@ -1074,11 +1074,11 @@ pub extern fn indy_parse_get_txn_fees_response(command_handle: IndyHandle, /// verify_txn_json: Indy request for verification receipt /// payment_method: used payment method #[no_mangle] -pub extern fn indy_build_verify_payment_req(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_build_verify_payment_req(command_handle: CommandHandle, + wallet_handle: WalletHandle, submitter_did: *const c_char, receipt: *const c_char, - cb: Option) -> ErrorCode { @@ -1129,10 +1129,10 @@ pub extern fn indy_build_verify_payment_req(command_handle: IndyHandle, /// extra: , //optional data /// } #[no_mangle] -pub extern fn indy_parse_verify_payment_response(command_handle: IndyHandle, +pub extern fn indy_parse_verify_payment_response(command_handle: CommandHandle, payment_method: *const c_char, resp_json: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_parse_verify_payment_response: >>> resp_json: {:?}", resp_json); @@ -1160,4 +1160,4 @@ pub extern fn indy_parse_verify_payment_response(command_handle: IndyHandle, trace!("indy_parse_verify_payment_response: <<< result: {:?}", result); result -} \ No newline at end of file +} diff --git a/libindy/src/api/pool.rs b/libindy/src/api/pool.rs index de338c664f..b3f7e5ef90 100755 --- a/libindy/src/api/pool.rs +++ b/libindy/src/api/pool.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, CommandHandle, PoolHandle}; use commands::{Command, CommandExecutor}; use commands::pool::PoolCommand; use domain::pool::{PoolConfig, PoolOpenConfig}; @@ -27,10 +27,10 @@ use self::libc::c_char; /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_create_pool_ledger_config(command_handle: IndyHandle, +pub extern fn indy_create_pool_ledger_config(command_handle: CommandHandle, config_name: *const c_char, config: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_create_pool_ledger_config: >>> config_name: {:?}, config: {:?}", config_name, config); @@ -82,12 +82,12 @@ pub extern fn indy_create_pool_ledger_config(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_open_pool_ledger(command_handle: IndyHandle, +pub extern fn indy_open_pool_ledger(command_handle: CommandHandle, config_name: *const c_char, config: *const c_char, - cb: Option) -> ErrorCode { + pool_handle: PoolHandle)>) -> ErrorCode { trace!("indy_open_pool_ledger: >>> config_name: {:?}, config: {:?}", config_name, config); check_useful_c_str!(config_name, ErrorCode::CommonInvalidParam2); @@ -126,9 +126,9 @@ pub extern fn indy_open_pool_ledger(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_refresh_pool_ledger(command_handle: IndyHandle, - handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_refresh_pool_ledger: >>> handle: {:?}", handle); @@ -162,8 +162,8 @@ pub extern fn indy_refresh_pool_ledger(command_handle: IndyHandle, /// /// #Errors #[no_mangle] -pub extern fn indy_list_pools(command_handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_list_pools: >>>"); @@ -201,9 +201,9 @@ pub extern fn indy_list_pools(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_close_pool_ledger(command_handle: IndyHandle, - handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_close_pool_ledger: >>> handle: {:?}", handle); @@ -240,9 +240,9 @@ pub extern fn indy_close_pool_ledger(command_handle: IndyHandle, /// Common* /// Ledger* #[no_mangle] -pub extern fn indy_delete_pool_ledger_config(command_handle: IndyHandle, +pub extern fn indy_delete_pool_ledger_config(command_handle: CommandHandle, config_name: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_delete_pool_ledger_config: >>> config_name: {:?}", config_name); @@ -286,9 +286,9 @@ pub extern fn indy_delete_pool_ledger_config(command_handle: IndyHandle, /// #Errors /// Common* #[no_mangle] -pub extern fn indy_set_protocol_version(command_handle: IndyHandle, +pub extern fn indy_set_protocol_version(command_handle: CommandHandle, protocol_version: usize, - cb: Option) -> ErrorCode { trace!("indy_set_protocol_version: >>> protocol_version: {:?}", protocol_version); @@ -312,4 +312,4 @@ pub extern fn indy_set_protocol_version(command_handle: IndyHandle, trace!("indy_set_protocol_version: <<< res: {:?}", res); res -} \ No newline at end of file +} diff --git a/libindy/src/api/wallet.rs b/libindy/src/api/wallet.rs index 5e4288f58b..eca31552ed 100644 --- a/libindy/src/api/wallet.rs +++ b/libindy/src/api/wallet.rs @@ -1,6 +1,6 @@ extern crate libc; -use api::{ErrorCode, IndyHandle}; +use api::{ErrorCode, IndyHandle, CommandHandle, WalletHandle, SearchHandle, StorageHandle}; use commands::{Command, CommandExecutor}; use commands::wallet::WalletCommand; use domain::wallet::{Config, Credentials, ExportConfig, KeyConfig}; @@ -42,7 +42,7 @@ use self::libc::c_char; /// #Returns /// Error code #[no_mangle] -pub extern fn indy_register_wallet_storage(command_handle: IndyHandle, +pub extern fn indy_register_wallet_storage(command_handle: CommandHandle, type_: *const c_char, create: Option, open: Option, @@ -68,7 +68,7 @@ pub extern fn indy_register_wallet_storage(command_handle: IndyHandle, get_search_total_count: Option, fetch_search_next_record: Option, free_search: Option, - cb: Option) -> ErrorCode { trace!("indy_register_wallet_type: >>> command_handle: {:?}, type_: {:?}, cb: {:?}", command_handle, type_, cb); // TODO: Log all params @@ -182,10 +182,10 @@ pub extern fn indy_register_wallet_storage(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_create_wallet(command_handle: IndyHandle, +pub extern fn indy_create_wallet(command_handle: CommandHandle, config: *const c_char, credentials: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_create_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", command_handle, config, credentials, cb); @@ -263,10 +263,10 @@ pub extern fn indy_create_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_open_wallet(command_handle: IndyHandle, +pub extern fn indy_open_wallet(command_handle: CommandHandle, config: *const c_char, credentials: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_open_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", @@ -319,10 +319,10 @@ pub extern fn indy_open_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_export_wallet(command_handle: IndyHandle, - wallet_handle: IndyHandle, +pub extern fn indy_export_wallet(command_handle: CommandHandle, + wallet_handle: WalletHandle, export_config: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_export_wallet: >>> wallet_handle: {:?}, export_config: {:?}", wallet_handle, export_config); @@ -395,11 +395,11 @@ pub extern fn indy_export_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_import_wallet(command_handle: IndyHandle, +pub extern fn indy_import_wallet(command_handle: CommandHandle, config: *const c_char, credentials: *const c_char, import_config: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_import_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, import_config: {:?}, cb: {:?}", command_handle, config, credentials, import_config, cb); @@ -442,9 +442,9 @@ pub extern fn indy_import_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_close_wallet(command_handle: IndyHandle, - wallet_handle: IndyHandle, - cb: Option) -> ErrorCode { trace!("indy_close_wallet: >>> command_handle: {:?}, wallet_handle: {:?}, cb: {:?}", command_handle, wallet_handle, cb); @@ -508,10 +508,10 @@ pub extern fn indy_close_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_delete_wallet(command_handle: IndyHandle, +pub extern fn indy_delete_wallet(command_handle: CommandHandle, config: *const c_char, credentials: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_delete_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}", command_handle, config, credentials, cb); @@ -556,9 +556,9 @@ pub extern fn indy_delete_wallet(command_handle: IndyHandle, /// Common* /// Wallet* #[no_mangle] -pub extern fn indy_generate_wallet_key(command_handle: IndyHandle, +pub extern fn indy_generate_wallet_key(command_handle: CommandHandle, config: *const c_char, - cb: Option) -> ErrorCode { trace!("indy_generate_wallet_key: >>> command_handle: {:?}, config: {:?}, cb: {:?}", @@ -613,7 +613,7 @@ pub type WalletOpen = extern fn(name: *const c_char, /// /// #Params /// storage_handle: opened storage handle (See open handler) -pub type WalletClose = extern fn(storage_handle: IndyHandle) -> ErrorCode; +pub type WalletClose = extern fn(storage_handle: StorageHandle) -> ErrorCode; /// Delete the wallet storage (For example, database deletion) /// @@ -639,7 +639,7 @@ pub type WalletDelete = extern fn(name: *const c_char, /// "tagName2": 123, // numeric value /// } /// Note that null means no tags -pub type WalletAddRecord = extern fn(storage_handle: IndyHandle, +pub type WalletAddRecord = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, value: *const u8, @@ -654,7 +654,7 @@ pub type WalletAddRecord = extern fn(storage_handle: IndyHandle, /// id: the id of record /// value: the value of record (pointer to buffer) /// value_len: the value of record (buffer size) -pub type WalletUpdateRecordValue = extern fn(storage_handle: IndyHandle, +pub type WalletUpdateRecordValue = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, value: *const u8, @@ -672,7 +672,7 @@ pub type WalletUpdateRecordValue = extern fn(storage_handle: IndyHandle, /// "tagName2": 123, // numeric value /// } /// Note that null means no tags -pub type WalletUpdateRecordTags = extern fn(storage_handle: IndyHandle, +pub type WalletUpdateRecordTags = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, tags_json: *const c_char) -> ErrorCode; @@ -692,7 +692,7 @@ pub type WalletUpdateRecordTags = extern fn(storage_handle: IndyHandle, /// Note that null means no tags /// Note if some from provided tags already assigned to the record than /// corresponding tags values will be replaced -pub type WalletAddRecordTags = extern fn(storage_handle: IndyHandle, +pub type WalletAddRecordTags = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, tags_json: *const c_char) -> ErrorCode; @@ -706,7 +706,7 @@ pub type WalletAddRecordTags = extern fn(storage_handle: IndyHandle, /// tag_names_json: the list of tag names to remove from the record as json array: /// ["tagName1", "tagName2", ...] /// Note that null means no tag names -pub type WalletDeleteRecordTags = extern fn(storage_handle: IndyHandle, +pub type WalletDeleteRecordTags = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, tag_names_json: *const c_char) -> ErrorCode; @@ -717,7 +717,7 @@ pub type WalletDeleteRecordTags = extern fn(storage_handle: IndyHandle, /// storage_handle: opened storage handle (See open handler) /// type_: record type /// id: the id of record -pub type WalletDeleteRecord = extern fn(storage_handle: IndyHandle, +pub type WalletDeleteRecord = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char) -> ErrorCode; @@ -734,7 +734,7 @@ pub type WalletDeleteRecord = extern fn(storage_handle: IndyHandle, /// retrieveTags: (optional, true by default) Retrieve record tags /// } /// record_handle_p: pointer to store retrieved record handle -pub type WalletGetRecord = extern fn(storage_handle: IndyHandle, +pub type WalletGetRecord = extern fn(storage_handle: StorageHandle, type_: *const c_char, id: *const c_char, options_json: *const c_char, @@ -749,7 +749,7 @@ pub type WalletGetRecord = extern fn(storage_handle: IndyHandle, /// returns: record id /// Note that pointer lifetime the same as retrieved record lifetime /// (until record_free called) -pub type WalletGetRecordId = extern fn(storage_handle: IndyHandle, +pub type WalletGetRecordId = extern fn(storage_handle: StorageHandle, record_handle: IndyHandle, record_id_p: *mut *const c_char) -> ErrorCode; @@ -762,7 +762,7 @@ pub type WalletGetRecordId = extern fn(storage_handle: IndyHandle, /// returns: record type /// Note that pointer lifetime the same as retrieved record lifetime /// (until record_free called) -pub type WalletGetRecordType = extern fn(storage_handle: IndyHandle, +pub type WalletGetRecordType = extern fn(storage_handle: StorageHandle, record_handle: IndyHandle, record_type_p: *mut *const c_char) -> ErrorCode; @@ -776,7 +776,7 @@ pub type WalletGetRecordType = extern fn(storage_handle: IndyHandle, /// Note that pointer lifetime the same as retrieved record lifetime /// (until record_free called) /// Note that null be returned if no value retrieved -pub type WalletGetRecordValue = extern fn(storage_handle: IndyHandle, +pub type WalletGetRecordValue = extern fn(storage_handle: StorageHandle, record_handle: IndyHandle, record_value_p: *mut *const u8, record_value_len_p: *mut usize) -> ErrorCode; @@ -791,7 +791,7 @@ pub type WalletGetRecordValue = extern fn(storage_handle: IndyHandle, /// Note that pointer lifetime the same as retrieved record lifetime /// (until record_free called) /// Note that null be returned if no tags retrieved -pub type WalletGetRecordTags = extern fn(storage_handle: IndyHandle, +pub type WalletGetRecordTags = extern fn(storage_handle: StorageHandle, record_handle: IndyHandle, record_tags_p: *mut *const c_char) -> ErrorCode; @@ -800,7 +800,7 @@ pub type WalletGetRecordTags = extern fn(storage_handle: IndyHandle, /// #Params /// storage_handle: opened storage handle (See open_wallet_storage) /// record_handle: retrieved record handle (See wallet_storage_get_wallet_record) -pub type WalletFreeRecord = extern fn(storage_handle: IndyHandle, +pub type WalletFreeRecord = extern fn(storage_handle: StorageHandle, record_handle: IndyHandle) -> ErrorCode; /// Get storage metadata @@ -810,7 +810,7 @@ pub type WalletFreeRecord = extern fn(storage_handle: IndyHandle, /// /// returns: metadata as base64 value /// Note that pointer lifetime is static -pub type WalletGetStorageMetadata = extern fn(storage_handle: IndyHandle, +pub type WalletGetStorageMetadata = extern fn(storage_handle: StorageHandle, metadata_p: *mut *const c_char, metadata_handle: *mut IndyHandle) -> ErrorCode; @@ -821,7 +821,7 @@ pub type WalletGetStorageMetadata = extern fn(storage_handle: IndyHandle, /// metadata_p: base64 value of metadata /// /// Note if storage already have metadata record it will be overwritten. -pub type WalletSetStorageMetadata = extern fn(storage_handle: IndyHandle, +pub type WalletSetStorageMetadata = extern fn(storage_handle: StorageHandle, metadata_p: *const c_char) -> ErrorCode; /// Free retrieved storage metadata record (make retrieved storage metadata handle invalid) @@ -829,7 +829,7 @@ pub type WalletSetStorageMetadata = extern fn(storage_handle: IndyHandle, /// #Params /// storage_handle: opened storage handle (See open_wallet_storage) /// metadata_handle: retrieved record handle (See wallet_storage_get_storage_metadata) -pub type WalletFreeStorageMetadata = extern fn(storage_handle: IndyHandle, +pub type WalletFreeStorageMetadata = extern fn(storage_handle: StorageHandle, metadata_handle: IndyHandle) -> ErrorCode; /// Search for wallet storage records @@ -854,19 +854,19 @@ pub type WalletFreeStorageMetadata = extern fn(storage_handle: IndyHandle, /// retrieveTags: (optional, true by default) Retrieve record tags, /// } /// search_handle_p: pointer to store wallet search handle -pub type WalletSearchRecords = extern fn(storage_handle: IndyHandle, +pub type WalletSearchRecords = extern fn(storage_handle: StorageHandle, type_: *const c_char, query_json: *const c_char, options_json: *const c_char, - search_handle_p: *mut IndyHandle) -> ErrorCode; + search_handle_p: *mut SearchHandle) -> ErrorCode; /// Search for all wallet storage records /// /// #Params /// storage_handle: opened storage handle (See open handler) /// search_handle_p: pointer to store wallet search handle -pub type WalletSearchAllRecords = extern fn(storage_handle: IndyHandle, - search_handle_p: *mut IndyHandle) -> ErrorCode; +pub type WalletSearchAllRecords = extern fn(storage_handle: StorageHandle, + search_handle_p: *mut SearchHandle) -> ErrorCode; /// Get total count of records that corresponds to wallet storage search query /// @@ -876,8 +876,8 @@ pub type WalletSearchAllRecords = extern fn(storage_handle: IndyHandle, /// /// returns: total count of records that corresponds to wallet storage search query /// Note -1 will be returned if retrieveTotalCount set to false for search_records -pub type WalletGetSearchTotalCount = extern fn(storage_handle: IndyHandle, - search_handle: IndyHandle, +pub type WalletGetSearchTotalCount = extern fn(storage_handle: StorageHandle, + search_handle: SearchHandle, total_count_p: *mut usize) -> ErrorCode; /// Get the next wallet storage record handle retrieved by this wallet search. @@ -888,8 +888,8 @@ pub type WalletGetSearchTotalCount = extern fn(storage_handle: IndyHandle, /// /// returns: record handle (the same as for get_record handler) /// Note if no more records WalletNoRecords error will be returned -pub type WalletFetchSearchNextRecord = extern fn(storage_handle: IndyHandle, - search_handle: IndyHandle, +pub type WalletFetchSearchNextRecord = extern fn(storage_handle: StorageHandle, + Search_handle: SearchHandle, record_handle_p: *mut IndyHandle) -> ErrorCode; /// Free wallet search (make search handle invalid) @@ -897,5 +897,5 @@ pub type WalletFetchSearchNextRecord = extern fn(storage_handle: IndyHandle, /// #Params /// storage_handle: opened storage handle (See open handler) /// search_handle: wallet search handle (See search_records handler) -pub type WalletFreeSearch = extern fn(storage_handle: IndyHandle, - search_handle: IndyHandle) -> ErrorCode; +pub type WalletFreeSearch = extern fn(storage_handle: StorageHandle, + Search_handle: SearchHandle) -> ErrorCode; From 49a509f9f0f7685c845c99aa43c65e5835bd999e Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 28 Feb 2019 14:54:52 +0300 Subject: [PATCH 06/21] Corrected response handling in Consensus state Signed-off-by: artem.ivanov --- libindy/src/services/pool/request_handler.rs | 29 ++++++++++---------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 678cf83900..6b32bc4292 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -311,7 +311,7 @@ impl RequestSM { RequestEvent::Reply(_, raw_msg, node_alias, req_id) | RequestEvent::ReqNACK(_, raw_msg, node_alias, req_id) | RequestEvent::Reject(_, raw_msg, node_alias, req_id) - => { + => { if let Ok((_, result_without_proof)) = _get_msg_result_without_state_proof(&raw_msg) { let hashable = HashableValue { inner: result_without_proof }; @@ -335,7 +335,12 @@ impl RequestSM { (RequestState::finish(), None) } } else { - (RequestState::Consensus(state), None) + state.denied_nodes.insert(node_alias.clone()); + if state.denied_nodes.len() + state.replies.len() == nodes.len() { + (RequestState::finish(), None) + } else { + (RequestState::Consensus(state), None) + } } } RequestEvent::ReqACK(_, _, node_alias, req_id) => { @@ -385,9 +390,9 @@ impl RequestSM { trace!("Last signed time: {}", last_write_time); if cnt > f || _check_state_proof(&result, f, &generator, &nodes, &raw_msg) - && (_get_freshness_threshold() == u64::MAX || _get_cur_time() as u64 <= _get_freshness_threshold() + last_write_time) { + && (_get_freshness_threshold() == u64::MAX || _get_cur_time() as u64 <= _get_freshness_threshold() + last_write_time) { state.networker.borrow_mut().process_event(Some(NetworkerEvent::CleanTimeout(req_id, None))); - _send_ok_replies(&cmd_ids, if cnt > f {&soonest} else {&raw_msg}); + _send_ok_replies(&cmd_ids, if cnt > f { &soonest } else { &raw_msg }); (RequestState::finish(), None) } else { (state.try_to_continue(req_id, node_alias, &cmd_ids, nodes.len(), timeout), None) @@ -998,17 +1003,13 @@ pub mod tests { request_handler.process_event(Some(RequestEvent::Reject(Response::default(), REJECT_REPLY.to_string(), NODE_4.to_string(), REQ_ID.to_string()))); assert_match!(RequestState::Finish(_), request_handler.request_wrapper.unwrap().state); - } - // this test is marked ignore until https://jira.hyperledger.org/browse/IS-1137 is resolved #[test] - #[ignore] fn request_handler_process_reply_event_from_consensus_state_works_for_consensus_reached_with_0_concensus() { - // the test will use 4 nodes, each node replying with a response to the "custom consensus request" message // some nodes accept, some reject and some nack. the end result is consensus should not be reached - let mut request_handler = _request_handler(0, 4); + let mut request_handler = _request_handler(1, 4); request_handler.process_event(Some(RequestEvent::CustomConsensusRequest(MESSAGE.to_string(), REQ_ID.to_string()))); request_handler.process_event(Some(RequestEvent::Reply(Reply::default(), SIMPLE_REPLY.to_string(), NODE.to_string(), REQ_ID.to_string()))); @@ -1045,7 +1046,7 @@ pub mod tests { #[test] fn request_handler_process_reply_event_from_consensus_state_works_for_invalid_message() { - let mut request_handler = _request_handler(0, 1); + let mut request_handler = _request_handler(1, 4); request_handler.process_event(Some(RequestEvent::CustomConsensusRequest(MESSAGE.to_string(), REQ_ID.to_string()))); request_handler.process_event(Some(RequestEvent::Reply(Reply::default(), "".to_string(), NODE.to_string(), REQ_ID.to_string()))); assert_match!(RequestState::Consensus(_), request_handler.request_wrapper.unwrap().state); @@ -1053,7 +1054,7 @@ pub mod tests { #[test] fn request_handler_process_reqack_event_from_consensus_state_works() { - let mut request_handler = _request_handler(0, 1); + let mut request_handler = _request_handler(1, 4); request_handler.process_event(Some(RequestEvent::CustomConsensusRequest(MESSAGE.to_string(), REQ_ID.to_string()))); request_handler.process_event(Some(RequestEvent::ReqACK(Response::default(), "{}".to_string(), NODE.to_string(), REQ_ID.to_string()))); assert_match!(RequestState::Consensus(_), request_handler.request_wrapper.unwrap().state); @@ -1135,7 +1136,7 @@ pub mod tests { #[test] fn request_handler_process_other_event_from_consensus_state_works() { - let mut request_handler = _request_handler(0, 1); + let mut request_handler = _request_handler(1, 4); request_handler.process_event(Some(RequestEvent::CustomConsensusRequest(MESSAGE.to_string(), REQ_ID.to_string()))); request_handler.process_event(Some(RequestEvent::Ping)); assert_match!(RequestState::Consensus(_), request_handler.request_wrapper.unwrap().state); @@ -1225,8 +1226,8 @@ pub mod tests { request_handler.process_event(Some(RequestEvent::Reply( Reply::default(), correct_state_proof_reply(_get_cur_time() - 700), - NODE.to_string(), - REQ_ID.to_string()))); + NODE.to_string(), + REQ_ID.to_string()))); { let request_handler_ref = request_handler.request_wrapper.as_ref().unwrap(); From 4a0cef885f745316573b9707b560ba819dd3256f Mon Sep 17 00:00:00 2001 From: Ryan Marsh Date: Fri, 1 Mar 2019 17:26:42 -0700 Subject: [PATCH 07/21] updates libindy search creds to allow a proof request with an empty vector of values Signed-off-by: Ryan Marsh --- libindy/src/services/anoncreds/prover.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/libindy/src/services/anoncreds/prover.rs b/libindy/src/services/anoncreds/prover.rs index f4bd2cf3a6..6e8a6ad1f8 100644 --- a/libindy/src/services/anoncreds/prover.rs +++ b/libindy/src/services/anoncreds/prover.rs @@ -333,9 +333,11 @@ impl Prover { res.push(serde_json::Value::Object(sub_query)); } - sub_queries.push(serde_json::Value::Object(serde_map!( + if !res.is_empty() { + sub_queries.push(serde_json::Value::Object(serde_map!( "$or".to_string() => serde_json::Value::Array(res) - ))); + ))); + } } Some(&serde_json::Value::Object(ref object)) => { sub_queries.push(serde_json::Value::Object(object.clone())); @@ -582,6 +584,20 @@ mod tests { assert_eq!(expected_query, _value(&query)); } + #[test] + fn build_query_works_for_empty_restrictions() { + let ps = Prover::new(); + let query = ps.build_query(ATTR_NAME, ATTR_REFERENT, &Some(json!([])), &None).unwrap(); + let expected_query = json!({ + "$and": vec![ + json!({ + "attr::name::marker": ATTRIBUTE_EXISTENCE_MARKER + }) + ] + }); + assert_eq!(expected_query, _value(&query)); + } + #[test] fn build_query_works_for_extra_query() { let ps = Prover::new(); From fc1d5df0cf9f65b4fb5f9c75fece2d379d90e06f Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 4 Mar 2019 12:16:48 +0300 Subject: [PATCH 08/21] Added sending replies to nodes Signed-off-by: artem.ivanov --- libindy/src/services/pool/request_handler.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libindy/src/services/pool/request_handler.rs b/libindy/src/services/pool/request_handler.rs index 6b32bc4292..f0f057943c 100644 --- a/libindy/src/services/pool/request_handler.rs +++ b/libindy/src/services/pool/request_handler.rs @@ -337,6 +337,7 @@ impl RequestSM { } else { state.denied_nodes.insert(node_alias.clone()); if state.denied_nodes.len() + state.replies.len() == nodes.len() { + _send_replies(&cmd_ids, Err(err_msg(IndyErrorKind::PoolTimeout, "Consensus is impossible"))); (RequestState::finish(), None) } else { (RequestState::Consensus(state), None) From ab9802009ecf9b6cccc6daac67c422a997511a7b Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Fri, 15 Feb 2019 17:22:43 +0100 Subject: [PATCH 09/21] Make python VCX wrapper demo work out of the box on OSX. Signed-off-by: Patrik Stas --- vcx/wrappers/python3/demo/alice.py | 5 +++-- vcx/wrappers/python3/demo/demo_utils.py | 13 +++++-------- vcx/wrappers/python3/demo/faber.py | 4 +++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vcx/wrappers/python3/demo/alice.py b/vcx/wrappers/python3/demo/alice.py index 8f378141bb..cb82cb2b9f 100644 --- a/vcx/wrappers/python3/demo/alice.py +++ b/vcx/wrappers/python3/demo/alice.py @@ -2,9 +2,11 @@ import json from ctypes import cdll from time import sleep +import platform import logging +from demo_utils import file_ext from vcx.api.connection import Connection from vcx.api.credential import Credential from vcx.api.disclosed_proof import DisclosedProof @@ -24,10 +26,9 @@ 'enterprise_seed': '000000000000000000000000Trustee1' } - async def main(): - payment_plugin = cdll.LoadLibrary("libnullpay.so") + payment_plugin = cdll.LoadLibrary('libnullpay' + file_ext()) payment_plugin.nullpay_init() print("#7 Provision an agent and wallet, get back configuration details") diff --git a/vcx/wrappers/python3/demo/demo_utils.py b/vcx/wrappers/python3/demo/demo_utils.py index 7c4e6def3b..f5dffae9bf 100644 --- a/vcx/wrappers/python3/demo/demo_utils.py +++ b/vcx/wrappers/python3/demo/demo_utils.py @@ -221,15 +221,12 @@ async def handle_proof_request(my_connection, request): print("Sent") +EXTENSION = {"darwin": ".dylib", "linux": ".so", "win32": ".dll", 'windows': '.dll'} + + def file_ext(): - if platform.system() == 'Linux': - return '.so' - elif platform.system() == 'Darwin': - return '.dylib' - elif platform.system() == 'Windows': - return '.dll' - else: - return '.so' + your_platform = platform.system().lower() + return EXTENSION[your_platform] if (your_platform in EXTENSION) else '.so' # load postgres dll and configure postgres wallet diff --git a/vcx/wrappers/python3/demo/faber.py b/vcx/wrappers/python3/demo/faber.py index c90f6f4fca..fad8209e59 100644 --- a/vcx/wrappers/python3/demo/faber.py +++ b/vcx/wrappers/python3/demo/faber.py @@ -3,9 +3,11 @@ import random from ctypes import cdll from time import sleep +import platform import logging +from demo_utils import file_ext from vcx.api.connection import Connection from vcx.api.credential_def import CredentialDef from vcx.api.issuer_credential import IssuerCredential @@ -36,7 +38,7 @@ async def main(): - payment_plugin = cdll.LoadLibrary("libnullpay.so") + payment_plugin = cdll.LoadLibrary('libnullpay' + file_ext()) payment_plugin.nullpay_init() print("#1 Provision an agent and wallet, get back configuration details") From 4f5efb0b85d6f8f04058231caf9daddf066648ed Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 6 Mar 2019 09:26:43 +0300 Subject: [PATCH 10/21] Fixed compilation error in dummy-agent Signed-off-by: artem.ivanov --- vcx/dummy-cloud-agent/src/domain/payload.rs | 31 ++++++++++----------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/vcx/dummy-cloud-agent/src/domain/payload.rs b/vcx/dummy-cloud-agent/src/domain/payload.rs index 794ef2d8cc..7e99c17fec 100644 --- a/vcx/dummy-cloud-agent/src/domain/payload.rs +++ b/vcx/dummy-cloud-agent/src/domain/payload.rs @@ -95,23 +95,20 @@ impl PayloadKinds { } impl PayloadTypes { - pub fn build(kind: PayloadKinds) -> PayloadTypes { - match ProtocolType::get() { - ProtocolTypes::V1 => { - PayloadTypes::PayloadTypeV1(PayloadTypeV1 { - name: kind.name().to_string(), - ver: MESSAGE_VERSION_V1.to_string(), - fmt: "json".to_string(), - }) - } - ProtocolTypes::V2 => { - PayloadTypes::PayloadTypeV2(PayloadTypeV2 { - did: DID.to_string(), - family: kind.family(), - version: kind.family().version().to_string(), - type_: kind.name().to_string(), - }) - } + pub fn build_v1(kind: PayloadKinds, fmt: &str) -> PayloadTypeV1 { + PayloadTypeV1 { + name: kind.name().to_string(), + ver: MESSAGE_VERSION_V1.to_string(), + fmt: fmt.to_string(), + } + } + + pub fn build_v2(kind: PayloadKinds) -> PayloadTypeV2 { + PayloadTypeV2 { + did: DID.to_string(), + family: kind.family(), + version: kind.family().version().to_string(), + type_: kind.name().to_string(), } } } From cb164e17958e51c37123d9a1011c14e2ef59234c Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Thu, 7 Mar 2019 08:46:15 +0300 Subject: [PATCH 11/21] IS-1210 Fixed packaging of vcx nodejs wrapper Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 56 +++++++++++++++++++++------------- vcx/wrappers/node/package.json | 2 +- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index a6fbc4e9bb..5f8604754a 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -36,7 +36,7 @@ try { def testing() { stage('Static Analysis') { - staticValidation() + staticValidation() } stage('Testing') { parallel([ @@ -104,10 +104,10 @@ def notifyingFailure() { def staticValidation() { parallel([ - 'libindy' : { runValdiationRust('libindy') }, - 'libnullpay' : { runValdiationRust('libnullpay') }, - 'libvcx' : { runValdiationRust('vcx/libvcx') }, - 'cli' : { runValdiationRust('cli') } + 'libindy' : { runValdiationRust('libindy') }, + 'libnullpay': { runValdiationRust('libnullpay') }, + 'libvcx' : { runValdiationRust('vcx/libvcx') }, + 'cli' : { runValdiationRust('cli') } ]) } @@ -533,7 +533,7 @@ def linuxVcxJavaTesting(env_name, network_name, testEnv, stashBuildResults) { def linuxVcxPythonTesting(env_name, network_name, testEnv, stashBuildResults) { unstash name: "VcxPythonLibvcxSO${env_name}" unstash name: "VcxPythonLibindyAndLibnullpaySO${env_name}" - + dir('vcx/wrappers/python3') { testEnv.inside { echo "${env_name} Vcx Test: Test python wrapper" @@ -745,7 +745,7 @@ def iosTesting() { createSimulators() withEnv([ - "BUNDLE_PATH=$HOME/.gem.indy_sdk" + "BUNDLE_PATH=$HOME/.gem.indy_sdk" ]) { dir('wrappers/ios') { echo "iOS Test: Installing ruby, bundler and gems" @@ -881,7 +881,7 @@ def ubuntuPublishing() { libindyDebPublishing(testEnv, libindyVersion) pythonWrapperPublishing(testEnv, false, 'wrappers/python', 'libindy') - nodejsWrapperPublishing(testEnv, false, 'wrappers/nodejs', 'libindy') + nodejsWrapperPublishing(testEnv, false, 'libindy') javaWrapperPublishing(testEnv, false) rustWrapperPublishing(testEnv, false) libindyCliDebPublishing(testEnv, libindyVersion) @@ -889,7 +889,7 @@ def ubuntuPublishing() { libvcxDebPublishing(testEnv) vcxJavaWrapperPublishing(testEnv, false) pythonWrapperPublishing(testEnv, false, 'vcx/wrappers/python3', 'vcx/libvcx') - nodejsWrapperPublishing(testEnv, false, 'vcx/wrappers/node', 'vcx/libvcx') + nodejsWrapperPublishing(testEnv, false,'vcx') } finally { echo 'Publish Ubuntu files: Cleanup' @@ -984,7 +984,7 @@ def windowsPublishArtifact(testEnv, folder, packageName, packageType, packageVer withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) { withEnv([ - "SOVRIN_REPO_HOST=$SOVRIN_REPO_HOST", + "SOVRIN_REPO_HOST=$SOVRIN_REPO_HOST", ]) { sh "ci/win-zip-and-upload.sh $folder $packageName $packageType $packageVersion '${repo_key}' $env.BRANCH_NAME $env.BUILD_NUMBER" } @@ -1132,21 +1132,33 @@ def pythonWrapperPublishing(testEnv, isRelease, directory, base_library) { } } -def nodejsWrapperPublishing(testEnv, isRelease, directory, base_library) { - def version = getSrcVersion(base_library) +def nodejsWrapperPublishing(testEnv, isRelease, library) { + def paths = ['libindy': ['dir': 'wrappers/nodejs', 'base_library': 'libindy'], + 'vcx' : ['dir': 'vcx/wrappers/node', 'base_library': 'vcx/libvcx']] + + def version = getSrcVersion(paths[library]['base_library']) + def suffix = getSuffix(isRelease, "nodejs") - testEnv.inside { - withCredentials([file(credentialsId: 'npm_credentials', variable: 'credentialsFile')]) { - sh 'cp $credentialsFile ~/.npmrc' + dir(paths[library]['dir']) { + testEnv.inside { + if (library == 'vcx') { // need addition step for VCX to create .js files + sh "npm run compile" + } - sh "cd $directory && " + - "npm version --no-git-tag-version --allow-same-version $version$suffix &&" + - "npm publish" + npmPublish(version, suffix) } } } +def npmPublish(version, suffix) { + withCredentials([file(credentialsId: 'npm_credentials', variable: 'credentialsFile')]) { + sh 'cp $credentialsFile ~/.npmrc' + sh "npm version --no-git-tag-version --allow-same-version $version$suffix" + sh "npm publish" + } +} + def javaWrapperPublishing(testEnv, isRelease) { dir('wrappers/java') { echo "Publish To Maven Test: Build docker image" @@ -1186,7 +1198,7 @@ def vcxJavaWrapperPublishing(testEnv, isRelease) { sh "chmod +x ci/publishJar.sh" withEnv([ - "MAVEN_ADD_OPTIONS=$mavenDeployAddOptions", + "MAVEN_ADD_OPTIONS=$mavenDeployAddOptions", ]) { sh 'ci/publishJar.sh' } @@ -1224,7 +1236,7 @@ def publishingRCtoStable() { pythonWrapperPublishing(testEnv, true, 'wrappers/python', 'libindy') echo 'Moving Ubuntu RC artifacts to Stable: nodejs wrapper' - nodejsWrapperPublishing(testEnv, true, 'wrappers/nodejs', 'libindy') + nodejsWrapperPublishing(testEnv, true, 'libindy') echo 'Moving Ubuntu RC artifacts to Stable: java wrapper' javaWrapperPublishing(testEnv, true) @@ -1257,7 +1269,7 @@ def publishingRCtoStable() { pythonWrapperPublishing(testEnv, true, 'vcx/wrappers/python3', 'vcx/libvcx') echo 'Moving Ubuntu RC artifacts to Stable: vcx nodejs wrapper' - nodejsWrapperPublishing(testEnv, true, 'vcx/wrappers/node', 'vcx/libvcx') + nodejsWrapperPublishing(testEnv, true, 'vcx') echo 'Moving Android RC artifacts to Stable: libindy' publishLibindAndroidFilesRCtoStable(libindyVersion) @@ -1496,7 +1508,7 @@ def androidPublishArtifact(buildEnv, arch, packageVersion, artifact) { withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) { withEnv([ - "SOVRIN_REPO_HOST=$SOVRIN_REPO_HOST", + "SOVRIN_REPO_HOST=$SOVRIN_REPO_HOST", ]) { sh "ci/android-zip-and-upload.sh $arch $packageVersion '${repo_key}' $env.BRANCH_NAME $env.BUILD_NUMBER $artifact" } diff --git a/vcx/wrappers/node/package.json b/vcx/wrappers/node/package.json index 7b18d8763c..a3dfa7942c 100644 --- a/vcx/wrappers/node/package.json +++ b/vcx/wrappers/node/package.json @@ -57,7 +57,7 @@ "typedoc": "0.11.1", "typescript": "^2.9.1" }, - "main": "dist/index.js", + "main": "dist/src/index.js", "homepage": "https://github.com/evernym/vcx#readme", "name": "node-vcx-wrapper" } From 2468102959ccd5d7e281c94cf2ce004169d2c13f Mon Sep 17 00:00:00 2001 From: Michael Boyd Date: Fri, 8 Mar 2019 13:59:31 +0800 Subject: [PATCH 12/21] added the chinese version of indy-walkthrough Signed-off-by: Michael Boyd --- docs/zh/indy-walkthrough-zh.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/zh/indy-walkthrough-zh.md diff --git a/docs/zh/indy-walkthrough-zh.md b/docs/zh/indy-walkthrough-zh.md new file mode 100644 index 0000000000..4668acd50b --- /dev/null +++ b/docs/zh/indy-walkthrough-zh.md @@ -0,0 +1,24 @@ +## 什麼是 Indy 和 Libindy,還有為什麼它們那麼重要? + +Indy 提供一個私密、安全、身份的生態系統,而Libindy 為它提供客戶端。Indy 使人 -- 而不是傳統機構 -- 控制他們的個人資料以及如何公開。它令各種創新變得可能:授權、嶄新的支付流程、資產及文件管理、不同形式的委託、聲譽累積、與其他新技術整合等等。 + +Indy使用開源的分佈賬戶技術。這個賬戶是由一群參與者合作建立的一種數據庫,而非一個中央管理的大規模數據庫。數據冗餘地存在於多個地方,而由多部參與的電腦(機器)的交易所構成,透過大而有力的加密標準加以保護。它的設計充分使用密鑰管理和網絡安全的最佳實踐模式。所得的結果是一個可靠、公共的信任源頭,不受單一個體所控制,系統堅實而不受人侵駭入,足以抵禦其他個體敵意的破壞和顛覆。 + +如果你對加密學概念和區塊鏈技術還有疑惑,不用害怕,這指南會給你介紹Indy的主要概念,你來對地方了。 + +## 我们要讨论什么? +我们的目标是向你介绍很多关于 Indy 的概念,帮助你来理解让这一起工作起来的背后的原因。 + +我们会将整个过程编为一个故事。Alice,一个虚构的 Faber 大学的毕业生,想要应聘一家虚构的公司 Acme Corp 的一份工作。当她获得了这份工作后,她想要向 Thrift 银行申请一笔贷款,这样她就可以购买一辆汽车了。在工作申请表单上,她想用她的大学成绩单作为受过教育证明,并且一旦被录用后,Alice 想使用被雇佣的事实来作为申请贷款的信誉凭证。 + +在当今的世界里,身份信息以及信任交互非常混乱,它们很慢,与隐私性相违背,容易受到欺诈。我们将会展示给你 Indy 是如何让这些产生了巨大的进步。 + +作为 Faber 大学的毕业生,Alice 收到了一封毕业生的 newsletter,从中了解到她的母校可以提供数字成绩单(digital transcripts)。她登录了学校的毕业生网站,通过点击 获得成绩单 按钮,她申请了自己的成绩单。(其他的发起这个请求的方式还可能包括扫描一个 QR code,从一个公共的 URL 下载一份打包的成绩单,等等) + +## About Alice + +Alice 还没有意识到,想要使用这个数字的成绩单,她需要一个新的类型的身份信息 - 并不是 Faber 大学存储在在校(on-campus)数据库中为她创建的传统的身份信息,而是一个属于她自己的全新的便携的身份信息,独立于所有的过去和将来的关系,不经过她的允许,没有人能够废除(revoke)、指派(co-opt)或者关联(correlate)这个身份信息。这就是一个 自我主权的身份信息(self-sovereign identity),也是 Indy 的核心功能。 + +在常规的情况下,管理一个自我主权的身份信息会要求使用 一个工具,比如一个桌面的或者手机的应用程序。它可能是一个独立的应用,或者使用一个第三方的服务机构(代理商)提供的账本服务。Sovrin 基金会(Sovrin Foundation)发布了一个这种类型的工具。Faber 大学了解了这些需求,并会建议 Alice 安装一个 Indy app 如果她没有安装过的话。这个 app 会作为点击 获得成绩单 按钮之后的工作流中的一部分而被安装。 + +在常规的情况下,管理一个自我主权的身份信息会要求使用 一个工具,比如一个桌面的或者手机的应用程序。它可能是一个独立的应用,或者使用一个第三方的服务机构(代理商)提供的账本服务。Sovrin 基金会(Sovrin Foundation)发布了一个这种类型的工具。Faber 大学了解了这些需求,并会建议 Alice 安装一个 Indy app 如果她没有安装过的话。这个 app 会作为点击 获得成绩单 按钮之后的工作流中的一部分而被安装。 From b7b85bc7dcf6e43688658b6d29a260b499d28b9a Mon Sep 17 00:00:00 2001 From: Michael Boyd Date: Fri, 8 Mar 2019 14:09:26 +0800 Subject: [PATCH 13/21] added another paragraph Signed-off-by: Michael Boyd --- docs/zh/indy-walkthrough-zh.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/zh/indy-walkthrough-zh.md b/docs/zh/indy-walkthrough-zh.md index 4668acd50b..89469543dd 100644 --- a/docs/zh/indy-walkthrough-zh.md +++ b/docs/zh/indy-walkthrough-zh.md @@ -22,3 +22,6 @@ Alice 还没有意识到,想要使用这个数字的成绩单,她需要一 在常规的情况下,管理一个自我主权的身份信息会要求使用 一个工具,比如一个桌面的或者手机的应用程序。它可能是一个独立的应用,或者使用一个第三方的服务机构(代理商)提供的账本服务。Sovrin 基金会(Sovrin Foundation)发布了一个这种类型的工具。Faber 大学了解了这些需求,并会建议 Alice 安装一个 Indy app 如果她没有安装过的话。这个 app 会作为点击 获得成绩单 按钮之后的工作流中的一部分而被安装。 在常规的情况下,管理一个自我主权的身份信息会要求使用 一个工具,比如一个桌面的或者手机的应用程序。它可能是一个独立的应用,或者使用一个第三方的服务机构(代理商)提供的账本服务。Sovrin 基金会(Sovrin Foundation)发布了一个这种类型的工具。Faber 大学了解了这些需求,并会建议 Alice 安装一个 Indy app 如果她没有安装过的话。这个 app 会作为点击 获得成绩单 按钮之后的工作流中的一部分而被安装。 + + +当 Alice 点击了 获得成绩单 按钮后,她会下载一个带有一个 Indy 连接请求 的文件。这个连接请求文件的扩展名为 .indy,并且会和 Alice 的 Indy app 相关联,将会允许 Alice 创建跟另外一个在这个账本生态圈(ledger ecosystem)存在的一方(Faber 大学)的一个安全的信息沟通频道(channel)。 From 015e37142ae612f1f12fb278ccbeeadb191ee368 Mon Sep 17 00:00:00 2001 From: Atsushi Neki Date: Fri, 8 Mar 2019 14:15:41 +0800 Subject: [PATCH 14/21] Fix some broken links 'Indy Walkthrough' doc Signed-off-by: Atsushi Neki --- docs/getting-started/indy-walkthrough.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/indy-walkthrough.md b/docs/getting-started/indy-walkthrough.md index c2d8396bb6..10c40df9e5 100644 --- a/docs/getting-started/indy-walkthrough.md +++ b/docs/getting-started/indy-walkthrough.md @@ -64,11 +64,11 @@ The ledger is intended to store **Identity Records** that describe a **Ledger En In this tutorial we will use two types of DIDs. The first one is a **Verinym**. A **Verinym** is associated with the **Legal Identity** of the **Identity Owner**. For example, all parties should be able to verify that some DID is used by a Government to publish schemas for some document type. The second type is a **Pseudonym** - a **Blinded Identifier** used to maintain privacy in the context of an ongoing digital relationship (**Connection**). If the Pseudonym is used to maintain only one digital relationship we will call it a Pairwise-Unique Identifier. We will use Pairwise-Unique Identifiers to maintain secure connections between actors in this tutorial. -The creation of a DID known to the Ledger is an **Identity Record** itself (NYM transaction). The NYM transaction can be used for creation of new DIDs that is known to that ledger, the setting and rotation of a verification key, and the setting and changing of roles. The most important fields of this transaction are `dest` (target DID), `role` (role of a user NYM record being created for) and the `verkey` (target verification key). See [Requests](https://github.com/hyperledger/indy-node/blob/master/docs/requests.md) to get more information about supported ledger transactions. +The creation of a DID known to the Ledger is an **Identity Record** itself (NYM transaction). The NYM transaction can be used for creation of new DIDs that is known to that ledger, the setting and rotation of a verification key, and the setting and changing of roles. The most important fields of this transaction are `dest` (target DID), `role` (role of a user NYM record being created for) and the `verkey` (target verification key). See [Requests](https://github.com/hyperledger/indy-node/blob/master/docs/source/requests.md) to get more information about supported ledger transactions. Publishing with a DID verification key allows a person, organization or thing, to verify that someone owns this DID as that person, organization or thing is the only one who knows the corresponding signing key and any DID-related operations requiring signing with this key. -Our ledger is public permissioned and anyone who wants to publish DIDs needs to get the role of **Trust Anchor** on the ledger. A **Trust Anchor** is a person or organization that the ledger already knows about, that is able to help bootstrap others. (It is *not* the same as what cybersecurity experts call a "trusted third party"; think of it more like a facilitator). See [Roles](https://github.com/hyperledger/indy-node/blob/master/docs/auth_rules.md) to get more information about roles. +Our ledger is public permissioned and anyone who wants to publish DIDs needs to get the role of **Trust Anchor** on the ledger. A **Trust Anchor** is a person or organization that the ledger already knows about, that is able to help bootstrap others. (It is *not* the same as what cybersecurity experts call a "trusted third party"; think of it more like a facilitator). See [Roles](https://github.com/hyperledger/indy-node/blob/master/docs/source/auth_rules.md) to get more information about roles. **The first step towards being able to place transactions on the ledger involves getting the role of Trust Anchor on the ledger. Faber College, Acme Corp and Thrift Bank will need to get the role of Trust Anchor on the ledger so they can create Verinyms and Pairwise-Unique Identifiers to provide the service to Alice.** From d2d58ebd786ecf3f8459b5d284278f192001fd97 Mon Sep 17 00:00:00 2001 From: Michael Boyd Date: Fri, 8 Mar 2019 14:31:14 +0800 Subject: [PATCH 15/21] added to index.rst Signed-off-by: Michael Boyd --- docs/index.rst | 2 ++ docs/zh/indy-walkthrough-zh.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index df201657e3..674a20d710 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,6 +31,8 @@ Find the other Indy docs at https://hyperledger-indy.readthedocs.io build-guides/index.rst migration-guides/index.rst architecture/index.rst + zh/indy-walkthrough-zh.md + .. toctree:: diff --git a/docs/zh/indy-walkthrough-zh.md b/docs/zh/indy-walkthrough-zh.md index 89469543dd..497dd638a9 100644 --- a/docs/zh/indy-walkthrough-zh.md +++ b/docs/zh/indy-walkthrough-zh.md @@ -1,4 +1,5 @@ -## 什麼是 Indy 和 Libindy,還有為什麼它們那麼重要? + +# 什麼是 Indy 和 Libindy,還有為什麼它們那麼重要? Indy 提供一個私密、安全、身份的生態系統,而Libindy 為它提供客戶端。Indy 使人 -- 而不是傳統機構 -- 控制他們的個人資料以及如何公開。它令各種創新變得可能:授權、嶄新的支付流程、資產及文件管理、不同形式的委託、聲譽累積、與其他新技術整合等等。 @@ -25,3 +26,4 @@ Alice 还没有意识到,想要使用这个数字的成绩单,她需要一 当 Alice 点击了 获得成绩单 按钮后,她会下载一个带有一个 Indy 连接请求 的文件。这个连接请求文件的扩展名为 .indy,并且会和 Alice 的 Indy app 相关联,将会允许 Alice 创建跟另外一个在这个账本生态圈(ledger ecosystem)存在的一方(Faber 大学)的一个安全的信息沟通频道(channel)。 + From 34e0bf8dfda5b19204514c6d81196ddf09bcd580 Mon Sep 17 00:00:00 2001 From: Douglas Wightman Date: Mon, 11 Mar 2019 09:54:37 -0600 Subject: [PATCH 16/21] VE-976 - fix Evernym agency compatibility Signed-off-by: Douglas Wightman --- vcx/libvcx/src/messages/get_message.rs | 1 - vcx/libvcx/src/messages/invite.rs | 27 +++++++++++++++++- vcx/libvcx/src/messages/mod.rs | 38 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/vcx/libvcx/src/messages/get_message.rs b/vcx/libvcx/src/messages/get_message.rs index 7d0c8fb1ea..ee81665874 100644 --- a/vcx/libvcx/src/messages/get_message.rs +++ b/vcx/libvcx/src/messages/get_message.rs @@ -436,7 +436,6 @@ mod tests { fn test_download_messages() { use std::thread; use std::time::Duration; - ::utils::logger::LibvcxDefaultLogger::init_testing_logger(); init!("agency"); let institution_did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap(); diff --git a/vcx/libvcx/src/messages/invite.rs b/vcx/libvcx/src/messages/invite.rs index 6ef6fcb62a..3cf1fcd9ee 100644 --- a/vcx/libvcx/src/messages/invite.rs +++ b/vcx/libvcx/src/messages/invite.rs @@ -13,10 +13,12 @@ pub struct SendInviteMessageDetails { #[serde(rename = "keyDlgProof")] key_dlg_proof: KeyDlgProof, #[serde(rename = "targetName")] + #[serde(skip_serializing_if = "Option::is_none")] target_name: Option, #[serde(rename = "phoneNo")] + #[serde(skip_serializing_if = "Option::is_none")] phone_no: Option, - #[serde(rename = "usePublicDID")] + #[serde(rename = "includePublicDID")] include_public_did: bool, } @@ -568,4 +570,27 @@ mod tests { let response = parse_invitation_acceptance_details(payload).unwrap(); println!("response: {:?}", response); } + + #[test] + fn test_send_invite_null_parameters() { + let details = SendInviteMessageDetails { + msg_type: MessageTypeV1 { + name: "Name".to_string(), + ver: "1.0".to_string() + }, + key_dlg_proof: KeyDlgProof { + agent_did: "did".to_string(), + agent_delegated_key: "key".to_string(), + signature: "sig".to_string(), + }, + target_name: None, + phone_no: None, + include_public_did: true + }; + + let string: String = serde_json::to_string(&details).unwrap(); + assert!(!string.contains("phoneNo")); + assert!(!string.contains("targetName")); + assert!(string.contains("includePublicDID")); + } } diff --git a/vcx/libvcx/src/messages/mod.rs b/vcx/libvcx/src/messages/mod.rs index 80edb55a30..3a0e355bea 100644 --- a/vcx/libvcx/src/messages/mod.rs +++ b/vcx/libvcx/src/messages/mod.rs @@ -447,6 +447,7 @@ pub struct CreateMessage { send_msg: bool, #[serde(skip_serializing_if = "Option::is_none")] uid: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "replyToMsgId")] reply_to_msg_id: Option, } @@ -457,7 +458,9 @@ pub struct GeneralMessageDetail { msg_type: MessageTypeV1, #[serde(rename = "@msg")] msg: Vec, + #[serde(skip_serializing_if = "Option::is_none")] title: Option, + #[serde(skip_serializing_if = "Option::is_none")] detail: Option, } @@ -1033,4 +1036,39 @@ pub mod tests { let buf = to_i8(&vec); println!("new bundle: {:?}", buf); } + + #[test] + fn test_general_message_null_parameters() { + let details = GeneralMessageDetail { + msg_type: MessageTypeV1 { + name: "Name".to_string(), + ver: "1.0".to_string() + }, + msg: vec![1,2,3], + title: None, + detail: None + }; + + let string: String = serde_json::to_string(&details).unwrap(); + assert!(!string.contains("title")); + assert!(!string.contains("detail")); + } + + #[test] + fn test_create_message_null_parameters() { + let details = CreateMessage { + msg_type: MessageTypeV1 { + name: "Name".to_string(), + ver: "1.0".to_string() + }, + mtype: RemoteMessageType::ProofReq, + send_msg: true, + uid: None, + reply_to_msg_id: None + }; + + let string: String = serde_json::to_string(&details).unwrap(); + assert!(!string.contains("uid")); + assert!(!string.contains("replyToMsgId")); + } } From dcd899088f43eb2dabd8d6be6c21cfd3ac0b5b11 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Fri, 1 Mar 2019 15:58:42 +0100 Subject: [PATCH 17/21] Add demo for VCX Nodejs Wrapper Signed-off-by: Patrik Stas --- vcx/wrappers/node/.babelrc | 5 + vcx/wrappers/node/README.md | 18 + vcx/wrappers/node/demo/alice.js | 91 + vcx/wrappers/node/demo/common.js | 24 + vcx/wrappers/node/demo/faber.js | 167 ++ vcx/wrappers/node/package-lock.json | 3510 +++++++++++++++++++++++++-- vcx/wrappers/node/package.json | 8 + 7 files changed, 3655 insertions(+), 168 deletions(-) create mode 100644 vcx/wrappers/node/.babelrc create mode 100644 vcx/wrappers/node/demo/alice.js create mode 100644 vcx/wrappers/node/demo/common.js create mode 100644 vcx/wrappers/node/demo/faber.js diff --git a/vcx/wrappers/node/.babelrc b/vcx/wrappers/node/.babelrc new file mode 100644 index 0000000000..3c078e9f99 --- /dev/null +++ b/vcx/wrappers/node/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "es2015" + ] +} diff --git a/vcx/wrappers/node/README.md b/vcx/wrappers/node/README.md index 7cfcb25063..0ccc28b761 100644 --- a/vcx/wrappers/node/README.md +++ b/vcx/wrappers/node/README.md @@ -33,3 +33,21 @@ npm run doc-gen ``` * A directory will be created locally `./docs` which contains an `index.html` file which can be used to navigate the generated documents. +## Run Demo +- Install dependencies +``` +npm install +``` +- Compile vcx wrapper +``` +npm compile +``` +- Start [Dummy Cloud Agent](../../dummy-cloud-agent) +- Run Faber agent, representing an institution +``` +npm run demo:faber +``` +- Give it a few seconds, then run Alice's agent which will connect with Faber's agent +``` +npm run demo:alice +``` diff --git a/vcx/wrappers/node/demo/alice.js b/vcx/wrappers/node/demo/alice.js new file mode 100644 index 0000000000..47766f832e --- /dev/null +++ b/vcx/wrappers/node/demo/alice.js @@ -0,0 +1,91 @@ +import {DisclosedProof} from "../dist/src/api/disclosed-proof"; +import {Connection} from "../dist/src/api/connection"; +import {Credential} from "../dist/src/api/credential"; +import {StateType} from "../dist/src"; +import readlineSync from 'readline-sync' +import sleepPromise from 'sleep-promise' +import * as demoCommon from './common' + +function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} + +const provisionConfig = { + 'agency_url': 'http://localhost:8080', + 'agency_did': 'VsKV7grR1BUE29mG2Fm2kX', + 'agency_verkey': 'Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR', + 'wallet_name': 'alice_wallet', + 'wallet_key': '123', + 'payment_method': 'null', + 'enterprise_seed': '000000000000000000000000Trustee1' +}; + + +async function run() { + await demoCommon.initLibNullPay(); + + console.log("#0 initialize rust API from NodeJS"); + await demoCommon.initRustApiAndLogger(); + + console.log("#1 Provision an agent and wallet, get back configuration details"); + let config = await demoCommon.provisionAgentInAgency(provisionConfig); + + console.log("#2 Initialize libvcx with new configuration"); + await demoCommon.initVcxWithProvisionedAgentConfig(config); + + console.log("#9 Input faber.py invitation details"); + const details = readlineSync.question('Enter your invite details: '); + const jdetails = JSON.parse(details); + + console.log("#10 Convert to valid json and string and create a connection to faber"); + const connection_to_faber = await Connection.createWithInvite({id: 'faber', invite: JSON.stringify(jdetails)}); + await connection_to_faber.connect({data: '{"use_public_did": true}'}); + await connection_to_faber.updateState(); + + console.log("#11 Wait for faber.py to issue a credential offer"); + await sleepPromise(5000); + const offers = await Credential.getOffers(connection_to_faber); + console.log(`Alice found following credentiaal offers: ${JSON.stringify(offers)}`); + + // Create a credential object from the credential offer + const credential = await Credential.create({sourceId: 'credential', offer: JSON.stringify(offers[0])}); + + console.log("#15 After receiving credential offer, send credential request"); + await credential.sendRequest({connection: connection_to_faber, payment : 0}); + + console.log("#16 Poll agency and accept credential offer from faber"); + let credential_state = await credential.getState(); + while (credential_state !== StateType.Accepted) { + sleepPromise(2000); + await credential.updateState(); + credential_state = await credential.getState(); + } + + console.log("#22 Poll agency for a proof request"); + const requests = await DisclosedProof.getRequests(connection_to_faber); + + console.log("#23 Create a Disclosed proof object from proof request"); + const proof = await DisclosedProof.create({sourceId: 'proof', request: JSON.stringify(requests[0])}); + + console.log("#24 Query for credentials in the wallet that satisfy the proof request"); + const credentials = await proof.getCredentials(); + + // Use the first available credentials to satisfy the proof request + for (let i = 0; i < Object.keys(credentials['attrs']).length; i++) { + const attr = Object.keys(credentials['attrs'])[i]; + credentials['attrs'][attr] = { + 'credential': credentials['attrs'][attr][0] + } + } + + console.log("#25 Generate the proof"); + await proof.generateProof({selectedCreds: credentials, selfAttestedAttrs: {}}); + + console.log("#26 Send the proof to faber"); + await proof.sendProof(connection_to_faber); +} + + +run(); \ No newline at end of file diff --git a/vcx/wrappers/node/demo/common.js b/vcx/wrappers/node/demo/common.js new file mode 100644 index 0000000000..235d9a26f1 --- /dev/null +++ b/vcx/wrappers/node/demo/common.js @@ -0,0 +1,24 @@ +import {initRustAPI, initVcxWithConfig, provisionAgent} from "./../dist/src"; +import * as ffi from "ffi"; + +export async function initLibNullPay() { + const myffi = ffi.Library('/usr/local/lib/libnullpay.dylib', {nullpay_init: ['void', []]}); + await myffi.nullpay_init(); +} + +export async function initRustApiAndLogger() { + let rustApi = initRustAPI(); + await rustApi.vcx_set_default_logger("info"); +} + +export async function provisionAgentInAgency(config) { + return JSON.parse(await provisionAgent(JSON.stringify(config))); +} + +export async function initVcxWithProvisionedAgentConfig(config) { + // Set some additional configuration options specific to Faber + config['institution_name'] = 'faber'; + config['institution_logo_url'] = 'http://robohash.org/234'; + config['genesis_path'] = 'docker.txn'; + await initVcxWithConfig(JSON.stringify(config)); +} \ No newline at end of file diff --git a/vcx/wrappers/node/demo/faber.js b/vcx/wrappers/node/demo/faber.js new file mode 100644 index 0000000000..5da2adcdcd --- /dev/null +++ b/vcx/wrappers/node/demo/faber.js @@ -0,0 +1,167 @@ +import {CredentialDef} from "../dist/src/api/credential-def"; +import {IssuerCredential} from "../dist/src/api/issuer-credential"; +import {Proof} from "../dist/src/api/proof"; +import {Connection} from "../dist/src/api/connection"; +import {Schema} from "./../dist/src/api/schema"; +import {StateType, ProofState} from "../dist/src"; +import sleepPromise from 'sleep-promise' +import * as demoCommon from "./common"; + +function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} + +const provisionConfig = { + 'agency_url': 'http://localhost:8080', + 'agency_did': 'VsKV7grR1BUE29mG2Fm2kX', + 'agency_verkey': 'Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR', + 'wallet_name': 'faber_wallet', + 'wallet_key': '123', + 'payment_method': 'null', + 'enterprise_seed': '000000000000000000000000Trustee1' +}; + +async function run() { + await demoCommon.initLibNullPay(); + + console.log("#0 initialize rust API from NodeJS"); + await demoCommon.initRustApiAndLogger(); + + console.log("#1 Provision an agent and wallet, get back configuration details"); + let config = await demoCommon.provisionAgentInAgency(provisionConfig); + + console.log("#2 Initialize libvcx with new configuration"); + await demoCommon.initVcxWithProvisionedAgentConfig(config); + + console.log("#3 Create a new schema on the ledger"); + const version = `${getRandomInt(1, 101)}.${getRandomInt(1, 101)}.${getRandomInt(1, 101)}`; + const schemaData = { + data: { + attrNames: ['name', 'date', 'degree'], + name: `Schema1`, + version + }, + paymentHandle: 0, + sourceId: 'testSchemaSourceId123' + }; + + const schema = await Schema.create(schemaData); + const schemaId = await schema.getSchemaId(); + console.log(`Created schema with id ${schemaId}`); + + console.log("#4 Create a new credential definition on the ledger"); + const data = { + name: 'DemoCredential123', + paymentHandle: 0, + revocation: false, + revocationDetails: { + tailsFile: 'tails.txt', + }, + schemaId: schemaId, + sourceId: 'testCredentialDefSourceId123' + }; + const cred_def = await CredentialDef.create(data); + const cred_def_id = await cred_def.getCredDefId(); + const credDefHandle = cred_def.handle; + console.log(`Created credential with id ${cred_def_id} and handle ${credDefHandle}`); + + console.log("#5 Create a connection to alice and print out the invite details"); + const connectionToAlice = await Connection.create({id: 'alice'}); + await connectionToAlice.connect('{"use_public_did": true}'); + await connectionToAlice.updateState(); + const details = await connectionToAlice.inviteDetails(false); + console.log("**invite details**"); + console.log(JSON.stringify(JSON.parse(details)), null, 0); + console.log("******************"); + + console.log("#6 Poll agency and wait for alice to accept the invitation (start alice.py now)"); + let connection_state = await connectionToAlice.getState(); + while (connection_state !== StateType.Accepted) { + await sleepPromise(2000); + await connectionToAlice.updateState(); + connection_state = await connectionToAlice.getState(); + console.log(`Connection to Alice is in state: ${connection_state}`); + } + console.log(`Connection to alice was Accepted!`); + + const schema_attrs = { + 'name': 'alice', + 'date': '05-2018', + 'degree': 'maths', + }; + + console.log("#12 Create an IssuerCredential object using the schema and credential definition") + + const credentialForAlice = await IssuerCredential.create({ + attr: schema_attrs, + sourceId: 'alice_degree', + credDefHandle, + credentialName: 'cred', + price: '0' + }); + + console.log("#13 Issue credential offer to alice"); + await credentialForAlice.sendOffer(connectionToAlice); + await credentialForAlice.updateState(); + + console.log("#14 Poll agency and wait for alice to send a credential request"); + let credential_state = await credentialForAlice.getState(); + while (credential_state !== StateType.RequestReceived) { + await sleepPromise(2000); + await credentialForAlice.updateState(); + credential_state = await credentialForAlice.getState(); + } + + console.log("#17 Issue credential to alice"); + await credentialForAlice.sendCredential(connectionToAlice); + + + console.log("#18 Wait for alice to accept credential"); + await credentialForAlice.updateState(); + credential_state = await credentialForAlice.getState(); + while (credential_state !== StateType.Accepted) { + sleepPromise(2000); + await credentialForAlice.updateState(); + credential_state = await credentialForAlice.getState(); + } + + const proofAttributes = [ + {'name': 'name', 'restrictions': [{'issuer_did': config['institution_did']}]}, + {'name': 'date', 'restrictions': [{'issuer_did': config['institution_did']}]}, + {'name': 'degree', 'restrictions': [{'issuer_did': config['institution_did']}]} + ]; + + console.log("#19 Create a Proof object"); + const proof = await Proof.create({ + sourceId: "213", + attrs: proofAttributes, + name: 'proofForAlice', + revocationInterval: {} + }); + + console.log("#20 Request proof of degree from alice"); + await proof.requestProof(connectionToAlice); + + console.log("#21 Poll agency and wait for alice to provide proof"); + let proofState = await proof.getState(); + while (proofState !== StateType.Accepted) { + sleepPromise(2000); + await proof.updateState(); + proofState = await proof.getState(); + } + + console.log("#27 Process the proof provided by alice"); + await proof.getProof(connectionToAlice); + + console.log("#28 Check if proof is valid"); + if (proof.proofState === ProofState.Verified) { + console.log("proof is verified!!") + } else { + console.log("could not verify proof :(") + } +} + + +run(); \ No newline at end of file diff --git a/vcx/wrappers/node/package-lock.json b/vcx/wrappers/node/package-lock.json index bd0963272f..0a89f5fd57 100644 --- a/vcx/wrappers/node/package-lock.json +++ b/vcx/wrappers/node/package-lock.json @@ -1,6 +1,6 @@ { "name": "node-vcx-wrapper", - "version": "0.1.543416+469b25d", + "version": "0.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -128,12 +128,64 @@ "@types/node": "8.0.47" } }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "optional": true, + "requires": { + "micromatch": "2.3.11", + "normalize-path": "2.1.1" + } + }, "app-module-path": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", "dev": true }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true, + "optional": true + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -146,6 +198,12 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, "async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", @@ -163,215 +221,1827 @@ } } }, - "babylon": { - "version": "7.0.0-beta.19", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", - "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", - "dev": true + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true, + "optional": true }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true + "babel-cli": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", + "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", + "dev": true, + "requires": { + "babel-core": "6.26.3", + "babel-polyfill": "6.26.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "chokidar": "1.7.0", + "commander": "2.11.0", + "convert-source-map": "1.6.0", + "fs-readdir-recursive": "1.1.0", + "glob": "7.1.3", + "lodash": "4.17.11", + "output-file-sync": "1.1.2", + "path-is-absolute": "1.0.1", + "slash": "1.0.0", + "source-map": "0.5.7", + "v8flags": "2.1.1" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + } } }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.1", + "babel-helpers": "6.24.1", + "babel-messages": "6.23.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "convert-source-map": "1.6.0", + "debug": "2.6.9", + "json5": "0.5.1", + "lodash": "4.17.11", + "minimatch": "3.0.4", + "path-is-absolute": "1.0.1", + "private": "0.1.8", + "slash": "1.0.0", + "source-map": "0.5.7" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, - "buffer-from": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", - "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", - "dev": true + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.11", + "source-map": "0.5.7", + "trim-right": "1.0.1" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } }, - "catharsis": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", - "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", "dev": true, "requires": { - "underscore-contrib": "0.3.0" + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.11" } }, - "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", "dev": true, "requires": { - "assertion-error": "1.0.2", - "check-error": "1.0.2", - "deep-eql": "3.0.1", - "get-func-name": "2.0.0", - "pathval": "1.1.0", - "type-detect": "4.0.3" + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" } }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } }, - "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", "dev": true, "requires": { - "color-name": "1.1.3" + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" } }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.11" + } }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, "requires": { - "ms": "2.0.0" + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" } }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "babel-loader": { + "version": "6.2.4", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-6.2.4.tgz", + "integrity": "sha1-qnCv+N3CI6WVLoOaQ6bDpMi/oek=", "dev": true, "requires": { - "type-detect": "4.0.3" + "loader-utils": "0.2.17", + "mkdirp": "0.5.1", + "object-assign": "4.1.1" } }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } }, - "doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", "dev": true, "requires": { - "esutils": "1.1.6", - "isarray": "0.0.1" + "babel-runtime": "6.26.0" } }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } }, - "esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", - "dev": true + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } }, - "ffi": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ffi/-/ffi-2.2.0.tgz", - "integrity": "sha1-vxiwRmain3EiftVoldVDCvRwQvo=", + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, "requires": { - "bindings": "1.2.1", - "debug": "2.6.9", - "nan": "2.7.0", - "ref": "1.3.5", - "ref-struct": "1.1.0" - }, - "dependencies": { - "bindings": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.11" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "6.26.0", + "babel-helper-function-name": "6.24.1", + "babel-helper-optimise-call-expression": "6.24.1", + "babel-helper-replace-supers": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "6.26.2", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", + "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "6.24.1", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "6.24.1", + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "regexpu-core": "2.0.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "0.10.1" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "core-js": "2.6.5", + "regenerator-runtime": "0.10.5" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + } + } + }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.26.0", + "babel-plugin-transform-es2015-classes": "6.24.1", + "babel-plugin-transform-es2015-computed-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", + "babel-plugin-transform-es2015-for-of": "6.23.0", + "babel-plugin-transform-es2015-function-name": "6.24.1", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.2", + "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", + "babel-plugin-transform-es2015-modules-umd": "6.24.1", + "babel-plugin-transform-es2015-object-super": "6.24.1", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.24.1", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "6.24.1", + "babel-plugin-transform-regenerator": "6.26.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "6.26.3", + "babel-runtime": "6.26.0", + "core-js": "2.6.5", + "home-or-tmp": "2.0.0", + "lodash": "4.17.11", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "0.5.7" + } + } + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.6.5", + "regenerator-runtime": "0.11.1" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.11" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + } + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.9", + "globals": "9.18.0", + "invariant": "2.2.4", + "lodash": "4.17.11" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.11", + "to-fast-properties": "1.0.3" + }, + "dependencies": { + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + } + } + }, + "babylon": { + "version": "7.0.0-beta.19", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", + "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", + "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==", + "dev": true, + "optional": true + }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "optional": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.3" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "catharsis": { + "version": "0.8.9", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", + "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", + "dev": true, + "requires": { + "underscore-contrib": "0.3.0" + } + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "dev": true, + "requires": { + "assertion-error": "1.0.2", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.3" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "optional": true, + "requires": { + "anymatch": "1.3.2", + "async-each": "1.0.1", + "fsevents": "1.2.7", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.2.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", + "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "4.0.3" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "1.0.2", + "isobject": "3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "doctrine": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", + "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", + "dev": true, + "requires": { + "esutils": "1.1.6", + "isarray": "0.0.1" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "optional": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "optional": true, + "requires": { + "fill-range": "2.2.4" + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "optional": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "ffi": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ffi/-/ffi-2.2.0.tgz", + "integrity": "sha1-vxiwRmain3EiftVoldVDCvRwQvo=", + "requires": { + "bindings": "1.2.1", + "debug": "2.6.9", + "nan": "2.7.0", + "ref": "1.3.5", + "ref-struct": "1.1.0" + }, + "dependencies": { + "bindings": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" + }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" + } + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true, + "optional": true + }, + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "optional": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "3.1.1", + "repeat-element": "1.1.3", + "repeat-string": "1.6.1" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "optional": true, + "requires": { + "for-in": "1.0.2" + } + }, + "formatio": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", + "dev": true, + "requires": { + "samsam": "1.3.0" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "fs-extra": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", + "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + } + } + }, + "fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", + "dev": true, + "optional": true, + "requires": { + "nan": "2.12.1", + "node-pre-gyp": "0.10.3" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.3.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "2.3.5" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.3" + } + }, + "glob": { + "version": "7.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.1.2", + "yallist": "3.0.3" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "2.3.5" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.9", + "iconv-lite": "0.4.24", + "sax": "1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.4", + "nopt": "4.0.1", + "npm-packlist": "1.2.0", + "npmlog": "4.1.2", + "rc": "1.2.8", + "rimraf": "2.6.3", + "semver": "5.6.0", + "tar": "4.4.8" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.1", + "osenv": "0.1.5" + } + }, + "npm-bundled": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.5" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.5", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "0.6.0", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "rimraf": { + "version": "2.6.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" - } - } - }, - "formatio": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", - "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", - "dev": true, - "requires": { - "samsam": "1.3.0" - } - }, - "fs-extra": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", - "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + "semver": { + "version": "5.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "1.1.1", + "fs-minipass": "1.2.5", + "minipass": "2.3.5", + "minizlib": "1.2.1", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.2", + "yallist": "3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "dev": true } } }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -386,6 +2056,32 @@ "path-is-absolute": "1.0.1" } }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "optional": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -410,12 +2106,81 @@ "uglify-js": "3.4.9" } }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -428,6 +2193,16 @@ "integrity": "sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=", "dev": true }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -450,12 +2225,194 @@ "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "1.4.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "1.13.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true, + "optional": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "optional": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true, + "optional": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true, + "optional": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "optional": true + }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "optional": true, + "requires": { + "isarray": "1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + } + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, "js2xmlparser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", @@ -485,6 +2442,18 @@ "underscore": "1.8.3" } }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -507,6 +2476,15 @@ "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==", "dev": true }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + }, "klaw": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", @@ -516,6 +2494,18 @@ "graceful-fs": "4.1.11" } }, + "loader-utils": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "3.2.0", + "emojis-list": "2.1.0", + "json5": "0.5.1", + "object-assign": "4.1.1" + } + }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", @@ -533,18 +2523,71 @@ "integrity": "sha512-rPO6R1t8PjYL6xbsFUg7aByKkWAql907na6powPBORVs4DCm8aMBUkL4+6CXO0gEIV8vtu3mWV0FB8ZaCYPBmA==", "dev": true }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "3.0.2" + } + }, "make-error": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", "dev": true }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, "marked": { "version": "0.3.19", "resolved": "http://registry.npmjs.org/marked/-/marked-0.3.19.tgz", "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", "dev": true }, + "math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true, + "optional": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -560,6 +2603,27 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -630,6 +2694,56 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "nan": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", + "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, + "optional": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true, + "optional": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true, + "optional": true + } + } + }, "nise": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", @@ -651,6 +2765,94 @@ } } }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "optional": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -670,6 +2872,48 @@ "wordwrap": "0.0.3" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "output-file-sync": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", + "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "mkdirp": "0.5.1", + "object-assign": "4.1.1" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "optional": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -691,16 +2935,414 @@ "isarray": "0.0.1" } }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true, + "optional": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true, + "optional": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true, + "optional": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "dev": true, + "optional": true, + "requires": { + "is-number": "4.0.0", + "kind-of": "6.0.2", + "math-random": "1.0.4" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true, + "optional": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "optional": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + } + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "optional": true, + "requires": { + "graceful-fs": "4.1.11", + "micromatch": "3.1.10", + "readable-stream": "2.3.6" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, + "optional": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.3", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true, + "optional": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "optional": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "optional": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "optional": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "optional": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.13", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + } + } + }, + "readline-sync": { + "version": "1.4.9", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz", + "integrity": "sha1-PtqOZfI80qF+YTAbHwADOWr17No=", "dev": true }, "rechoir": { @@ -743,6 +3385,110 @@ "ref": "1.3.5" } }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "private": "0.1.8" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "optional": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "1.4.0", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, "requizzle": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", @@ -769,6 +3515,33 @@ "path-parse": "1.0.6" } }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "0.1.15" + } + }, "samsam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", @@ -781,6 +3554,29 @@ "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", "dev": true }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, "shelljs": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.2.tgz", @@ -824,12 +3620,158 @@ } } }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "sleep-promise": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/sleep-promise/-/sleep-promise-8.0.1.tgz", + "integrity": "sha1-jXlaJ+ojlT32tSuRCB5eImZZk8U=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.2", + "use": "3.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "optional": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "optional": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "optional": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "optional": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "2.1.2", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } + }, "source-map-support": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", @@ -840,6 +3782,61 @@ "source-map": "0.6.1" } }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -867,6 +3864,62 @@ "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", "dev": true }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "optional": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "3.2.2" + } + } + } + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, "ts-node": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.1.2.tgz", @@ -1307,11 +4360,132 @@ } } }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, "universalify": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true, + "optional": true + }, + "v8flags": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", + "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "dev": true, + "requires": { + "user-home": "1.1.1" + } + }, "weak": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/weak/-/weak-1.0.1.tgz", diff --git a/vcx/wrappers/node/package.json b/vcx/wrappers/node/package.json index a3dfa7942c..fb0375fc4a 100644 --- a/vcx/wrappers/node/package.json +++ b/vcx/wrappers/node/package.json @@ -34,6 +34,8 @@ "weak": "^1.0.1" }, "scripts": { + "demo:alice": "babel-node demo/alice.js", + "demo:faber": "babel-node demo/faber.js", "compile": "./node_modules/.bin/tsc -p ./tsconfig.json", "lint": "./node_modules/.bin/tslint --type-check -c ./tslint.json -p ./tsconfig.json && ./node_modules/.bin/tslint --type-check -c ./test/tslint.json -p ./test/tsconfig.json", "doc-gen": "./node_modules/.bin/typedoc --out doc --excludePrivate --excludeProtected --ignoreCompilerErrors src", @@ -41,6 +43,12 @@ "test-logging": "export TS_NODE_PROJECT=\"./test/tsconfig.json\" export NODE_ENV='test'&& find ./test/suite3 -name '*.test.ts' -exec ./node_modules/.bin/mocha --timeout 10000 -gc --expose-gc --exit --recursive --use_strict --require ts-node/register \\{} \\;" }, "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.3", + "babel-loader": "6.2.4", + "babel-preset-es2015": "^6.24.1", + "sleep-promise": "^8.0.1", + "readline-sync": "^1.4.9", "@types/chai": "^4.1.4", "@types/lodash": "^4.14.109", "@types/mocha": "^5.2.3", From 263eac2f675bc84d4a3bd4e59805be59ae1ad40c Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Thu, 7 Mar 2019 14:04:21 +0100 Subject: [PATCH 18/21] Add more node vcx demo documentation. Refactor node vcx demo. Signed-off-by: Patrik Stas --- vcx/wrappers/node/README.md | 34 +++++++++++++++++++++++++++++--- vcx/wrappers/node/demo/alice.js | 6 ------ vcx/wrappers/node/demo/common.js | 8 +++++++- vcx/wrappers/node/demo/faber.js | 6 +----- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/vcx/wrappers/node/README.md b/vcx/wrappers/node/README.md index 0ccc28b761..09319615de 100644 --- a/vcx/wrappers/node/README.md +++ b/vcx/wrappers/node/README.md @@ -31,14 +31,41 @@ npm install npm ci npm run doc-gen ``` -* A directory will be created locally `./docs` which contains an `index.html` file which can be used to navigate the generated documents. +* A directory will be created locally `./docs` which contains an `index.html` file which can be used to navigate the +generated documents. ## Run Demo -- Install dependencies +- The demo represents example how 2 actors, **Alice** and **Faber** institution, exchange credentials. +- They consult may consult Indy blockchain (pool of Indy nodes) to find out certain pieces of information. **Faber** +and **Alice** are represented by 2 scripts `faber.js` and `alice.js` but you could imagine that there's a webserver +running code alike what's inside `faber.js` and there's a perhaps smartphone or laptop running code +alike iin `alice.js`. +- **Faber** and **Alice** in the demo also don't exchange the credentials peer to peer. Instead, the exchange happens +through intermediary service represented by **Dummy Cloud Agent**. The data **Alice** and **Faber** are exchanging over +**Dummy Cloud Agent** are however encrypted and cannot be read by the **Dummy Cloud Agent**. The **Dummy Cloud Agent** +is something like illiterate postman. He'll take a letter from one party and delivers it to the other party. But he's +unable to read the messages he's handling. + + +### Pre-requirements +##### Libraries +Before you'll be able to run demo, you need to make sure you've compiled +[`libindy`](https://github.com/hyperledger/indy-sdk/tree/master/libindy), +[`libvcx`](https://github.com/hyperledger/indy-sdk/tree/master/vcx) and +[`libnullpay`](https://github.com/hyperledger/indy-sdk/tree/master/libnullpay) libraries and are available on your +system. +#### Indy pool +You'll also have to run pool of Indy nodes on your machine. You can achieve by simply running a docker container +which encapsulates multiple interconnected Indy nodes. +[Instructions here](https://github.com/hyperledger/indy-sdk#how-to-start-local-nodes-pool-with-docker). + +### Steps to run demo +- Install NodeJS dependencies ``` npm install ``` -- Compile vcx wrapper + +- Compile LibVCX Wrapper ``` npm compile ``` @@ -51,3 +78,4 @@ npm run demo:faber ``` npm run demo:alice ``` + diff --git a/vcx/wrappers/node/demo/alice.js b/vcx/wrappers/node/demo/alice.js index 47766f832e..a05cbea1e3 100644 --- a/vcx/wrappers/node/demo/alice.js +++ b/vcx/wrappers/node/demo/alice.js @@ -6,12 +6,6 @@ import readlineSync from 'readline-sync' import sleepPromise from 'sleep-promise' import * as demoCommon from './common' -function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min)) + min; -} - const provisionConfig = { 'agency_url': 'http://localhost:8080', 'agency_did': 'VsKV7grR1BUE29mG2Fm2kX', diff --git a/vcx/wrappers/node/demo/common.js b/vcx/wrappers/node/demo/common.js index 235d9a26f1..6b16d8db30 100644 --- a/vcx/wrappers/node/demo/common.js +++ b/vcx/wrappers/node/demo/common.js @@ -21,4 +21,10 @@ export async function initVcxWithProvisionedAgentConfig(config) { config['institution_logo_url'] = 'http://robohash.org/234'; config['genesis_path'] = 'docker.txn'; await initVcxWithConfig(JSON.stringify(config)); -} \ No newline at end of file +} + +export async function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} diff --git a/vcx/wrappers/node/demo/faber.js b/vcx/wrappers/node/demo/faber.js index 5da2adcdcd..78b4bc251c 100644 --- a/vcx/wrappers/node/demo/faber.js +++ b/vcx/wrappers/node/demo/faber.js @@ -6,12 +6,8 @@ import {Schema} from "./../dist/src/api/schema"; import {StateType, ProofState} from "../dist/src"; import sleepPromise from 'sleep-promise' import * as demoCommon from "./common"; +import {getRandomInt} from "./common"; -function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min)) + min; -} const provisionConfig = { 'agency_url': 'http://localhost:8080', From b305b4a14e6fc9d6d2b468e0ebcae705fee4d7b5 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Thu, 7 Mar 2019 18:47:01 +0100 Subject: [PATCH 19/21] VCX Node wrapper: Add genesis transactions. Adjust logging. Signed-off-by: Patrik Stas --- vcx/wrappers/node/demo/alice.js | 3 ++- vcx/wrappers/node/demo/common.js | 10 +++++----- vcx/wrappers/node/demo/docker.txn | 4 ++++ vcx/wrappers/node/demo/faber.js | 19 ++++++++++++------- 4 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 vcx/wrappers/node/demo/docker.txn diff --git a/vcx/wrappers/node/demo/alice.js b/vcx/wrappers/node/demo/alice.js index a05cbea1e3..7e1a12f91d 100644 --- a/vcx/wrappers/node/demo/alice.js +++ b/vcx/wrappers/node/demo/alice.js @@ -16,12 +16,13 @@ const provisionConfig = { 'enterprise_seed': '000000000000000000000000Trustee1' }; +const logLevel = 'warn'; async function run() { await demoCommon.initLibNullPay(); console.log("#0 initialize rust API from NodeJS"); - await demoCommon.initRustApiAndLogger(); + await demoCommon.initRustApiAndLogger(logLevel); console.log("#1 Provision an agent and wallet, get back configuration details"); let config = await demoCommon.provisionAgentInAgency(provisionConfig); diff --git a/vcx/wrappers/node/demo/common.js b/vcx/wrappers/node/demo/common.js index 6b16d8db30..e7759ded90 100644 --- a/vcx/wrappers/node/demo/common.js +++ b/vcx/wrappers/node/demo/common.js @@ -1,14 +1,15 @@ import {initRustAPI, initVcxWithConfig, provisionAgent} from "./../dist/src"; import * as ffi from "ffi"; +import 'fs'; export async function initLibNullPay() { const myffi = ffi.Library('/usr/local/lib/libnullpay.dylib', {nullpay_init: ['void', []]}); await myffi.nullpay_init(); } -export async function initRustApiAndLogger() { +export async function initRustApiAndLogger(logLevel) { let rustApi = initRustAPI(); - await rustApi.vcx_set_default_logger("info"); + await rustApi.vcx_set_default_logger(logLevel); } export async function provisionAgentInAgency(config) { @@ -16,14 +17,13 @@ export async function provisionAgentInAgency(config) { } export async function initVcxWithProvisionedAgentConfig(config) { - // Set some additional configuration options specific to Faber config['institution_name'] = 'faber'; config['institution_logo_url'] = 'http://robohash.org/234'; - config['genesis_path'] = 'docker.txn'; + config['genesis_path'] = `${__dirname}/docker.txn` ; await initVcxWithConfig(JSON.stringify(config)); } -export async function getRandomInt(min, max) { +export function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; diff --git a/vcx/wrappers/node/demo/docker.txn b/vcx/wrappers/node/demo/docker.txn new file mode 100644 index 0000000000..66fb071b90 --- /dev/null +++ b/vcx/wrappers/node/demo/docker.txn @@ -0,0 +1,4 @@ +{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"127.0.0.1","client_port":9702,"node_ip":"127.0.0.1","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"} +{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"127.0.0.1","client_port":9704,"node_ip":"127.0.0.1","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"} +{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node3","blskey":"3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5","blskey_pop":"QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh","client_ip":"127.0.0.1","client_port":9706,"node_ip":"127.0.0.1","node_port":9705,"services":["VALIDATOR"]},"dest":"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya"},"metadata":{"from":"4cU41vWW82ArfxJxHkzXPG"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"7e9f355dffa78ed24668f0e0e369fd8c224076571c51e2ea8be5f26479edebe4"},"ver":"1"} +{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node4","blskey":"2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw","blskey_pop":"RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP","client_ip":"127.0.0.1","client_port":9708,"node_ip":"127.0.0.1","node_port":9707,"services":["VALIDATOR"]},"dest":"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA"},"metadata":{"from":"TWwCRQRZ2ZHMJFn9TzLp7W"},"type":"0"},"txnMetadata":{"seqNo":4,"txnId":"aa5e817d7cc626170eca175822029339a444eb0ee8f0bd20d3b0b76e566fb008"},"ver":"1"} \ No newline at end of file diff --git a/vcx/wrappers/node/demo/faber.js b/vcx/wrappers/node/demo/faber.js index 78b4bc251c..5cb4b0d9d3 100644 --- a/vcx/wrappers/node/demo/faber.js +++ b/vcx/wrappers/node/demo/faber.js @@ -19,11 +19,13 @@ const provisionConfig = { 'enterprise_seed': '000000000000000000000000Trustee1' }; +const logLevel = 'error'; + async function run() { await demoCommon.initLibNullPay(); console.log("#0 initialize rust API from NodeJS"); - await demoCommon.initRustApiAndLogger(); + await demoCommon.initRustApiAndLogger(logLevel); console.log("#1 Provision an agent and wallet, get back configuration details"); let config = await demoCommon.provisionAgentInAgency(provisionConfig); @@ -68,17 +70,20 @@ async function run() { await connectionToAlice.connect('{"use_public_did": true}'); await connectionToAlice.updateState(); const details = await connectionToAlice.inviteDetails(false); - console.log("**invite details**"); - console.log(JSON.stringify(JSON.parse(details)), null, 0); - console.log("******************"); - - console.log("#6 Poll agency and wait for alice to accept the invitation (start alice.py now)"); + console.log("\n\n**invite details**"); + console.log("**You'll ge queried to paste this data to alice side of the demo. This is invitation to connect.**"); + console.log("**It's assumed this is obtained by Alice from Faber by some existing secure channel.**"); + console.log("**Could be on website via HTTPS, QR code scanned at Faber institution, ...**"); + console.log("\n******************\n\n"); + console.log(JSON.stringify(JSON.parse(details))); + console.log("\n\n******************\n\n"); + + console.log("#6 Polling agency and waiting for alice to accept the invitation. (start alice.py now)"); let connection_state = await connectionToAlice.getState(); while (connection_state !== StateType.Accepted) { await sleepPromise(2000); await connectionToAlice.updateState(); connection_state = await connectionToAlice.getState(); - console.log(`Connection to Alice is in state: ${connection_state}`); } console.log(`Connection to alice was Accepted!`); From dab97f694715ad9362ec70d3d087f1b3944c9eec Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 13 Mar 2019 12:43:45 +0300 Subject: [PATCH 20/21] Disabled testing on amazon Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 2 +- Jenkinsfile.ci | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 5f8604754a..bff30bf3c7 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -41,7 +41,7 @@ def testing() { stage('Testing') { parallel([ 'ubuntu-test' : { ubuntuTesting() }, - 'redhat-test' : { rhelTesting() }, + // FIXME 'redhat-test' : { rhelTesting() }, https://jira.hyperledger.org/browse/IS-1212 'android-test': { androidTesting() }, 'windows-test': { windowsTesting() }, 'ios-test' : { iosTesting() } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 9ac39ce5f1..9cc2965793 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -16,7 +16,7 @@ def testing() { 'android-test': { androidTesting() }, 'macos-test' : { macosTesting() }, 'ios-test' : { iosTesting() }, - 'redhat-test' : { rhelTesting() }, + // FIXME 'redhat-test' : { rhelTesting() }, https://jira.hyperledger.org/browse/IS-1212 'windows-test': { windowsTesting() } ]) } From 2501ba27189b26bd5f97f2c6a67599e21a03001d Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Wed, 13 Mar 2019 13:02:47 +0300 Subject: [PATCH 21/21] Nodejs cd pipeline fix Signed-off-by: artem.ivanov --- Jenkinsfile.cd | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 5f8604754a..0d6f46d259 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -1140,22 +1140,23 @@ def nodejsWrapperPublishing(testEnv, isRelease, library) { def suffix = getSuffix(isRelease, "nodejs") - dir(paths[library]['dir']) { - testEnv.inside { - if (library == 'vcx') { // need addition step for VCX to create .js files - sh "npm run compile" - } + def directory = paths[library]['dir'] - npmPublish(version, suffix) + testEnv.inside { + if (library == 'vcx') { // need addition step for VCX to create .js files + sh "cd $directory && npm run compile" } + + npmPublish(version, suffix, directory) } } -def npmPublish(version, suffix) { +def npmPublish(version, suffix, directory) { withCredentials([file(credentialsId: 'npm_credentials', variable: 'credentialsFile')]) { sh 'cp $credentialsFile ~/.npmrc' - sh "npm version --no-git-tag-version --allow-same-version $version$suffix" - sh "npm publish" + sh "cd $directory && " + + "npm version --no-git-tag-version --allow-same-version $version$suffix &&" + + "npm publish" } }