nx_hr.nx
buildroot/runtime/nx_hr.nx
about
nx_hr.nx -- NISHI HR: the S-class sovereign USER-MANAGEMENT structure (the access SSOT). Built ON the OPAQUE
identity: a user's primary key is the cred_id = lowercase-hex of SHA-256(realm|||handle) -- the STABLE per-realm
id, derivable from a handle WITHOUT a login (so the operator provisions people by handle). The directory is
APPEND-ONLY (CLAUDE.md #13 additive-only, DV2.0 satellite/is_current): every lifecycle event appends a record;
the LATEST record per cred_id is current. DENY-BY-DEFAULT: an unknown OR suspended user resolves to level 0.
History is preserved (audit + rollback). This REPLACES the hand-maintained flat roles TSV as the "granted
level" source for every gated surface (torrent, gallery, hub). Composes hub/nx_no_cookie_session (the id hash).
record: cred_id <TAB> handle <TAB> level <TAB> family <TAB> status <TAB> ts <TAB> actor \n
status: active | suspended level: 3=owner/operator, 1=family/member, 0=none license_tier: ORIGINAL
dependencies 2 imports · 23 importers
diagram shows first 10 each side; +0 more imports, +13 more importers in the complete lists below.
imports: nx_no_cookie_session.nxnx_syscalls.nx
imported by: nx_account_admin_exceed_gate.nxnx_gen_live_probe.nxnx_hr_access.nxnx_hr_access_gate.nxnx_hr_admin_page.nxnx_hr_admin_page_gate.nxnx_hr_audit.nxnx_hr_audit_gate.nxnx_hr_autoraci.nxnx_hr_census.nxnx_hr_entitle.nxnx_hr_entitle_gate.nxnx_hr_gate.nxnx_hr_migrate.nxnx_hr_migrate_gate.nxnx_hr_provision_roster.nxnx_hr_sheriff.nxnx_hr_team.nxnx_hr_visitor.nxnx_hr_visitor_log.nxnx_iot_hub_tenant.nxnx_realm_multi_gate.nxnx_torrent_authn.nx
structs
| none |
consts
| 12 | const HR_MAGIC_1048576: i64 = 1048576 |
| 14 | const HR_TAB: i64 = 9 |
| 15 | const HR_NL: i64 = 10 |
functions
| 17 | func hr_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 18 | func hr_puts(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[o+i]=s[i]; i=i+1 } return o+i } |
| 19 | func hr_putn(dst: *u8, o: i64, v: i64) -> i64 { if v==0 { dst[o]=48 as u8; return o+1 } var m: i64=v; if m<0{m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var j:i64=0; while j<k{dst[o+j]=t[k-1-j];j=j+1} return o+k } |
| 20 | func hr_read(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 {return 0} var off: i64=0; var go: i64=1; while go==1 { if off>=cap {go=0} else { let r: i64=sys_read(fd, buf+off, cap-off); if r<=0 {go=0} else {off=off+r} } } sys_close(fd); return off } |
| 23 | func hr_hexenc(inp: *u8, n: i64, out: *u8) -> i64 |
| 30 | func hr_cred_id(realm: *u8, realm_n: i64, handle: *u8, hn: i64, out_hex: *u8) -> i64 called by 8: mainmainhr_enrollhe_super_ofmainiot_hub_viewer_access+2 calls 3: sys_mmapnx_ncs_derive_user_id_hashhr_hexenc |
| 37 | func hr_append(store: *u8, cred_id: *u8, handle: *u8, level: i64, family: *u8, status_active: i64, ts: i64, actor: *u8) -> i64 |
| 54 | func hr_enroll(store: *u8, realm: *u8, realm_n: i64, handle: *u8, hn: i64, level: i64, family: *u8, ts: i64, actor: *u8, out_hex: *u8) -> i64 |
| 59 | func hr_set_role(store: *u8, cred_id: *u8, handle: *u8, level: i64, family: *u8, ts: i64, actor: *u8) -> i64 { return hr_append(store, cred_id, handle, level, family, 1, ts, actor) } |
| 60 | func hr_suspend(store: *u8, cred_id: *u8, handle: *u8, family: *u8, ts: i64, actor: *u8) -> i64 { return hr_append(store, cred_id, handle, 0, family, 0, ts, actor) } |
| 63 | func hr_field_end(buf: *u8, start: i64, le: i64) -> i64 { var e: i64=start; while e<le { if buf[e]==(HR_TAB as u8) { return e } e=e+1 } return le } |
| 64 | func hr_line_end(buf: *u8, start: i64, n: i64) -> i64 { var e: i64=start; while e<n { if buf[e]==(HR_NL as u8) { return e } e=e+1 } return n } |
| 65 | func hr_eqrange(buf: *u8, s: i64, e: i64, lit: *u8, litn: i64) -> i64 { if (e-s)!=litn { return 0 } var k: i64=0; while k<litn { if buf[s+k]!=lit[k] { return 0 } k=k+1 } return 1 } |
| 66 | func hr_intrange(buf: *u8, s: i64, e: i64) -> i64 { var v: i64=0; var q: i64=s; while q<e { let c: i64=buf[q] as i64; if c>=48 { if c<=57 { v=v*10+(c-48); q=q+1 } else { q=e } } else { q=e } } return v } |
| 70 | func hr_resolve_level(store: *u8, cred_id: *u8, cidlen: i64) -> i64 |
| 91 | func hr_record_count(store: *u8) -> i64 |