ic_agent/identity/
error.rs1use ic_transport_types::Delegation;
2use thiserror::Error;
3
4#[cfg(feature = "pem")]
6#[derive(Error, Debug)]
7pub enum PemError {
8 #[error(transparent)]
10 Io(#[from] std::io::Error),
11
12 #[error("Only {0} curve is supported: {1:?}")]
14 UnsupportedKeyCurve(String, Vec<u8>),
15
16 #[cfg(feature = "pem")]
18 #[error("An error occurred while reading the file: {0}")]
19 PemError(#[from] pem::PemError),
20
21 #[cfg(feature = "pem")]
23 #[error("An error occurred while reading the file: {0}")]
24 DerError(#[from] der::Error),
25
26 #[error("Invalid private key: {0}")]
28 InvalidPrivateKey(String),
29
30 #[error("A key was rejected by k256: {0}")]
32 ErrorStack(#[from] k256::pkcs8::Error),
33}
34
35#[derive(Error, Debug)]
37pub enum DelegationError {
38 #[error("A delegation could not be parsed")]
40 Parse,
41 #[error("A link was missing in the delegation chain")]
43 BrokenChain {
44 from: Vec<u8>,
46 to: Option<Delegation>,
48 },
49 #[error("The delegation chain contained a key with an unknown algorithm")]
51 UnknownAlgorithm,
52 #[error("A delegated-to identity encountered an error: {0}")]
54 IdentityError(String),
55}