code wiki / wiki / nx_wiki_login_flow.nx

nx_wiki_login_flow.nx

buildroot/runtime/wiki/nx_wiki_login_flow.nx

9147 B224 linesdepth 10pulls 18 transitivereach 1 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_login_flow.nx -- minimal COMPLIANT admin login for the wiki. Fills the two gaps left in nx_wiki_admin_wiring (POST-verify + session gate) by composing ONLY verified primitives. NO COOKIES (cardinal C1): login returns an Ed25519-signed no-cookie token; the client holds it in sessionStorage and sends X-Nishi-Session per request. COMPOSES (avoid-duplicate-primitives cardinal): sha256 sha256_hash (passphrase hash) hub/nx_no_cookie_session nx_ncs_mint_token / nx_ncs_validate_token (verified end-to-end 2026-05-29: mint+validate +expiry+tamper all green) hub/nx_no_cookie_session nx_ncs_derive_*_hash THREAT MODEL (V1, single admin): the admin passphrase hash is sha256(passphrase). This is NOT memory-hard -- argon2id (nx_argon2id, pending cross-validation) is the upgrade, tracked in the debt ledger as B#login-pass-hash-not-memory-hard. For a single operator passphrase on a sovereign LAN host this is the honest V1 floor, not a pretend-stub: it is a real constant-time check, just not yet KSF-hardened. All loops use the FLAT increment idiom (single `i = i + 1`), never the nested-if/early-exit-jump combo that the native compiler miscompiles (T#native-loopvar-jump-plus-nested-incr).

dependencies 4 imports · 1 importers

nx_syscalls.nx sha256.nx nx_no_cookie_session.nx nx_base64.nx nx_wiki_login_flow.nx nx_wiki_login_flow_test.nx

imports: nx_syscalls.nxsha256.nxnx_no_cookie_session.nxnx_base64.nx

imported by: nx_wiki_login_flow_test.nx

structs

147struct NxWloginAuth

consts

33const NX_WLOGIN_OK: i64 = 0
34const NX_WLOGIN_BAD_INPUT: i64 = 2820
35const NX_WLOGIN_UNAUTHORIZED: i64 = 2821
36const NX_WLOGIN_MINT_FAILED: i64 = 2822
125const NX_WLOGIN_RESP_CAP: i64 = 4096
126const NX_WLOGIN_TOKEN_B64_CAP: i64 = 256

functions

41func nx_wlogin_ct_eq32(a: *u8, b: *u8) -> i64
54func nx_wlogin_verify_pass(
71func nx_wlogin_login(
101func nx_wlogin_check_session(
128func _wlh_append(buf: *u8, off_p: *i64, cap: i64, src: *u8, n: i64) -> i64
139func _wlh_append_z(buf: *u8, off_p: *i64, cap: i64, z: *u8) -> i64
called by 1: nx_wlogin_admin_handle calls 1: _wlh_append
158func nx_wlogin_auth_init(a: *NxWloginAuth, priv: *u8, pub: *u8, hash: *u8,
called by 1: main
172func nx_wlogin_admin_handle(