nx_trace_consent.nx
buildroot/runtime/nx_trace_consent.nx
about
nx_trace_consent.nx -- per-call cross-device sharing consent gate.
Per [[feedback-end-to-end-bit-traceability-architecture]] CARDINAL:
"Local trace per call in ~/.nishi/trace/<call_id>.jsonl default-off
cross-device; federated via Merkle-root + branch fetch with per-call
mutual consent."
THE 5TH AND FINAL bit-traceability primitive. Without this, traces
stay local (default-off) and cannot be shared across devices. With
it, traces can be shared but ONLY with explicit per-call consent
from BOTH parties (sharer + recipient).
Per [[feedback-privacy-by-default-no-tracking]]: consent is the
substrate's default-deny posture for cross-device data movement.
No automatic syncing.
V1 ships:
- sealed enum NxConsentDecision (PENDING/GRANTED/DENIED/EXPIRED/REVOKED)
- struct NxConsentRequest with call_id + sharer + recipient + scope + ttl
- struct NxConsentLedger of all decisions for audit
- propose / accept / decline / revoke verbs
- check predicate -- "is sharing call_id X to peer Y currently consented?"
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_substrate_closure_compose_test.nxnx_trace_consent_test.nx
structs
| 51 | struct NxConsentRequest |
| 63 | struct NxConsentLedger |
consts
| 29 | const NX_CC_PENDING: nx_int = 0 |
| 30 | const NX_CC_GRANTED: nx_int = 1 |
| 31 | const NX_CC_DENIED: nx_int = 2 |
| 32 | const NX_CC_EXPIRED: nx_int = 3 |
| 33 | const NX_CC_REVOKED: nx_int = 4 |
| 34 | const NX_CC_N_STATES: nx_int = 5 |
| 38 | const NX_CS_FULL_TRACE: nx_int = 0 // share the whole chain |
| 39 | const NX_CS_MERKLE_ROOT_ONLY: nx_int = 1 // share only the root hash |
| 40 | const NX_CS_BRANCH_FETCH: nx_int = 2 // recipient may pull specific links |
| 41 | const NX_CS_N_SCOPES: nx_int = 3 |
| 43 | const NX_TC_OK: nx_int = 0 |
| 44 | const NX_TC_ERR_BAD_DECISION: nx_int = 1 |
| 45 | const NX_TC_ERR_BAD_SCOPE: nx_int = 2 |
| 46 | const NX_TC_ERR_NOT_PENDING: nx_int = 3 |
| 47 | const NX_TC_ERR_NOT_FOUND: nx_int = 4 |
| 69 | const NX_TC_REQ_BYTES: nx_size = 72 |
functions
| 71 | func nx_cc_decision_is_valid(d: nx_int) -> nx_int |
| 77 | func nx_cs_scope_is_valid(s: nx_int) -> nx_int |
| 83 | func nx_trace_consent_new(capacity: nx_size) -> *NxConsentLedger |
| 92 | func _tc_at(l: *NxConsentLedger, idx: nx_size) -> *NxConsentRequest |
| 96 | func _tc_find(l: *NxConsentLedger, request_id: nx_int) -> nx_int |
| 111 | func nx_trace_consent_propose(l: *NxConsentLedger, |
| 141 | func nx_trace_consent_decide(l: *NxConsentLedger, |
| 167 | func nx_trace_consent_check(l: *NxConsentLedger, |
| 194 | func nx_trace_consent_count(l: *NxConsentLedger) -> nx_size called by 1: main |
| 198 | func nx_trace_consent_count_by_decision(l: *NxConsentLedger, decision: nx_int) -> nx_int |