code wiki / _hdl_build / nx_sitegen_studio_daemon.nx

nx_sitegen_studio_daemon.nx

buildroot/runtime/_hdl_build/nx_sitegen_studio_daemon.nx

15645 B282 linesdepth 16pulls 58 transitivereach 1 importersview sourcekind servicetopic sitegen
docsdependenciesstructsconstsfunctions

about

nx_sitegen_studio_daemon.nx -- the CAPABILITY-ADAPTIVE WYSIWYG studio for nishifamily.com/webdev, BEHIND the CANONICAL Modern Auth (the SINGLE ecosystem-wide login: OPAQUE-3DH + Argon2id KSF + BIP39 recovery + NO-COOKIE Ed25519 session, 152B X-Nishi-Session header). Operator: "OPAQUE login for all nishifamily.com/* sites." This composes the ONE shared gate nx_sa_validate -- NOT cookies, NOT nx_cms_admin (that argon2id+cookie path is the pre-charter CMS holdout). A loopback HTTP daemon the sites daemon reverse-proxies /webdev* to. The router is a PURE FUNCTION stu_handle(ctx, req, n, out) -> out_n (request bytes in, response bytes out, no socket); the socket loop is a thin shell; the gate drives it IN-PROCESS (sovereign, no curl/shell). Routes: POST /webdev/login -> handle=<h>&passphrase=<p> -> nx_modern_auth_login -> 200 {"token":"<b64 152B>"}|401 POST /webdev/build -> X-Nishi-Session validates (nx_sa_validate) ? se_build_tier(body) : 401 (privileged) GET /webdev/guided|blocks|freeform -> the tier surface (its /build fetch carries X-Nishi-Session) GET /webdev (+ any) -> the no-cookie SPA shell: login -> token in sessionStorage -> the tier picker Context armed at startup (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]=budget. Composes nx_site_auth + nx_modern_auth_flow + nx_studio_tiers (se_build_tier) + nx_http_server + nx_base64. license_tier: ORIGINAL

dependencies 6 imports · 1 importers

nx_syscalls.nx nx_http_server.nx nx_site_auth.nx nx_modern_auth_flow.nx nx_base64.nx nx_studio_tiers.nx nx_sitegen_studio_daemon.nx nx_studio_daemon_gate.nx

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

imported by: nx_studio_daemon_gate.nx

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

main sys_write stu_atoi stu_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

23const STU_MAGIC_262144: i64 = 262144
24const STU_MAGIC_262143: i64 = 262143
25const STU_MAGIC_8192: i64 = 8192
27const STU_REQCAP: i64 = 131072
28const STU_OUTCAP: i64 = 524288

functions

30func stu_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } return n }
31func stu_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 stu_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 }
called by 1: main
33func stu_catn(d: *u8, o: i64, v: i64) -> i64
called by 2: stu_servestu_handle calls 1: sys_mmap
41func stu_starts(req: *u8, n: i64, s: *u8) -> i64
called by 1: stu_handle calls 1: stu_len
48func stu_find_path(req: *u8, n: i64, off_box: *i64, len_box: *i64) -> i64
called by 1: stu_handle
61func stu_body_off(req: *u8, n: i64) -> i64
called by 1: stu_handle
69func stu_hexnib(c: i64) -> i64
called by 1: stu_urldecode
75func stu_urldecode(src: *u8, n: i64, out: *u8, out_cap: i64) -> i64
called by 1: stu_handle calls 1: stu_hexnib
96func stu_form_field(body: *u8, body_n: i64, name: *u8, name_n: i64, out_off: *i64, out_n: *i64) -> i64
called by 1: stu_handle
125func stu_emit_401(out: *u8) -> i64
called by 1: stu_handle calls 1: stu_cat
129func stu_serve(out: *u8, file: *u8) -> i64
141func stu_shell(out: *u8) -> i64
called by 1: stu_handle calls 1: stu_cat
154func stu_handle(ctx: *NxAuthContext, req: *u8, req_n: i64, out: *u8) -> i64
232func main(argc: i64, argv: *i64) -> i64