nx_wiki_login_flow.nx
buildroot/runtime/wiki/nx_wiki_login_flow.nx
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
imports: nx_syscalls.nxsha256.nxnx_no_cookie_session.nxnx_base64.nx
imported by: nx_wiki_login_flow_test.nx
structs
| 147 | struct NxWloginAuth |
consts
| 33 | const NX_WLOGIN_OK: i64 = 0 |
| 34 | const NX_WLOGIN_BAD_INPUT: i64 = 2820 |
| 35 | const NX_WLOGIN_UNAUTHORIZED: i64 = 2821 |
| 36 | const NX_WLOGIN_MINT_FAILED: i64 = 2822 |
| 125 | const NX_WLOGIN_RESP_CAP: i64 = 4096 |
| 126 | const NX_WLOGIN_TOKEN_B64_CAP: i64 = 256 |
functions
| 41 | func nx_wlogin_ct_eq32(a: *u8, b: *u8) -> i64 called by 1: nx_wlogin_verify_pass |
| 54 | func nx_wlogin_verify_pass( |
| 71 | func nx_wlogin_login( |
| 101 | func nx_wlogin_check_session( called by 1: nx_wlogin_admin_handle calls 3: sys_mmapnx_ncs_derive_realm_id_hashnx_ncs_validate_token |
| 128 | func _wlh_append(buf: *u8, off_p: *i64, cap: i64, src: *u8, n: i64) -> i64 |
| 139 | func _wlh_append_z(buf: *u8, off_p: *i64, cap: i64, z: *u8) -> i64 |
| 158 | func nx_wlogin_auth_init(a: *NxWloginAuth, priv: *u8, pub: *u8, hash: *u8, called by 1: main |
| 172 | func nx_wlogin_admin_handle( |