1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Signature verifier trait for `PolicyStore`.
//!
//! This trait lives in the main `agentstategraph-policy` crate (rather
//! than in `agentstategraph-policy-sign`) so the policy crate does not
//! need to pull in crypto dependencies to hold the hook. §2c will ship
//! a concrete `Ed25519SignatureVerifier` implementation that composes
//! the `-sign` crate's `Ed25519Verifier` + canonical-JSON helper.
//!
//! Implementations are expected to:
//!
//! 1. Compute the canonical-JSON bytes of the policy with the
//! `signature` field excluded (via
//! `agentstategraph_policy_sign::canonicalize` or equivalent).
//! 2. Unpack the policy's `signature` field into
//! `(signer_key_id, raw_bytes)` and call their verifier.
use Error;
use cratePolicy;
/// Verify a policy's embedded signature.
///
/// Implementations are expected to compute canonical bytes via the
/// `agentstategraph-policy-sign` crate.
/// Why a signature was rejected.