1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
pub type Result<T, E = Error> = ::core::result::Result<T, E>;
#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
pub enum Error {
#[error(transparent)]
CoreError(#[from] identity_core::Error),
#[error("DID creation failed: {0}")]
DIDCreationError(String),
#[error(transparent)]
DIDError(#[from] identity_did::Error),
#[error(transparent)]
IoError(#[from] std::io::Error),
#[cfg(feature = "stronghold")]
#[error(transparent)]
StrongholdError(#[from] crate::stronghold::StrongholdError),
#[error("invalid private key: {0}")]
InvalidPrivateKey(String),
#[error("invalid public key: {0}")]
InvalidPublicKey(String),
#[error("failed to decrypt data")]
DecryptionFailure(#[source] crypto::error::Error),
#[error("failed to encrypt data")]
EncryptionFailure(#[source] crypto::error::Error),
#[error("key not found")]
KeyNotFound,
#[error("key vault not found")]
KeyVaultNotFound,
#[error("shared resource poisoned: read")]
SharedReadPoisoned,
#[error("shared resource poisoned: write")]
SharedWritePoisoned,
#[error("identity already exists")]
IdentityAlreadyExists,
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[error("JsValue serialization error: {0}")]
SerializationError(String),
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[error("javascript function threw an exception: {0}")]
JsError(String),
}
impl From<identity_did::did::DIDError> for Error {
fn from(error: identity_did::did::DIDError) -> Self {
identity_did::Error::from(error).into()
}
}