code wiki / (root) / nx_hr_access.nx

nx_hr_access.nx

buildroot/runtime/nx_hr_access.nx

3239 B48 linesdepth 16pulls 51 transitivereach 3 importersview sourcekind librarytopic hr
docsdependenciesstructsconstsfunctions

about

nx_hr_access.nx -- the SHARED access adapter: resolve a no-cookie SESSION TOKEN to an HR level, so EVERY gated surface (gallery, hub, torrent already does this) uses the ONE access SSOT (nx_hr) instead of its own flat/realm gating. This is the mechanism the HR roadmap called for ("wire gallery/hub level resolution to HR"); it is ADDITIVE -- a surface IMPORTS it and calls hac_gate(...) at its resource boundary, no surface daemon is rewritten here (coordination-correct: provide the mechanism, the owning workstream adopts it). The chain (all sovereign): olg_whoami validates the Ed25519 no-cookie token -> the 32-byte user-id hash == the HR cred_id (SHA-256(realm|||handle); verified) -> hr_resolve_level. DENY-BY-DEFAULT at every step: an invalid/expired token, or a valid token for a user NOT enrolled in HR (authenticated but not authorized), or a suspended user, all resolve to level 0. So AUTHENTICATION alone grants nothing -- HR is the authority. realm-agnostic (the token's uid already encodes its realm), so one adapter serves every property.

dependencies 4 imports · 2 importers

nx_opaque_login.nx nx_hr.nx nx_hr_admin.nx nx_syscalls.nx nx_hr_access.nx nx_hr_access_gate.nx nx_iot_hub_serve_realm.nx

imports: nx_opaque_login.nxnx_hr.nxnx_hr_admin.nxnx_syscalls.nx

imported by: nx_hr_access_gate.nxnx_iot_hub_serve_realm.nx

structs

none

consts

none

functions

19func hac_uid_hex(ctx: *NxAuthContext, token: *u8, tn: i64, now: i64, out_hex: *u8) -> i64
26func hac_session_level(ctx: *NxAuthContext, token: *u8, tn: i64, now: i64, hr_store: *u8) -> i64
34func hac_session_is_super(ctx: *NxAuthContext, token: *u8, tn: i64, now: i64, hr_store: *u8) -> i64
42func hac_allows(level: i64, required: i64) -> i64 { if level >= required { return 1 } return 0 }
called by 2: hac_gatemain
46func hac_gate(ctx: *NxAuthContext, token: *u8, tn: i64, now: i64, hr_store: *u8, required: i64) -> i64
called by 1: main calls 2: hac_allowshac_session_level