pub struct Evidence {
pub verdict: Verdict,
pub checker: CheckerId,
pub inputs: Vec<Digest>,
pub signature: Signature,
pub key: SigningKeyId,
pub kind: EvidenceKind,
}Expand description
Re-exported so a consumer holding evidence does not also depend on
boundgraph-core just for the types it is made of.
ε — a signed verdict from a checker or a quorum.
§Example
use boundgraph_core::{CheckerId, Digest, Evidence, EvidenceKind, Signature, SigningKeyId, Verdict};
let patch = Digest::of(b"the patch that was checked");
let ev = Evidence::new(
Verdict::Pass,
CheckerId::new("cargo-test", 1),
vec![patch],
Signature::from_bytes([0u8; 64]),
SigningKeyId("host-key-1".into()),
EvidenceKind::Deterministic,
);
assert!(ev.permits_commit());
// Evidence names exactly what it covers, so it cannot be reattached.
assert!(ev.covers(&patch));
assert!(!ev.covers(&Digest::of(b"some other patch")));Fields§
§verdict: VerdictThe outcome.
checker: CheckerIdWhich checker decided, and at what version.
inputs: Vec<Digest>Digests of exactly what was checked.
This is what stops evidence being re-pointed at different data: a verdict only speaks about these inputs.
signature: SignatureSignature over the canonical encoding of every other field.
key: SigningKeyIdWhich key signed.
kind: EvidenceKindHow the verdict was reached.
Implementations§
Source§impl Evidence
impl Evidence
Sourcepub fn new(
verdict: Verdict,
checker: CheckerId,
inputs: impl IntoIterator<Item = Digest>,
signature: Signature,
key: SigningKeyId,
kind: EvidenceKind,
) -> Evidence
pub fn new( verdict: Verdict, checker: CheckerId, inputs: impl IntoIterator<Item = Digest>, signature: Signature, key: SigningKeyId, kind: EvidenceKind, ) -> Evidence
Construct evidence.
Inputs are sorted, so two verdicts over the same set of inputs share a digest regardless of the order the checker happened to list them.
Sourcepub fn permits_commit(&self) -> bool
pub fn permits_commit(&self) -> bool
Whether this evidence permits a state change to commit.
True only for Verdict::Pass.
Sourcepub fn covers(&self, digest: &Digest) -> bool
pub fn covers(&self, digest: &Digest) -> bool
Whether this evidence actually speaks about the given input.
A commit must check this. Passing evidence about a different artefact is not permission to commit this one.
Sourcepub fn signing_payload(&self) -> Result<Vec<u8>, CanonicalError>
pub fn signing_payload(&self) -> Result<Vec<u8>, CanonicalError>
The bytes a signature is made over: everything except the signature.
Exposed so the signer (US-0802) and any verifier compute the same pre-image, rather than each deriving it and hoping they agree.