Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support aries-askar #1063

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
585 changes: 572 additions & 13 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions aries/aries_vcx/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ pub enum AriesVcxErrorKind {
#[error("Could not parse a value")]
ParsingError,

#[error("Unexpected wallet error")]
WalletUnexpected,

// A2A
#[error("Invalid HTTP response.")]
InvalidHttpResponse,
Expand Down
2 changes: 2 additions & 0 deletions aries/aries_vcx/src/errors/mapping_others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl From<AriesVcxCoreError> for AriesVcxError {
AriesVcxErrorKind::DuplicationMasterSecret
}
AriesVcxCoreErrorKind::DuplicationDid => AriesVcxErrorKind::DuplicationDid,
AriesVcxCoreErrorKind::WalletUnexpected => AriesVcxErrorKind::WalletUnexpected,
AriesVcxCoreErrorKind::LoggingError => AriesVcxErrorKind::LoggingError,
AriesVcxCoreErrorKind::EncodeError => AriesVcxErrorKind::EncodeError,
AriesVcxCoreErrorKind::UnknownError => AriesVcxErrorKind::UnknownError,
Expand Down Expand Up @@ -247,6 +248,7 @@ impl From<AriesVcxError> for AriesVcxCoreError {
AriesVcxErrorKind::DuplicationMasterSecret => {
AriesVcxCoreErrorKind::DuplicationMasterSecret
}
AriesVcxErrorKind::WalletUnexpected => AriesVcxCoreErrorKind::WalletUnexpected,
AriesVcxErrorKind::DuplicationDid => AriesVcxCoreErrorKind::DuplicationDid,
AriesVcxErrorKind::LoggingError => AriesVcxCoreErrorKind::LoggingError,
AriesVcxErrorKind::EncodeError => AriesVcxCoreErrorKind::EncodeError,
Expand Down
6 changes: 5 additions & 1 deletion aries/aries_vcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ edition = "2021"

[features]
########################## DEP FLAGS ################################
vdrtools_wallet = ["dep:libvdrtools", "dep:indy-api-types"]
vdrtools_wallet = ["dep:libvdrtools", "dep:indy-api-types", "test_utils/vdrtools_wallet"]
# Feature flag to include the 'modular library' dependencies (vdrtools alternatives; indy-vdr, indy-credx)
credx = ["dep:indy-credx"]
vdr_proxy_ledger = ["credx", "dep:indy-vdr-proxy-client"]
# Feature flag to allow legacy proof verification
legacy_proof = []
askar_wallet = ["dep:aries-askar"]

[dependencies]
aries-askar = { git = "https://github.com/hyperledger/aries-askar.git", tag = "v0.3.0", optional = true }
bs58 = { version = "0.5" }
agency_client = { path = "../misc/legacy/agency_client" }
indy-vdr = { git = "https://github.com/hyperledger/indy-vdr.git", rev = "c143268", default-features = false, features = ["log"] }
indy-credx = { git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.1.0", optional = true }
Expand All @@ -35,4 +38,5 @@ indy-ledger-response-parser = { path = "../misc/indy_ledger_response_parser" }
lru = { version = "0.12.0" }

[dev-dependencies]
test_utils = { path = "../misc/test_utils" }
tokio = { version = "1.20", features = ["rt", "macros", "rt-multi-thread"] }
3 changes: 3 additions & 0 deletions aries/aries_vcx_core/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ pub enum AriesVcxCoreErrorKind {
#[error("Attempted to add a DID to wallet when that DID already exists in wallet")]
DuplicationDid,

#[error("Unexpected wallet error")]
WalletUnexpected,

// Logger
#[error("Logging Error")]
LoggingError,
Expand Down
37 changes: 37 additions & 0 deletions aries/aries_vcx_core/src/errors/mapping_askar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use aries_askar::ErrorKind;

use super::error::{AriesVcxCoreError, AriesVcxCoreErrorKind};

impl From<aries_askar::Error> for AriesVcxCoreError {
fn from(err: aries_askar::Error) -> Self {
match err.kind() {
ErrorKind::Backend => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::Busy => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::Custom => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::Duplicate => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::DuplicationWalletRecord, err)
}
ErrorKind::Encryption => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::Input => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::NotFound => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletRecordNotFound, err)
}
ErrorKind::Unexpected => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
ErrorKind::Unsupported => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::WalletUnexpected, err)
}
}
}
}
2 changes: 2 additions & 0 deletions aries/aries_vcx_core/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ mod mapping_indyvdr;
mod mapping_indyvdr_proxy;
mod mapping_ledger_response_parser;
mod mapping_others;
#[cfg(feature = "askar_wallet")]
mod mapping_askar;
1 change: 1 addition & 0 deletions aries/aries_vcx_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod global;
pub mod ledger;
pub mod utils;
pub mod wallet;
pub mod wallet2;

pub use indy_ledger_response_parser::ResponseParser;
pub use indy_vdr::config::PoolConfig;
Expand Down
Loading
Loading