pub struct ProofVerifier<const N: usize> { /* private fields */ }Expand description
Three-layer proof verifier.
Encapsulates the epoch and nonce tracker needed for P1/P2/P3 verification.
Implementations§
Source§impl<const N: usize> ProofVerifier<N>
impl<const N: usize> ProofVerifier<N>
Sourcepub const fn new(epoch: u32) -> Self
pub const fn new(epoch: u32) -> Self
Creates a new proof verifier with the given epoch.
By default, nonce == 0 is rejected (no zero-nonce bypass).
Use set_allow_zero_nonce to enable
the sentinel behaviour for boot-time contexts.
Sourcepub fn set_allow_zero_nonce(&mut self, allow: bool)
pub fn set_allow_zero_nonce(&mut self, allow: bool)
Set whether nonce == 0 is allowed to bypass replay checks.
Sourcepub fn verify_p1(
&self,
table: &CapabilityTable<N>,
cap_index: u32,
cap_generation: u32,
required_rights: CapRights,
) -> Result<(), ProofError>
pub fn verify_p1( &self, table: &CapabilityTable<N>, cap_index: u32, cap_generation: u32, required_rights: CapRights, ) -> Result<(), ProofError>
P1: Capability existence + rights check.
Budget: < 1 us. No allocation. All checks execute regardless of
intermediate failures to prevent timing side-channel leakage.
The final error returned is deliberately the most generic
(InvalidHandle) to avoid leaking which check failed.
§Errors
Returns ProofError::InvalidHandle if the handle is invalid.
Returns ProofError::StaleCapability if the epoch does not match.
Returns ProofError::InsufficientRights if the rights are insufficient.
Sourcepub fn verify_p2(
&mut self,
table: &CapabilityTable<N>,
tree: &DerivationTree<N>,
cap_index: u32,
cap_generation: u32,
ctx: &PolicyContext,
) -> Result<(), ProofError>
pub fn verify_p2( &mut self, table: &CapabilityTable<N>, tree: &DerivationTree<N>, cap_index: u32, cap_generation: u32, ctx: &PolicyContext, ) -> Result<(), ProofError>
P2: Structural invariant validation (constant-time).
Budget: < 100 us. All checks execute regardless of intermediate failures to prevent timing side-channel leakage (ADR-135).
Checks: ownership chain, region bounds, lease expiry, delegation depth, nonce replay.
§Errors
Returns ProofError::PolicyViolation if any structural check fails.
Sourcepub fn verify_p3(
&self,
table: &CapabilityTable<N>,
tree: &DerivationTree<N>,
cap_index: u32,
cap_generation: u32,
max_depth: u8,
) -> Result<(), ProofError>
pub fn verify_p3( &self, table: &CapabilityTable<N>, tree: &DerivationTree<N>, cap_index: u32, cap_generation: u32, max_depth: u8, ) -> Result<(), ProofError>
P3: Deep proof — derivation chain integrity verification.
Walks the derivation tree from the given capability back to its root and verifies:
- Every ancestor is valid (not revoked).
- Depth decreases monotonically toward the root.
- Epoch values are non-decreasing from root to leaf.
- The chain terminates at a root node (depth 0).
- The chain length does not exceed
max_depth.
Budget: < 10 us for depth <= 8 (typical). Worst-case O(depth).
§Errors
Returns ProofError::DerivationChainBroken if the chain is
invalid, tampered, or does not reach a root.