nx_session_id.nx
buildroot/runtime/nx_session_id.nx
about
session_id.nx -- cryptographically strong session identifiers.
Session IDs are the primary auth artefact after login. They
must be:
- Unpredictable (>= 128 bits entropy)
- URL + cookie-safe characters
- Fixed length (makes brute-force scans inherently bounded)
- Cheap to validate format before DB lookup
This module generates 32-char session IDs = 192 bits entropy
over the URL-safe alphabet (A-Z a-z 0-9 - _). Matches the
security profile of Django / Rails / Express session IDs.
Composes rand.nx.
Invariants:
SI1 Every char from the 64-char URL-safe alphabet.
SI2 Length fixed at 32 (customisable via session_id_with_len).
SI3 Format-validation helper so callers can reject malformed
IDs before DB lookup.
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_rand.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const SESSION_ID_LEN: i64 = 32 |
functions
| 34 | func si_map(v: i64) -> i64 called by 1: session_id_with_len |
| 43 | func si_is_valid_char(b: i64) -> i64 called by 1: session_id_valid |
| 59 | func session_id_with_len(out: *u8, n: i64) -> i64 |
| 70 | func session_id_new(out: *u8) -> i64 |
| 76 | func session_id_valid(id: *u8, n: i64) -> i64 |
| 87 | func main() -> i64 |