code wiki / (root) / session_id.nx

session_id.nx

buildroot/runtime/session_id.nx

2922 B105 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind orphan librarytopic session
docsdependenciesstructsconstsfunctions

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

syscalls.nx rand.nx session_id.nx

imports: syscalls.nxrand.nx

imported by: nobody (leaf or entry point)

structs

none

consts

25const SESSION_ID_LEN: i64 = 32

functions

28func si_map(v: i64) -> i64 {
37func si_is_valid_char(b: i64) -> i64 {
53func session_id_with_len(out: *u8, n: i64) -> i64 {
64func session_id_new(out: *u8) -> i64 {
70func session_id_valid(id: *u8, n: i64) -> i64 {
81func main() -> i64 {