code wiki / _hdl_build / nx_doc_envelope_gate.nx

nx_doc_envelope_gate.nx

buildroot/runtime/_hdl_build/nx_doc_envelope_gate.nx

14238 B266 linesdepth 11pulls 16 transitivereach 0 importersview sourcekind gate/prooftopic doc
docsdependenciesstructsconstsfunctions

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

nx_doc_envelope.nx nx_doc_seal.nx nx_doc_vault.nx nx_legal_compliance.nx nx_syscalls.nx nx_doc_envelope_gate.nx

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

main sys_mmap nx_vault_add nx_env_create nx_legal_doc_classify lc_ci_contains lc_slen lc_lower nx_legal_regime nx_legal_is_excluded nx_env_doctype ne_find_env nx_env_regime ne_find_env ↻ nx_env_add_recipient nx_env_audit_add nx_env_send ne_find_env ↻ nx_env_required_signers nx_env_status ne_find_env ↻ nx_env_try_complete ne_find_env ↻ nx_env_signed_count mk_seal slen nx_seal_create sys_mmap ↻ nx_legal_verdict nx_legal_regime ↻ nx_seal_canonical sl_cat ed25519_sign_full sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte sha512_compress

structs

none

consts

41const DE_LOG: *u8 = "knowledge/status/doc_envelope.log"

functions

43func 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 }
called by 1: main calls 1: sys_write
44func ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
53func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: mk_seal
56func mk_seal(s: *NxSeal, dt: i64, ewills: i64, signer: *u8, ts: i64,
called by 1: main calls 2: slennx_seal_create
73func main() -> i64