confium_signatif/error.rs
1//! Errors for the SIGNATIF framework implementation.
2
3use thiserror::Error;
4
5/// Errors produced by the SIGNATIF framework implementation.
6#[derive(Debug, Error)]
7pub enum SignatifError {
8 /// A verification path could not be found from an artifact signer to
9 /// any root anchor in the trust anchor bundle.
10 #[error("no verification path to a trusted root")]
11 NoPath,
12 /// Scope widening detected at a delegation link — a hard failure.
13 #[error("scope widening at delegation link {parent} -> {child} on dimension {dimension}")]
14 ScopeWidening {
15 /// Parent authority identifier.
16 parent: String,
17 /// Child authority identifier.
18 child: String,
19 /// The scope dimension that was widened.
20 dimension: String,
21 },
22 /// A signature failed to verify.
23 #[error("signature verification failed for {context}")]
24 BadSignature {
25 /// What was being verified when the failure occurred.
26 context: String,
27 },
28 /// The trust anchor bundle is expired or not yet valid.
29 #[error("anchor bundle not valid at the evaluation time")]
30 BundleValidity,
31 /// Artifact format error (version, self-description, replay).
32 #[error("artifact format error: {0}")]
33 ArtifactFormat(String),
34 /// Hard-check failure carrying the failing check name.
35 #[error("hard check failed: {0}")]
36 HardCheck(String),
37 /// A required registry entry is unknown or retired.
38 #[error("registry {registry} has no usable entry {entry}")]
39 Registry {
40 /// Registry name.
41 registry: String,
42 /// Entry identifier.
43 entry: String,
44 },
45 /// CRL or revocation state error.
46 #[error("revocation error: {0}")]
47 Revocation(String),
48 /// Ceremony transcript audit failure.
49 #[error("ceremony audit failure: {0}")]
50 Ceremony(String),
51 /// Serialization or canonicalization failure.
52 #[error("encoding error: {0}")]
53 Encoding(String),
54}
55
56/// Convenient result alias.
57pub type SignatifResult<T> = Result<T, SignatifError>;