Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
xprazak2 committed Nov 16, 2023
1 parent baf941f commit 9d77e41
Show file tree
Hide file tree
Showing 15 changed files with 1,019 additions and 13 deletions.
584 changes: 571 additions & 13 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions aries_vcx/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ pub enum AriesVcxErrorKind {
#[error("Attempted to add a DID to wallet when that DID already exists in wallet")]
DuplicationDid,

#[error("An unexpected error from the store backend")]
AskarBackend,
#[error("The store backend was too busy to handle the request")]
AskarBusy,
#[error("A custom error type for external integrations")]
AskarCustom,
#[error("An insert operation failed due to a unique key conflict")]
AskarDuplicate,
#[error("An encryption or decryption operation failed")]
AskarEncryption,
#[error("The input parameters to the method were incorrect")]
AskarInput,
#[error("The requested record was not found")]
AskarNotFound,
#[error("An unexpected error occurred")]
AskarUnexpected,
#[error("An unsupported operation was requested")]
AskarUnsupported,

// Logger
#[error("Logging Error")]
LoggingError,
Expand Down
20 changes: 20 additions & 0 deletions aries_vcx/src/errors/mapping_others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ impl From<AriesVcxCoreError> for AriesVcxError {
AriesVcxErrorKind::DuplicationMasterSecret
}
AriesVcxCoreErrorKind::DuplicationDid => AriesVcxErrorKind::DuplicationDid,
AriesVcxCoreErrorKind::AskarBackend => AriesVcxErrorKind::AskarBackend,
AriesVcxCoreErrorKind::AskarBusy => AriesVcxErrorKind::AskarBusy,
AriesVcxCoreErrorKind::AskarCustom => AriesVcxErrorKind::AskarCustom,
AriesVcxCoreErrorKind::AskarDuplicate => AriesVcxErrorKind::AskarDuplicate,
AriesVcxCoreErrorKind::AskarEncryption => AriesVcxErrorKind::AskarEncryption,
AriesVcxCoreErrorKind::AskarInput => AriesVcxErrorKind::AskarInput,
AriesVcxCoreErrorKind::AskarNotFound => AriesVcxErrorKind::AskarNotFound,
AriesVcxCoreErrorKind::AskarUnexpected => AriesVcxErrorKind::AskarUnexpected,
AriesVcxCoreErrorKind::AskarUnsupported => AriesVcxErrorKind::AskarUnsupported,
AriesVcxCoreErrorKind::LoggingError => AriesVcxErrorKind::LoggingError,
AriesVcxCoreErrorKind::EncodeError => AriesVcxErrorKind::EncodeError,
AriesVcxCoreErrorKind::UnknownError => AriesVcxErrorKind::UnknownError,
Expand Down Expand Up @@ -206,6 +215,17 @@ impl From<AriesVcxError> for AriesVcxCoreError {
AriesVcxCoreErrorKind::DuplicationMasterSecret
}
AriesVcxErrorKind::DuplicationDid => AriesVcxCoreErrorKind::DuplicationDid,

AriesVcxErrorKind::AskarBackend => AriesVcxCoreErrorKind::AskarBackend,
AriesVcxErrorKind::AskarBusy => AriesVcxCoreErrorKind::AskarBusy,
AriesVcxErrorKind::AskarCustom => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarDuplicate => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarEncryption => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarInput => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarNotFound => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarUnexpected => AriesVcxCoreErrorKind::ActionNotSupported,
AriesVcxErrorKind::AskarUnsupported => AriesVcxCoreErrorKind::ActionNotSupported,

AriesVcxErrorKind::LoggingError => AriesVcxCoreErrorKind::LoggingError,
AriesVcxErrorKind::EncodeError => AriesVcxCoreErrorKind::EncodeError,
AriesVcxErrorKind::UnknownError => AriesVcxCoreErrorKind::UnknownError,
Expand Down
3 changes: 3 additions & 0 deletions aries_vcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ credx = ["dep:indy-credx"]
vdr_proxy_ledger = ["credx", "dep:indy-vdr-proxy-client"]
# Feature flag to allow legacy proof verification
legacy_proof = []
askar_tests = []

[dependencies]
agency_client = { path = "../agency_client" }
aries-askar = { git = "https://github.com/hyperledger/aries-askar.git", tag = "v0.3.0" }
bs58 = { version = "0.5" }
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 }
libvdrtools = { path = "../libvdrtools", optional = true }
Expand Down
19 changes: 19 additions & 0 deletions aries_vcx_core/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ pub enum AriesVcxCoreErrorKind {
#[error("Attempted to add a DID to wallet when that DID already exists in wallet")]
DuplicationDid,

#[error("An unexpected error from the store backend")]
AskarBackend,
#[error("The store backend was too busy to handle the request")]
AskarBusy,
#[error("A custom error type for external integrations")]
AskarCustom,
#[error("An insert operation failed due to a unique key conflict")]
AskarDuplicate,
#[error("An encryption or decryption operation failed")]
AskarEncryption,
#[error("The input parameters to the method were incorrect")]
AskarInput,
#[error("The requested record was not found")]
AskarNotFound,
#[error("An unexpected error occurred")]
AskarUnexpected,
#[error("An unsupported operation was requested")]
AskarUnsupported,

// Logger
#[error("Logging Error")]
LoggingError,
Expand Down
33 changes: 33 additions & 0 deletions aries_vcx_core/src/errors/mapping_askar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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::AskarBackend, err)
}
ErrorKind::Busy => AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarBusy, err),
ErrorKind::Custom => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarCustom, err)
}
ErrorKind::Duplicate => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarDuplicate, err)
}
ErrorKind::Encryption => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarEncryption, err)
}
ErrorKind::Input => AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarInput, err),
ErrorKind::NotFound => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarNotFound, err)
}
ErrorKind::Unexpected => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarUnexpected, err)
}
ErrorKind::Unsupported => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarUnsupported, err)
}
}
}
}
1 change: 1 addition & 0 deletions aries_vcx_core/src/errors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod error;
mod mapping_agency_client;
mod mapping_askar;
#[cfg(feature = "credx")]
mod mapping_credx;
#[cfg(feature = "vdrtools_wallet")]
Expand Down
Loading

0 comments on commit 9d77e41

Please sign in to comment.