nx_opaque_pake.nx
buildroot/runtime/hub/nx_opaque_pake.nx
about
nx_opaque_pake.nx -- V-MODAUTH-2c: RFC 9807 OPAQUE-3DH top level (registration + login).
THE auth capability the charter calls the crown jewel: the wiki (and every
Nishi site) gets password login where the server stores only a RegistrationRecord
that is useless for offline cracking without the separate oprf_seed, and login
produces a mutually-authenticated session_key without the password ever being
comparable server-side.
V1 DEPLOYMENT HONESTY: until the NishiLang->wasm browser client ships the wire
PAKE (client-side Blind/KE1/KE3), the wiki daemon runs BOTH roles in-process on
the passphrase it received over TLS. What OPAQUE buys ALREADY in that mode:
nothing offline-crackable at rest, memory-hard KSF per guess, enumeration-resistant
masked responses, and the EXACT RFC wire formats exercised end-to-end -- so the
future wasm client speaks to this server with ZERO server change. The wire-PAKE
client is the named follow-on rung (V-MODAUTH-8, JS-last-mile lane).
Deterministic cores (*_det) take ALL randomness as arguments = RFC C.1.5/C.1.6
vectors drive them byte-exact; wrappers draw CSPRNG.
Message sizes (sealed, = RFC wire format):
RegistrationRequest 33 RegistrationResponse 66 RegistrationRecord 129
KE1 98 KE2 259 KE3 32
COMPOSES: hub/nx_opaque_core, hub/nx_opaque_envelope, hub/nx_opaque_3dh,
hub/nx_voprf (+finalize), nx_csprng
COMPOSED BY: hub/nx_modern_auth_flow (register/login bodies), future wasm client
SPEC: RFC 9807 §5 (registration), §6 (online AKE), §6.3 (credential retrieval)
license_tier: ORIGINAL
dependencies 14 imports · 2 importers
diagram shows first 10 each side; +4 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_u256.nxnx_csprng.nxsha256.nxnx_hmac.nxnx_hkdf.nxnx_p256_point.nxnx_p256_scalar_mul.nxnx_voprf.nxnx_voprf_finalize.nxnx_h2c_p256.nxnx_opaque_core.nxnx_opaque_envelope.nxnx_opaque_3dh.nx
imported by: nx_modern_auth_flow.nxnx_opaque_rfc_kat.nx
structs
| 57 | struct NxOpqClientCfg |
| 71 | struct NxOpqServerCfg |
consts
| 46 | const NX_OPQ_REG_REQUEST_BYTES: i64 = 33 |
| 47 | const NX_OPQ_REG_RESPONSE_BYTES: i64 = 66 |
| 48 | const NX_OPQ_RECORD_BYTES: i64 = 129 |
| 49 | const NX_OPQ_REC_OFF_CPUB: i64 = 0 |
| 50 | const NX_OPQ_REC_OFF_MASKKEY: i64 = 33 |
| 51 | const NX_OPQ_REC_OFF_ENV: i64 = 65 |
functions
| 86 | func nx_opq_blind_det(input: *u8, input_n: i64, blind_32: *u8, out_blinded_33: *u8) -> i64 |
| 113 | func nx_opq_derive_oprf_key( |
| 140 | func nx_opaque_create_registration_request_det( |
| 151 | func nx_opaque_create_registration_request( |
| 166 | func nx_opaque_create_registration_response( |
| 188 | func _opq_rwd_from_response( |
| 206 | func nx_opaque_finalize_registration_det( |
| 237 | func nx_opaque_finalize_registration( |
| 256 | func nx_opaque_generate_ke1_det( |
| 281 | func nx_opaque_generate_ke1( |
| 298 | func nx_opaque_generate_ke2_det( |
| 411 | func nx_opaque_generate_ke2( called by 2: _ma_verify_credentialok_run_random_roundtrip calls 3: sys_mmapnx_csprng_fillnx_opaque_generate_ke2_det |
| 435 | func nx_opaque_generate_ke3( |
| 531 | func nx_opaque_server_finish(ke3_32: *u8, expected_client_mac_32: *u8) -> i64 |