From d9432690722d47cf5ebd22adb8de89f866c5daa6 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Thu, 3 Oct 2024 08:46:20 -0700 Subject: [PATCH] . --- ic-agent/src/identity/error.rs | 5 ++++- ic-agent/src/identity/mod.rs | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ic-agent/src/identity/error.rs b/ic-agent/src/identity/error.rs index 93f5ad32..cd14c895 100644 --- a/ic-agent/src/identity/error.rs +++ b/ic-agent/src/identity/error.rs @@ -2,6 +2,7 @@ use ic_transport_types::Delegation; use thiserror::Error; /// An error happened while reading a PEM file. +#[cfg(feature = "pem")] #[derive(Error, Debug)] pub enum PemError { /// An error occurred with disk I/O. @@ -32,10 +33,12 @@ pub enum DelegationError { /// Parsing error in delegation bytes. #[error("A delegation could not be parsed")] Parse, - /// A key in the chain did not match the signature of the next chain link. If `to` is `None` then it refers to the `Identity`. + /// A key in the chain did not match the signature of the next chain link. #[error("A link was missing in the delegation chain")] BrokenChain { + /// The key that should have matched the next delegation from: Vec, + /// The delegation that didn't match, or `None` if the `Identity` didn't match to: Option, }, /// A key with an unknown algorithm was used. The IC supports Ed25519, secp256k1, and prime256v1, and in ECDSA the curve must be specified. diff --git a/ic-agent/src/identity/mod.rs b/ic-agent/src/identity/mod.rs index ed2dd4e3..45c9a301 100644 --- a/ic-agent/src/identity/mod.rs +++ b/ic-agent/src/identity/mod.rs @@ -6,12 +6,10 @@ use crate::{agent::EnvelopeContent, export::Principal}; pub(crate) mod anonymous; pub(crate) mod basic; pub(crate) mod delegated; +pub(crate) mod error; pub(crate) mod prime256v1; pub(crate) mod secp256k1; -#[cfg(feature = "pem")] -pub(crate) mod error; - #[doc(inline)] pub use anonymous::AnonymousIdentity; #[doc(inline)] @@ -19,6 +17,8 @@ pub use basic::BasicIdentity; #[doc(inline)] pub use delegated::DelegatedIdentity; #[doc(inline)] +pub use error::DelegationError; +#[doc(inline)] pub use ic_transport_types::{Delegation, SignedDelegation}; #[doc(inline)] pub use prime256v1::Prime256v1Identity; @@ -26,6 +26,7 @@ pub use prime256v1::Prime256v1Identity; pub use secp256k1::Secp256k1Identity; #[cfg(feature = "pem")] +#[doc(inline)] pub use error::PemError; /// A cryptographic signature, signed by an [Identity].