code wiki / _hdl_build / nx_docportal_admin_daemon.nx

nx_docportal_admin_daemon.nx

buildroot/runtime/_hdl_build/nx_docportal_admin_daemon.nx

72720 B1099 linesdepth 17pulls 85 transitivereach 4 importersview sourcekind servicetopic docportal
docsdependenciesstructsconstsfunctions

about

nx_docportal_admin_daemon.nx -- the admin.<domain> DOCUMENT-PORTAL daemon, on the CANONICAL ecosystem auth (the SAME Modern Auth nishifamily.com/status uses: OPAQUE-3DH + Argon2id + NO-COOKIE Ed25519 session). Operator 2026-06-28: "match it to what we have in the nishi ecosystem and team." So this does NOT invent a token scheme -- it COMPOSES nx_status_daemon's proven auth (sd_* request parsing + nx_modern_auth_login + nx_sa_validate) and wraps the proven nx_docportal_admin_lib router da_handle: GET /admin -> the no-cookie login + upload SPA shell (public) POST /admin/login -> handle+passphrase -> nx_modern_auth_login -> 200 {"token":...} | 401 * /admin/* (token) -> X-Nishi-Session validates (nx_sa_validate) ? da_handle at STAFF level : 401 A loopback HTTP daemon the sites daemon reverse-proxies to (behind the SNI router admin.<d> row); the public TLS + cert are the operator-gated deploy step. Pure router dad_handle = bytes-in/bytes-out (the gate drives it in-process, no socket). license_tier: ORIGINAL

dependencies 11 imports · 4 importers

nx_docportal_admin_lib.nx nx_status_daemon.nx nx_modern_auth_flow.nx nx_syscalls.nx nx_invite_token.nx nx_opaque_login.nx nx_proxy_route.nx nx_docportal_search_serve.nx nx_tool_registry.nx nx_multipart.nx nx_docportal_admin_daemon.nx nx_browser_forms_e2e_gate.nx nx_docportal_admin_daemon_gate.nx nx_docportal_multipart_gate.nx nx_nojs_session_gate.nx

diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.

imports: nx_docportal_admin_lib.nxnx_status_daemon.nxnx_modern_auth_flow.nxnx_syscalls.nxnx_invite_token.nxnx_opaque_login.nxnx_proxy_route.nxnx_docportal_search_serve.nxnx_tool_registry.nxnx_multipart.nxnx_sysload.nx

imported by: nx_browser_forms_e2e_gate.nxnx_docportal_admin_daemon_gate.nxnx_docportal_multipart_gate.nxnx_nojs_session_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 nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ nx_uas_server_keys_load_or sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap 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 ↻ u256_alloc nx_scratch

structs

none

consts

27const DAD_ACCEPT_BACKOFF_MS: i64 = 50
43const DAD_REFRESH_MIN_SEC: i64 = 300
49const DAD_REFRESH_MAX_SEC: i64 = 3 * DAD_REFRESH_MIN_SEC
50const DAD_REQCAP: i64 = 65536
51const DAD_OUTCAP: i64 = 524288
59const DAD_CPU_RESERVE: i64 = 2
62const DAD_MIN_WORKERS: i64 = 1
368const DAD_MAXPARTS: i64 = 16
433const DAD_EDGE_READ_TMO_S: i64 = 15 // sites.elf NX_SD2_BACKEND_TIMEOUT_S: the per-read window a route gets when proxy_routes.conf carries no timeout= token
434const DAD_HB_DIV: i64 = 3 // heartbeats at a third of the window
435const DAD_HB_POLL_MS: i64 = 200 // how often the writer asks whether the search process has finished
436const DAD_WNOHANG: i64 = 1 // wait4 flag: poll, never block -- the writer must keep breathing
437const DAD_MS_PER_S: i64 = 1000
438const DAD_BODY_MODE: i64 = 420 // 0644: the grandchild's per-request body file

functions

67func dad_reap_done(wst: *i64) -> i64
called by 1: main calls 1: sys_wait4
90func dad_worker_cap() -> i64
called by 1: main calls 1: sl_ncpu
99func dad_shell(out: *u8) -> i64
called by 1: dad_handle calls 3: sys_mmapsd_catsd_catn
131func dad_invite_path(ctx: *NxAuthContext, out: *u8) -> i64
called by 2: dad_handlemain
149func dad_landing(out: *u8, b64: *u8, b64n: i64) -> i64
170func dad_hex32(src: *u8, out: *u8) -> i64
called by 1: dad_handle
177func dad_uidmap_path(ctx: *NxAuthContext, out: *u8) -> i64
called by 1: dad_handle
187func dad_map_put(path: *u8, hexuid: *u8, h: *u8, hn: i64) -> i64
202func dad_map_get(path: *u8, hexuid: *u8, out: *u8, cap: i64) -> i64
237func dad_ui_page(out: *u8, handle: *u8, hn: i64, sraw: *u8, sn: i64) -> i64
called by 1: dad_handle calls 3: sys_mmapsd_catsd_catn
264func dad_uploadtext(ctx: *NxAuthContext, req: *u8, req_n: i64, subject: *u8, out: *u8) -> i64
323func dad_ct_boundary(req: *u8, req_n: i64, out: *u8) -> i64
348func dad_cd_extract(body: *u8, hoff: i64, hlen: i64, key: *u8, out: *u8) -> i64
called by 1: dad_uploadfile
372func dad_uploadfile(ctx: *NxAuthContext, req: *u8, req_n: i64, subject: *u8, out: *u8) -> i64
441func dad_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
453func dad_hb_ms(host: *u8) -> i64
480func dad_early_ok_tab(routes: *u8, rn: i64, host: *u8) -> i64
494func dad_early_ok(req: *u8, req_n: i64) -> i64
504func dad_serve_early(cfd: i64, req: *u8, req_n: i64, out: *u8) -> i64
559func dad_handle(ctx: *NxAuthContext, req: *u8, req_n: i64, out: *u8) -> i64
816func main(argc: i64, argv: *i64) -> i64