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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// SPDX-License-Identifier: LGPL-3.0-only
//! Pluggable evidence validation + ring-cycle evidence tripwires.
//!
//! Two surfaces live here:
//!
//! 1. [`EvidenceValidator`] — the §13.1 trait the ring delegates the
//! "is the evidence sufficient at this gate?" decision to. Application
//! code supplies a concrete validator; the ring exposes [`AcceptAll`] as
//! the no-op default.
//!
//! 2. [`verify_ring_cycle_evidence`] / [`verify_view_cycle_evidence`] —
//! defense-in-depth tripwires that reject delegate calls bypassing ring
//! mediation. The primary protection is structural (the engine does not
//! expose the dispatch surface externally); these helpers are the second
//! line.
use crateDelegationError;
use crateTree;
// ── §13.1 Evidence validation trait ─────────────────────────────────────────
/// Pluggable evidence validation for ring gate transitions.
/// No-op default — accepts all evidence without inspection.
;
// ── Ring-cycle evidence tripwires ───────────────────────────────────────────
/// Verify that a dispatch input Tree carries ring-cycle evidence.
///
/// Returns `Ok(())` if `command.request_id` is present — injected by
/// `inject_command` during a legitimate ring cycle regardless of which
/// application vocabulary the ring uses. Returns `Err(DelegationError)` if
/// absent, indicating the delegate was called outside the ring, bypassing
/// BEFORE gates, CU authorization, and crossing attestation.
///
/// This is a defense-in-depth tripwire. The primary protection is structural:
/// `RingEngine` does not expose the dispatch surface externally.
///
/// Applications whose ring-cycle injection uses a different evidence key
/// should call [`verify_ring_cycle_evidence_with_key`] instead.
/// Verify that a dispatch input Tree carries ring-cycle evidence using a
/// caller-supplied marker key.
///
/// Identical to [`verify_ring_cycle_evidence`] but accepts any key the
/// application injects as its ring-cycle marker (e.g. `"command.operator"`,
/// `"command.session_id"`). Use this when the application's injection scheme
/// differs from the default `command.request_id` convention.
/// Verify that a view projection input Tree carries ring-cycle evidence.
///
/// Returns `Ok(())` if `view.id` is present (injected by `inject_view_intent`
/// during a legitimate ring cycle). Returns `Err(DelegationError)` if the
/// evidence is missing — indicating the delegate was called outside the ring.
///
/// Symmetric to [`verify_ring_cycle_evidence`] but keyed on the `view.*`
/// namespace. Implementors of [`crate::extension::ViewRing`] SHOULD call
/// this first.