code wiki / (root) / nx_doc_seal.nx

nx_doc_seal.nx

buildroot/runtime/nx_doc_seal.nx

5602 B129 linesdepth 9pulls 13 transitivereach 11 importersview sourcekind librarytopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_seal.nx -- LEGAL RUNG D5: tamper-evident e-signature SEAL. module: nishi-core.legal.doc_seal capability: LEGAL_ESIGN_SEAL Produces a non-repudiable, tamper-evident seal binding {document hash + signer identity + timestamp + the D0 legal regime/verdict} under a REAL RFC 8032 Ed25519 signature (not the V1 nx_sign_facade stand-in, which is explicitly non-cryptographic). This is the "DocuSign but better" core: 1. NEVER SEAL A VOID INSTRUMENT -- nx_seal_create FIRST runs the D0 compliance verdict (nx_legal_compliance) and REFUSES to produce any signature unless the verdict is VALID. The Rule-26 legal invariant is thus carried into the signing layer: you physically cannot e-seal a will that would be legally void. A generic e-sign product signs first and asks never; this one cannot. 2. CANONICAL RECORD -- a deterministic serialization binds the document hash, signer, timestamp, regime and verdict, so the signature commits to the FULL legal validity context, not just "someone clicked sign". 3. TAMPER-EVIDENT -- nx_seal_verify recomputes nothing it isn't given; any single-byte change to the canonical record (document hash, signer, regime, ...) breaks the Ed25519 verification (proven in the gate). Composes: nx_legal_compliance (D0 verdict), the ed25519 RFC-8032 chain (real signature). Distinct from nx_sign_facade because: that is a non- cryptographic V1 stand-in; a legal signature needs real Ed25519. license_tier: ORIGINAL lineage_id: nishi_doc_seal_d5

dependencies 8 imports · 7 importers

nx_syscalls.nx nx_legal_compliance.nx nx_x25519.nx nx_ed25519_field.nx nx_ed25519_point.nx nx_ed25519_arith.nx nx_ed25519_scalar.nx nx_ed25519_signature.nx nx_doc_seal.nx nx_doc_annotate_gate.nx nx_doc_envelope.nx nx_doc_envelope_gate.nx nx_doc_seal_gate.nx nx_legal_portal_boot_gate.nx nx_legal_portal_gate.nx nx_legal_portal_live_gate.nx

imports: nx_syscalls.nxnx_legal_compliance.nxnx_x25519.nxnx_ed25519_field.nxnx_ed25519_point.nxnx_ed25519_arith.nxnx_ed25519_scalar.nxnx_ed25519_signature.nx

imported by: nx_doc_annotate_gate.nxnx_doc_envelope.nxnx_doc_envelope_gate.nxnx_doc_seal_gate.nxnx_legal_portal_boot_gate.nxnx_legal_portal_gate.nxnx_legal_portal_live_gate.nx

structs

50struct NxSeal

consts

40const SEAL_OK: i64 = 0
41const SEAL_REFUSED_VOID: i64 = 1 // D0 verdict INVALID_VOID -> no signature produced
42const SEAL_REFUSED_NEEDS_MORE: i64 = 2 // D0 verdict NEEDS_MORE -> no signature produced
44const SEAL_VERIFIED: i64 = 0
45const SEAL_TAMPERED: i64 = 1

functions

74func sl_cat(out: *u8, o: i64, s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { out[o] = s[k]; o = o + 1; k = k + 1 } return o }
called by 1: nx_seal_canonical
78func nx_seal_canonical(out: *u8, doc_hash: *u8, doc_hash_len: i64,
called by 1: nx_seal_create calls 1: sl_cat
100func nx_seal_create(s: *NxSeal) -> i64
125func nx_seal_verify(s: *NxSeal, pub: *u8) -> i64
called by 2: nx_env_signmain calls 1: ed25519_verify_full