code wiki / (root) / nx_attest.nx

nx_attest.nx

buildroot/runtime/nx_attest.nx

9576 B281 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind tooltopic attest
docsdependenciesstructsconstsfunctions

about

nx_attest.nx -- append-only Merkle log for cryptographic attestation of every state-changing operation. Per docs/SECURITY_POSTURE.md principle P11: every privileged operation (commit, signing, key gen, deploy, capability grant, rate-limit lockout) gets logged with a chained SHA-256 hash that external witnesses can verify and that prevents tampering with the historical record. Append-only Merkle structure: record_n = sha256(prev_hash || record_n_data) prev_hash for record_0 is a published genesis hash Anyone holding a later record_k can verify all earlier records by walking back to genesis. Tampering with any historical record breaks the chain at that point and every subsequent hash; instantly detectable. Use: log = nx_attest_log_new(genesis_hash) nx_attest_record(log, op_type, op_data, op_data_len) nx_attest_verify(log, expected_head_hash) -> 1 / 0 The genesis hash is committed to git + signed by the K-of-N authority keys. Forking history from genesis is detectable by any verifier with a different genesis (i.e. external witness). Pairs with: sha256.nx (chain hash), nx_rate_limit.nx (logs failures), nx_caps.nx (logs capability grants/revokes), nx_pqc.nx (signs the log head with PQ-safe keys).

dependencies 2 imports · 0 importers

syscalls.nx sha256.nx nx_attest.nx

imports: syscalls.nxsha256.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_attest_log_new nx_attest_record nx_attest_w_u32 nx_attest_w_u64 nx_attest_now_ms nx_attest_get_head nx_attest_verify

structs

62struct NxAttestLog

consts

41const NX_MAGIC_1000000: i64 = 1000000
42const NX_MAGIC_65536: i64 = 65536
46const NX_ATT_OP_KEY_GEN: i64 = 1
47const NX_ATT_OP_SIGN: i64 = 2
48const NX_ATT_OP_VERIFY_PASS: i64 = 3
49const NX_ATT_OP_VERIFY_FAIL: i64 = 4
50const NX_ATT_OP_CAP_GRANT: i64 = 5
51const NX_ATT_OP_CAP_REVOKE: i64 = 6
52const NX_ATT_OP_DEPLOY: i64 = 7
53const NX_ATT_OP_RATE_LOCKOUT: i64 = 8
54const NX_ATT_OP_RATE_UNLOCK: i64 = 9
55const NX_ATT_OP_BOOTSTRAP: i64 = 10
56const NX_ATT_OP_KEY_ROTATE: i64 = 11
57const NX_ATT_OP_VALIDATOR_FAIL: i64 = 12
58const NX_ATT_OP_BUILD: i64 = 13
70const NX_ATT_LOG_BYTES: i64 = 40
72const NX_ATT_HASH_BYTES: i64 = 32
81const NX_ATT_REC_HEADER: i64 = 20

functions

84func nx_attest_log_new(genesis_hash: *u8, cap: i64) -> *NxAttestLog
called by 1: main
101func nx_attest_now_ms() -> i64
called by 1: nx_attest_record
109func nx_attest_w_u32(dst: *u8, off: i64, v: i64) -> i64
called by 1: nx_attest_record
118func nx_attest_w_u64(dst: *u8, off: i64, v: i64) -> i64
called by 1: nx_attest_record
137func nx_attest_record(l: *NxAttestLog, op_type: i64,
195func nx_attest_verify(l: *NxAttestLog, expected_head_hash: *u8) -> i64
called by 1: main
205func nx_attest_get_head(l: *NxAttestLog, out: *u8) -> i64
called by 1: main
216func main() -> i64