1use alloc::string::String;
2use core::fmt;
3
4#[derive(Debug)]
6pub enum IdentityError {
7 #[allow(dead_code)]
8 Generation(String),
9
10 InvalidSignature,
11
12 InvalidPublicKey,
13
14 #[allow(dead_code)]
15 InvalidKey(String),
16}
17
18impl fmt::Display for IdentityError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 Self::Generation(msg) => write!(f, "Error generating identity: {msg}"),
22 Self::InvalidSignature => write!(f, "Invalid signature"),
23 Self::InvalidPublicKey => write!(f, "Invalid public key"),
24 Self::InvalidKey(msg) => write!(f, "Invalid key: {msg}"),
25 }
26 }
27}
28
29impl core::error::Error for IdentityError {}
30
31pub type Result<T> = core::result::Result<T, IdentityError>;