Skip to content

Commit

Permalink
Tweaked impls and wrote test for compilation check
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Mircea <[email protected]>
  • Loading branch information
bobozaur committed Nov 3, 2023
1 parent 7e0e6dc commit c295bdb
Show file tree
Hide file tree
Showing 22 changed files with 312 additions and 87 deletions.
2 changes: 1 addition & 1 deletion agency_client/src/internal/messaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl AgencyClient {
agent_vk: &str,
) -> AgencyClientResult<Vec<u8>> {
debug!("prepare_message_for_connection_agent >> {:?}", messages);
let message = messages.get(0).ok_or(AgencyClientError::from_msg(
let message = messages.first().ok_or(AgencyClientError::from_msg(
AgencyClientErrorKind::SerializationError,
"Cannot get message",
))?;
Expand Down
2 changes: 0 additions & 2 deletions agents/rust/mediator/src/didcomm_handlers/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
pub mod prelude {
pub use std::sync::Arc;

pub use aries_vcx::utils::encryption_envelope::EncryptionEnvelope;
pub use aries_vcx_core::wallet::base_wallet::BaseWallet;
pub use mediation::storage::MediatorPersistence;
Expand Down
2 changes: 1 addition & 1 deletion agents/rust/mediator/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ pub mod test_setup {

pub mod prelude {
pub use anyhow::Result;
pub use log::{debug, error, info};
pub use log::info;
pub use url::Url;
}
2 changes: 1 addition & 1 deletion aries_vcx/src/common/credentials/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn encode_attributes(attributes: &str) -> VcxResult<String> {
// old style input such as {"address2":["101 Wilson Lane"]}
serde_json::Value::Array(array_type) => {
let attrib_value: &str =
match array_type.get(0).and_then(serde_json::Value::as_str) {
match array_type.first().and_then(serde_json::Value::as_str) {
Some(x) => x,
None => {
return Err(AriesVcxError::from_msg(
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/handlers/out_of_band/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl OutOfBandReceiver {
.content
.requests_attach
.as_ref()
.and_then(|v| v.get(0))
.and_then(|v| v.first())
{
attachment_to_aries_message(attach)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl SmConnectionInvitee {
))?;
did_did
.recipient_keys()?
.get(0)
.first()
.ok_or(AriesVcxError::from_msg(
AriesVcxErrorKind::NotReady,
"Can't resolve recipient key from the counterparty diddoc.",
Expand Down Expand Up @@ -380,7 +380,7 @@ impl SmConnectionInvitee {

let state = match self.state {
InviteeFullState::Requested(state) => {
let remote_vk: String = state.did_doc.recipient_keys()?.get(0).cloned().ok_or(
let remote_vk: String = state.did_doc.recipient_keys()?.first().cloned().ok_or(
AriesVcxError::from_msg(
AriesVcxErrorKind::InvalidState,
"Cannot handle response: remote verkey not found",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl SmConnectionInviter {
))?;
did_did
.recipient_keys()?
.get(0)
.first()
.ok_or(AriesVcxError::from_msg(
AriesVcxErrorKind::NotReady,
"Can't resolve recipient key from the counterparty diddoc.",
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/utils/encryption_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl EncryptionEnvelope {
let routing_keys = did_doc.routing_keys();

let mut to = recipient_keys
.get(0)
.first()
.map(String::from)
.ok_or(AriesVcxError::from_msg(
AriesVcxErrorKind::InvalidState,
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ indy-credx = { git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.
libvdrtools = { path = "../libvdrtools", optional = true }
indy-api-types = { path = "../libvdrtools/indy-api-types", optional = true }
async-trait = "0.1.68"
futures = { version = "0.3", default-features = false }
futures = { version = "0.3" }
serde_json = "1.0.95"
time = "0.3.20"
serde = { version = "1.0.159", features = ["derive"] }
Expand Down
1 change: 0 additions & 1 deletion aries_vcx_core/src/credx/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion aries_vcx_core/src/errors/mapping_indy_api_types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use indy_api_types::{errors, ErrorCode};
pub use indy_api_types::ErrorCode;
use indy_api_types::{errors::IndyErrorKind, IndyError};

use crate::errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind};
Expand Down
2 changes: 0 additions & 2 deletions aries_vcx_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ extern crate log;
extern crate derive_builder;

pub mod anoncreds;
#[cfg(feature = "credx")]
pub mod credx;
pub mod errors;
pub mod global;
pub mod ledger;
Expand Down
Loading

0 comments on commit c295bdb

Please sign in to comment.