Skip to main content

mesh_llm_identity/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum CryptoError {
5    #[error("keystore not found at {path}")]
6    KeystoreNotFound { path: String },
7
8    #[error("keystore already exists at {path} (use --force to overwrite)")]
9    KeystoreAlreadyExists { path: String },
10
11    #[error("wrong passphrase or corrupted keystore")]
12    DecryptionFailed,
13
14    #[error("invalid signature")]
15    InvalidSignature,
16
17    #[error("unsupported keystore version: {version}")]
18    UnsupportedVersion { version: u32 },
19
20    #[error("envelope verification failed: {reason}")]
21    VerificationFailed { reason: String },
22
23    #[error("invalid key material: {reason}")]
24    InvalidKeyMaterial { reason: String },
25
26    #[error("missing owner passphrase and no interactive terminal is available")]
27    MissingPassphrase,
28
29    #[error("OS keychain unavailable: {reason}")]
30    KeychainUnavailable { reason: String },
31
32    #[error("OS keychain access denied: {reason}")]
33    KeychainAccessDenied { reason: String },
34
35    #[error(transparent)]
36    Io(#[from] std::io::Error),
37
38    #[error(transparent)]
39    Json(#[from] serde_json::Error),
40}