Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas committed Nov 6, 2023
1 parent 96fec37 commit cbb2236
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 26 deletions.
25 changes: 19 additions & 6 deletions agents/rust/aries-vcx-agent/src/agent/init.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
use std::sync::Arc;
use aries_vcx::common::ledger::service_didsov::{DidSovServiceType, EndpointDidSov};
use aries_vcx::common::ledger::transactions::{add_new_did, write_endpoint};

use aries_vcx::global::settings::DEFAULT_LINK_SECRET_ALIAS;
use aries_vcx::{
common::ledger::{
service_didsov::{DidSovServiceType, EndpointDidSov},
transactions::{add_new_did, write_endpoint},
},
global::settings::DEFAULT_LINK_SECRET_ALIAS,
};
use aries_vcx_core::{
self,
anoncreds::{base_anoncreds::BaseAnonCreds, credx_anoncreds::IndyCredxAnonCreds},
ledger::indy_vdr_ledger::DefaultIndyLedgerRead,
wallet::indy::{
wallet::{create_and_open_wallet, wallet_configure_issuer},
IndySdkWallet, WalletConfig,
},
};
use aries_vcx_core::ledger::indy_vdr_ledger::DefaultIndyLedgerRead;
use did_peer::resolver::PeerDidResolver;
use did_resolver_registry::ResolverRegistry;
use did_resolver_sov::resolution::DidSovResolver;
Expand Down Expand Up @@ -104,14 +108,23 @@ impl Agent {
let endpoint = EndpointDidSov::create()
.set_service_endpoint(init_config.service_endpoint.clone())
.set_types(Some(vec![DidSovServiceType::DidCommunication]));
write_endpoint(wallet.as_ref(), ledger_write.as_ref(), &public_did, &endpoint).await?;
write_endpoint(
wallet.as_ref(),
ledger_write.as_ref(),
&public_did,
&endpoint,
)
.await?;

let did_peer_resolver = PeerDidResolver::new();
let did_sov_resolver = DidSovResolver::new(ledger_read_2);
let did_resolver_registry = Arc::new(
ResolverRegistry::new()
.register_resolver::<PeerDidResolver>("peer".into(), did_peer_resolver.into())
.register_resolver::<DidSovResolver<DefaultIndyLedgerRead>>("sov".into(), did_sov_resolver.into()),
.register_resolver::<DidSovResolver<DefaultIndyLedgerRead>>(
"sov".into(),
did_sov_resolver.into(),
),
);

let connections = Arc::new(ServiceConnections::new(
Expand Down
16 changes: 9 additions & 7 deletions agents/rust/aries-vcx-agent/src/services/did_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use aries_vcx::{
},
protocols::did_exchange::{
resolve_key_from_invitation,
state_machine::{
generic::{GenericDidExchange, ThinState},
},
state_machine::generic::{GenericDidExchange, ThinState},
},
transport::Transport,
};
use aries_vcx_core::{anoncreds::credx_anoncreds::IndyCredxAnonCreds, wallet::indy::IndySdkWallet};
use aries_vcx_core::ledger::indy_vdr_ledger::DefaultIndyLedgerRead;
use aries_vcx_core::{
anoncreds::credx_anoncreds::IndyCredxAnonCreds, ledger::indy_vdr_ledger::DefaultIndyLedgerRead,
wallet::indy::IndySdkWallet,
};
use did_resolver_registry::ResolverRegistry;

use super::connection::ServiceEndpoint;
Expand Down Expand Up @@ -62,8 +62,10 @@ impl ServiceDidExchange {
self.wallet.as_ref(),
format!("did:sov:{}", their_did).parse()?,
format!("did:sov:{}", self.public_did).parse()?,
).await?;
let request_id = request.clone()
)
.await?;
let request_id = request
.clone()
.decorators
.thread
.ok_or_else(|| {
Expand Down
6 changes: 4 additions & 2 deletions aries_vcx/tests/utils/scenarios/connection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use aries_vcx::{
errors::error::VcxResult,
handlers::{out_of_band::sender::OutOfBandSender, util::AnyInvitation},
handlers::{
out_of_band::{receiver::oob_invitation_to_legacy_did_doc, sender::OutOfBandSender},
util::AnyInvitation,
},
protocols::{
connection::{Connection, GenericConnection},
mediated_connection::pairwise_info::PairwiseInfo,
Expand All @@ -27,7 +30,6 @@ use messages::{
};
use url::Url;
use uuid::Uuid;
use aries_vcx::handlers::out_of_band::receiver::oob_invitation_to_legacy_did_doc;

use crate::utils::test_agent::TestAgent;

Expand Down
11 changes: 7 additions & 4 deletions libvcx_core/src/api_vcx/api_handle/mediated_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ use aries_vcx::{
agency_client::{api::downloaded_message::DownloadedMessage, MessageStatusCode},
handlers::{mediated_connection::MediatedConnection, util::AnyInvitation},
messages::{
AriesMessage,
msg_fields::protocols::connection::{
invitation::{Invitation, InvitationContent},
request::Request,
},
AriesMessage,
},
protocols::{
connection::invitee::any_invitation_into_did_doc,
mediated_connection::pairwise_info::PairwiseInfo,
},
protocols::mediated_connection::pairwise_info::PairwiseInfo,
};
use serde_json;
use uuid::Uuid;
use aries_vcx::protocols::connection::invitee::any_invitation_into_did_doc;

use crate::{
api_vcx::{
Expand Down Expand Up @@ -152,7 +154,8 @@ pub async fn create_connection(source_id: &str) -> LibvcxResult<u32> {
pub async fn create_connection_with_invite(source_id: &str, details: &str) -> LibvcxResult<u32> {
debug!("create connection {} with invite {}", source_id, details);
if let Ok(invitation) = serde_json::from_str::<AnyInvitation>(details) {
let ddo = any_invitation_into_did_doc(get_main_ledger_read()?.as_ref(), &invitation).await?;
let ddo =
any_invitation_into_did_doc(get_main_ledger_read()?.as_ref(), &invitation).await?;
let connection = MediatedConnection::create_with_invite(
source_id,
get_main_wallet()?.as_ref(),
Expand Down
10 changes: 6 additions & 4 deletions libvcx_core/src/api_vcx/api_handle/out_of_band.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ use std::collections::HashMap;

use aries_vcx::{
handlers::{
out_of_band::{receiver::OutOfBandReceiver, sender::OutOfBandSender},
out_of_band::{
receiver::{oob_invitation_to_legacy_did_doc, OutOfBandReceiver},
sender::OutOfBandSender,
},
util::AnyInvitation,
},
messages::{
AriesMessage,
msg_fields::protocols::out_of_band::{invitation::OobService, OobGoalCode},
msg_types::Protocol,
AriesMessage,
},
protocols::connection::invitee::any_invitation_into_did_doc,
};
use aries_vcx::handlers::out_of_band::receiver::oob_invitation_to_legacy_did_doc;
use aries_vcx::protocols::connection::invitee::any_invitation_into_did_doc;

use crate::{
api_vcx::{
Expand Down
2 changes: 1 addition & 1 deletion messages/src/msg_fields/protocols/did_exchange/complete.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};
use shared_vcx::misc::serde_ignored::SerdeIgnored as NoContent;
use typed_builder::TypedBuilder;

use crate::{
decorators::{thread::Thread, timing::Timing},
msg_parts::MsgParts,
};
use typed_builder::TypedBuilder;

pub type Complete = MsgParts<NoContent, CompleteDecorators>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

use crate::{
decorators::{localization::MsgLocalization, thread::Thread, timing::Timing},
msg_parts::MsgParts,
};
use typed_builder::TypedBuilder;

pub type ProblemReport = MsgParts<ProblemReportContent, ProblemReportDecorators>;

Expand Down
2 changes: 1 addition & 1 deletion messages/src/msg_fields/protocols/did_exchange/response.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

use crate::{
decorators::{attachment::Attachment, thread::Thread, timing::Timing},
msg_parts::MsgParts,
};
use typed_builder::TypedBuilder;

pub type Response = MsgParts<ResponseContent, ResponseDecorators>;

Expand Down

0 comments on commit cbb2236

Please sign in to comment.