code wiki / hub / nx_opaque_pake.nx

nx_opaque_pake.nx

buildroot/runtime/hub/nx_opaque_pake.nx

23336 B538 linesdepth 13pulls 31 transitivereach 86 importersview sourcekind librarytopic opaque
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_u256.nx nx_csprng.nx sha256.nx nx_hmac.nx nx_hkdf.nx nx_p256_point.nx nx_p256_scalar_mul.nx nx_voprf.nx nx_voprf_finalize.nx nx_opaque_pake.nx nx_modern_auth_flow.nx nx_opaque_rfc_kat.nx

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

57struct NxOpqClientCfg
71struct NxOpqServerCfg

consts

46const NX_OPQ_REG_REQUEST_BYTES: i64 = 33
47const NX_OPQ_REG_RESPONSE_BYTES: i64 = 66
48const NX_OPQ_RECORD_BYTES: i64 = 129
49const NX_OPQ_REC_OFF_CPUB: i64 = 0
50const NX_OPQ_REC_OFF_MASKKEY: i64 = 33
51const NX_OPQ_REC_OFF_ENV: i64 = 65

functions

86func nx_opq_blind_det(input: *u8, input_n: i64, blind_32: *u8, out_blinded_33: *u8) -> i64
113func nx_opq_derive_oprf_key(
140func nx_opaque_create_registration_request_det(
called by 1: ok_run_vector calls 1: nx_opq_blind_det
151func nx_opaque_create_registration_request(
166func nx_opaque_create_registration_response(
188func _opq_rwd_from_response(
206func nx_opaque_finalize_registration_det(
237func nx_opaque_finalize_registration(
256func nx_opaque_generate_ke1_det(
281func nx_opaque_generate_ke1(
298func nx_opaque_generate_ke2_det(
411func nx_opaque_generate_ke2(
435func nx_opaque_generate_ke3(
531func nx_opaque_server_finish(ke3_32: *u8, expected_client_mac_32: *u8) -> i64