code wiki / _hdl_build / nx_status_daemon.nx
nx_status_daemon.nx
buildroot/runtime/_hdl_build/nx_status_daemon.nx
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
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
structs
| none |
consts
| 25 | const SD_MAGIC_8192: i64 = 8192 |
| 27 | const SD_REQCAP: i64 = 65536 |
| 28 | const SD_OUTCAP: i64 = 524288 |
functions
| 30 | func sd_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } return n } |
| 31 | func 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 } |
| 32 | func 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 } |
| 33 | func sd_catn(d: *u8, o: i64, v: i64) -> i64 |
| 41 | func sd_starts(req: *u8, n: i64, s: *u8) -> i64 called by 11: dad_uploadfiledad_handleepd_handlema_srcwrite_pathokma_is_write_routema_path_eq+5 calls 1: sd_len |
| 52 | func sd_find_path(req: *u8, n: i64, off_box: *i64, len_box: *i64) -> i64 |
| 67 | func sd_body_off(req: *u8, n: i64) -> i64 |
| 76 | func sd_hexnib(c: i64) -> i64 called by 1: sd_urldecode |
| 84 | func sd_urldecode(src: *u8, n: i64, out: *u8, out_cap: i64) -> i64 called by 7: dad_uploadtextdad_handleepd_handlema_loginma_schema_append_rowsed_handle+1 calls 1: sd_hexnib |
| 107 | func sd_form_field(body: *u8, body_n: i64, name: *u8, name_n: i64, out_off: *i64, out_n: *i64) -> i64 |
| 138 | func sd_shell(out: *u8) -> i64 |
| 149 | func sd_emit_401_json(out: *u8) -> i64 |
| 154 | func sd_handle(ctx: *NxAuthContext, req: *u8, req_n: i64, statusfile: *u8, out: *u8) -> i64 |
| 219 | func main(argc: i64, argv: *i64) -> i64 |