identity_storage/storage/
error.rs1use crate::key_id_storage::KeyIdStorageError;
5use crate::key_id_storage::MethodDigestConstructionError;
6use crate::key_storage::KeyStorageError;
7
8#[derive(Debug, thiserror::Error)]
10#[non_exhaustive]
11pub enum JwkStorageDocumentError {
12 #[error("storage operation failed: key storage error")]
14 KeyStorageError(KeyStorageError),
15 #[error("storage operation failed: key id storage error: {0}")]
17 KeyIdStorageError(KeyIdStorageError),
18 #[error("could not add method: the fragment already exists")]
20 FragmentAlreadyExists,
21 #[error("method not found")]
23 MethodNotFound,
24 #[error("invalid method data format: expected publicKeyJwk")]
26 NotPublicKeyJwk,
27 #[error("invalid JWS algorithm")]
29 InvalidJwsAlgorithm,
30 #[error("invalid JWP algorithm")]
32 InvalidJwpAlgorithm,
33 #[error("Not able to construct a valid Jwp")]
35 JwpBuildingError,
36 #[error("Credential's proof internal error")]
38 ProofUpdateError(String),
39 #[error("method generation failed: unable to create a valid verification method")]
41 VerificationMethodConstructionError(#[source] identity_verification::Error),
42 #[error("could not produce jwt: encoding error")]
44 EncodingError(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
45 #[error("unable to produce method digest")]
47 MethodDigestConstructionError(#[source] MethodDigestConstructionError),
48 #[error("could not produce JWS payload from the given claims: serialization failed")]
50 ClaimsSerializationError(#[source] identity_credential::Error),
51 #[error("storage operation failed after altering state. Unable to undo operation(s): {message}")]
53 UndoOperationFailed {
54 message: String,
56 source: Box<Self>,
58 undo_error: Option<Box<Self>>,
60 },
61}
62
63#[cfg(test)]
64mod tests {
65 use super::JwkStorageDocumentError;
66 fn is_send_sync<T: Send + Sync + 'static>(_input: T) {}
67
68 #[test]
69 fn error_is_send_sync() {
70 is_send_sync(JwkStorageDocumentError::FragmentAlreadyExists);
71 }
72}