code wiki / _hdl_build / nx_status_daemon.nx

nx_status_daemon.nx

buildroot/runtime/_hdl_build/nx_status_daemon.nx

14360 B271 linesdepth 16pulls 48 transitivereach 18 importersview sourcekind servicetopic status
docsdependenciesstructsconstsfunctions

about

nx_status_daemon.nx -- THE ACCESS WALL for nishifamily.com/status, on the CANONICAL Modern Auth (the SINGLE ecosystem-wide auth: OPAQUE-3DH + Argon2id KSF + BIP39 recovery + NO-COOKIE Ed25519 session). Operator 2026-06-16: "lets have that be how all the sites work." Composes the ONE shared gate (nx_sa_validate) -- no bespoke crypto, no cookies (the prior cms_pw + Set-Cookie build violated the charter's C1 no-cookie cardinal and is gone). A loopback HTTP daemon the sites daemon reverse-proxies to. The router is a PURE FUNCTION sd_handle(ctx, req_bytes, n, statusfile, out) -> out_n -- request bytes in, response bytes out, no socket. The socket loop is a thin shell over it; the gate drives it IN-PROCESS (sovereign Nishi test, no curl/shell). Routes: POST /status/login -> handle=<h>&passphrase=<p> (url-decoded) -> nx_modern_auth_login -> 200 {"token":"<base64 152B>"} | 401 {"error":"unauthorized"} (same for wrong-pw / unknown-handle: client-enumeration defense) GET /status/content -> X-Nishi-Session header validates (nx_sa_validate) ? serve <statusfile> : 401 GET /status (+ any) -> the no-cookie SPA shell: login form + fetch() that stores the token in sessionStorage and sends it as X-Nishi-Session (NEVER a cookie) Context armed at startup via nx_uas_server_keys_load_or_init + nx_auth_context_init; the admin is provisioned out-of-band by nx_modauth_arm (this daemon never registers). argv: [1]=port [2]=keysfile [3]=storefile [4]=realm [5]=statusfile [6]=request-budget. Sovereign: nx_site_auth + nx_modern_auth_flow + nx_http_server + nx_base64 + nx_syscalls. license_tier: ORIGINAL

dependencies 5 imports · 5 importers

nx_syscalls.nx nx_http_server.nx nx_site_auth.nx nx_modern_auth_flow.nx nx_base64.nx nx_status_daemon.nx nx_docportal_admin_daemon.nx nx_email_portal_daemon.nx nx_mgmt_api.nx nx_siteedit_daemon.nx nx_status_daemon_gate.nx

imports: nx_syscalls.nxnx_http_server.nxnx_site_auth.nxnx_modern_auth_flow.nxnx_base64.nx

imported by: nx_docportal_admin_daemon.nxnx_email_portal_daemon.nxnx_mgmt_api.nxnx_siteedit_daemon.nxnx_status_daemon_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_write sd_atoi sd_len sys_mmap nx_uas_server_keys_load_or sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close _uas_hex_dec _uas_nib nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_opq_derive_keypair sys_mmap ↻ _voprf_load_context_string u256_alloc nx_scratch nx_scratch_init sys_mmap ↻ nx_scratch_oom sys_write ↻ sys_exit sys_mmap ↻ nx_opq_hash_to_scalar sys_mmap ↻ nx_h2c_expand_message_xmd_ sys_mmap ↻ _h2c_i2osp_1 _h2c_i2osp_2 u256_alloc ↻ _opq_reduce_48be_mod_n

structs

none

consts

25const SD_MAGIC_8192: i64 = 8192
27const SD_REQCAP: i64 = 65536
28const SD_OUTCAP: i64 = 524288

functions

30func sd_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } return n }
31func sd_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { d[o + i] = s[i]; i = i + 1 } return o + i }
32func sd_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != 0 as u8 { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v }
33func sd_catn(d: *u8, o: i64, v: i64) -> i64
41func sd_starts(req: *u8, n: i64, s: *u8) -> i64
52func sd_find_path(req: *u8, n: i64, off_box: *i64, len_box: *i64) -> i64
67func sd_body_off(req: *u8, n: i64) -> i64
76func sd_hexnib(c: i64) -> i64
called by 1: sd_urldecode
84func sd_urldecode(src: *u8, n: i64, out: *u8, out_cap: i64) -> i64
107func sd_form_field(body: *u8, body_n: i64, name: *u8, name_n: i64, out_off: *i64, out_n: *i64) -> i64
138func sd_shell(out: *u8) -> i64
called by 1: sd_handle calls 1: sd_cat
149func sd_emit_401_json(out: *u8) -> i64
154func sd_handle(ctx: *NxAuthContext, req: *u8, req_n: i64, statusfile: *u8, out: *u8) -> i64
219func main(argc: i64, argv: *i64) -> i64