code wiki / _hdl_build / nx_doc_envelope_gate.nx
nx_doc_envelope_gate.nx
buildroot/runtime/_hdl_build/nx_doc_envelope_gate.nx
about
nx_doc_envelope_gate.nx -- GATE for LEGAL D2 (nx_doc_envelope).
Drives the e-signature ENVELOPE workflow composing D0 (compliance) + D1
(vault) + D5 (real Ed25519 seal over the RFC 8032 KAT keypair) and asserts
every workflow invariant WITH a negative control:
T1 HAPPY+VAULT : a contract envelope with 2 ordered signers (+1 CC) sends,
cannot complete before signing, completes once both have
a verified seal, and the sealed version lands in the
additive per-tenant vault.
T2 NEVER-ROUTE-VOID (the s-class crux) : a Last Will & Testament in a
NON-e-wills jurisdiction -> SEND is REFUSED_VOID and the
envelope STAYS DRAFT. A generic e-sign clone would send it
and collect a legally void signature; this one cannot.
T3 ROUTING ORDER: signer 2 cannot sign before signer 1 (OUT_OF_ORDER), then
in-order both sign and it completes.
T4 TAMPER->NO-COMPLETE : a one-byte-tampered seal is rejected at SIGN
(BAD_SEAL) so the envelope cannot complete; restoring the
byte lets it sign + complete (forgery can't finish a deal).
T5 DECLINE ADDITIVE : a decline makes the envelope terminal-DECLINED while
the audit trail only GROWS and both recipients are retained
(Rule 13 additive-only).
T6 E-WILL NOT OVER-REFUSED : a properly executed e-will (testator + 2
witnesses + notary) in an e-wills state sends, signs and
completes -- we refuse the VOID path, not the valid one.
T7 TENANT ISOLATION : the per-tenant vault prefix discipline rejects
'.'/'/'/empty tenant ids (no cross-tenant traversal).
NOTE (honest): the gate uses the single RFC 8032 KAT keypair for determinism;
binding each signer to their OWN key is a provisioning/PKI rung. What is
proven here is the WORKFLOW logic + the legal invariants, not multi-key PKI.
Evidence -> knowledge/status/doc_envelope.log
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_doc_envelope.nxnx_doc_seal.nxnx_doc_vault.nxnx_legal_compliance.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 41 | const DE_LOG: *u8 = "knowledge/status/doc_envelope.log" |
functions
| 43 | func ew(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 44 | func ewn(fd: i64, v: i64) -> i64 |
| 53 | func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: mk_seal |
| 56 | func mk_seal(s: *NxSeal, dt: i64, ewills: i64, signer: *u8, ts: i64, |
| 73 | func main() -> i64 |