affinidi_did_authentication/
errors.rs1use affinidi_did_resolver_cache_sdk::errors::DIDCacheError;
6use affinidi_messaging_didcomm::error::Error as DidcommError;
7use affinidi_secrets_resolver::errors::SecretsResolverError;
8use thiserror::Error;
9
10#[derive(Error, Debug)]
12pub enum DIDAuthError {
13 #[error("Authentication failed: {0}")]
15 Authentication(String),
16
17 #[error("Authentication Aborted: {0}")]
19 AuthenticationAbort(String),
20
21 #[error("ACL Denied: {0}")]
23 ACLDenied(String),
24
25 #[error("DIDComm error: {0}")]
27 DIDComm(String),
28
29 #[error("DID Resolver error: {0}")]
30 DIDResolver(String),
31
32 #[error("Secrets Error: {0}")]
33 Secrets(String),
34}
35
36pub type Result<T> = std::result::Result<T, DIDAuthError>;
37
38impl From<DidcommError> for DIDAuthError {
39 fn from(error: DidcommError) -> Self {
40 DIDAuthError::DIDComm(error.to_string())
41 }
42}
43
44impl From<DIDCacheError> for DIDAuthError {
45 fn from(error: DIDCacheError) -> Self {
46 DIDAuthError::DIDResolver(error.to_string())
47 }
48}
49
50impl From<SecretsResolverError> for DIDAuthError {
51 fn from(error: SecretsResolverError) -> Self {
52 DIDAuthError::Secrets(error.to_string())
53 }
54}