#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::expect_used)]
use cordance_core::pack::CordancePack;
use cordance_core::receipt::{AuthorityBoundary, CortexReceiptV1Candidate};
pub mod builder;
pub mod validator;
#[derive(Debug, thiserror::Error)]
pub enum CortexError {
#[error("receipt validation error: {0}")]
Validation(String),
#[error("serialisation error: {0}")]
Serde(#[from] serde_json::Error),
}
#[allow(clippy::missing_errors_doc)]
pub fn build_receipt(pack: &CordancePack) -> Result<CortexReceiptV1Candidate, CortexError> {
builder::build_receipt(pack)
}
#[must_use]
pub const fn safe_boundary() -> AuthorityBoundary {
AuthorityBoundary::candidate_only()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn safe_boundary_grants_nothing() {
let b = safe_boundary();
assert!(b.candidate_only);
assert!(!b.cortex_truth_allowed);
}
}