code wiki / _hdl_build / nx_doc_authz.nx

nx_doc_authz.nx

buildroot/runtime/_hdl_build/nx_doc_authz.nx

5263 B80 linesdepth 8pulls 15 transitivereach 10 importersview sourcekind librarytopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_authz.nx -- PER-CLIENT EYES-ONLY authorization for confidential docs (the P2 vault read gate). Closes the audit's most-dangerous gaps: no per-doc ownership, no authenticated private-read route (a WRITE-ONLY vault), and the free domain request param. HIPAA minimum-necessary 164.502(b) + ABA Model Rule 1.6(c) + iManage ethical walls: a confidential doc is readable ONLY by its OWNER (the authenticated subject who uploaded it) -- or a future attorney/partner tier -- and DENIED to everyone else, FAIL-CLOSED. Composes nx_doc_at_rest (doc_get decrypts) + the sovereign seg_store (own:<cid> ownership row, additive alongside doc:<cid> / pol:<cid>). STANDALONE lib -- wires into no daemon (the operator-approved swap is a later step, like P1). license_tier: ORIGINAL

dependencies 2 imports · 3 importers

nx_doc_at_rest.nx nx_docportal_lib.nx nx_doc_authz.nx nx_doc_authz_gate.nx nx_docportal_admin_lib.nx nx_docportal_authz_route_gate.nx

imports: nx_doc_at_rest.nxnx_docportal_lib.nx

imported by: nx_doc_authz_gate.nxnx_docportal_admin_lib.nxnx_docportal_authz_route_gate.nx

structs

none

consts

14const AUTHZ_TIER_OWNER: i64 = 3

functions

16func az_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
17func az_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 1: az_ownkey
18func az_eqbytes(a: *u8, b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 1: authz_may_read
20func az_ownkey(cid: i64, out: *u8) -> i64
31func authz_set_owner(domain: *u8, vis: i64, cid: i64, subject: *u8) -> i64
43func authz_get_owner(domain: *u8, vis: i64, cid: i64, out: *u8, outcap: i64) -> i64
63func authz_may_read(domain: *u8, vis: i64, cid: i64, subject: *u8, subject_level: i64) -> i64
77func authz_doc_get(domain: *u8, vis: i64, cid: i64, subject: *u8, subject_level: i64, out: *u8) -> i64
called by 2: mainda_handle calls 2: authz_may_readdoc_get