code wiki / _hdl_build / nx_doc_at_rest.nx

nx_doc_at_rest.nx

buildroot/runtime/_hdl_build/nx_doc_at_rest.nx

5233 B109 linesdepth 7pulls 14 transitivereach 12 importersview sourcekind librarytopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_at_rest.nx -- AT-REST WIRING: the thin store layer that seals CONFIDENTIAL docs with the crypto core (nx_doc_crypto) and reads plaintext + encrypted TRANSPARENTLY, so existing plaintext confidential docs never break. Composes the sovereign seg_store (dp_prefix/dp_key, ss_begin/ss_add/ss_commit/ss_open/ss_hget) exactly like dp_set_policy / the reclassify organ -- NO daemon edit; the future docportal change is a call-swap (dp_ingest's ss_add -> doc_put ; dp_read -> doc_get) the operator approves later. FORMAT: an 8-byte magic "NXENC1\0\0" prefixes an encrypted value. Encrypted stored value = magic(8) || nonce(12) || ciphertext || tag(16) (the nonce||ct||tag is doc_encrypt's envelope) A value WITHOUT the magic is LEGACY plaintext -> passed through verbatim on read. Plaintext + encrypted coexist. SCOPE: confidential shards only (DP_VIS_PRIVATE and any non-public class); the PUBLIC corpus path is unchanged. license_tier: ORIGINAL

dependencies 2 imports · 6 importers

nx_doc_crypto.nx nx_docportal_lib.nx nx_doc_at_rest.nx nx_doc_at_rest_gate.nx nx_doc_authz.nx nx_doc_authz_gate.nx nx_docportal_admin_lib.nx nx_docportal_at_rest_gate.nx nx_docportal_authz_route_gate.nx

imports: nx_doc_crypto.nxnx_docportal_lib.nx

imported by: nx_doc_at_rest_gate.nxnx_doc_authz.nxnx_doc_authz_gate.nxnx_docportal_admin_lib.nxnx_docportal_at_rest_gate.nxnx_docportal_authz_route_gate.nx

structs

none

consts

16const AT_MAGIC_LEN: i64 = 8 // "NXENC1\0\0"

functions

19func at_write_magic(out: *u8) -> i64
called by 1: doc_put
32func at_is_magic(v: *u8, vlen: i64) -> i64
called by 4: doc_getmainmainmain
47func at_rest_confidential(vis: i64) -> i64
55func dek_ensure(domain: *u8) -> i64
called by 1: doc_put calls 2: dek_loaddek_gen
63func doc_put(domain: *u8, vis: i64, cid: i64, pt: *u8, ptlen: i64) -> i64
91func doc_get(domain: *u8, vis: i64, cid: i64, out: *u8) -> i64