use asimov_id::KeyError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum KeyringError {
#[error("user not found")]
UserNotFound,
#[error("invalid keyring user: {0}")]
InvalidUser(#[from] asimov_core::InvalidFilenameComponent),
#[cfg(feature = "std")]
#[error("keyring coordination lock poisoned")]
LockPoisoned,
#[error("corrupt secret key: expected 32 bytes, got {length}")]
CorruptSecret {
length: usize,
},
#[cfg(feature = "std")]
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[cfg(feature = "std")]
#[error(
"public-key publication failed: {cache_error}; secret rollback failed: {rollback_error}"
)]
RekeyRollbackFailed {
#[source]
cache_error: std::io::Error,
rollback_error: keyring_core::Error,
},
#[error("keyring error: {0}")]
KeyringError(#[from] keyring_core::Error),
#[error("key error: {0}")]
KeyError(#[from] KeyError),
}