code wiki / _hdl_build / nx_doc_at_rest.nx
nx_doc_at_rest.nx
buildroot/runtime/_hdl_build/nx_doc_at_rest.nx
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
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
| 16 | const AT_MAGIC_LEN: i64 = 8 // "NXENC1\0\0" |
functions
| 19 | func at_write_magic(out: *u8) -> i64 called by 1: doc_put |
| 32 | func at_is_magic(v: *u8, vlen: i64) -> i64 |
| 47 | func at_rest_confidential(vis: i64) -> i64 |
| 55 | func dek_ensure(domain: *u8) -> i64 |
| 63 | func doc_put(domain: *u8, vis: i64, cid: i64, pt: *u8, ptlen: i64) -> i64 called by 3: mainmainda_handle calls 10: dp_prefixdp_keyat_rest_confidentialdek_ensuredoc_encryptat_write_magic+4 |
| 91 | func doc_get(domain: *u8, vis: i64, cid: i64, out: *u8) -> i64 |