No matching definitions.

session/id

src/session/id.tur

cryptographically-random session ID generation.

Since: v0.1.0

defn

session-id-new

(session-id-new :)

generate a fresh 64-char hex session ID.

String -- a newly allocated, owned 64-character lowercase hex string. The ownership is in the type: release it (or hand it to a consumer that takes ownership) when done. Session IDs are long-lived (store key, cookie value, per-request state), so owning is the right default -- the previous `cstr` return advertised a bare pointer with a "caller frees" comment. On the (vanishingly unlikely) event that every randomness source fails, the function aborts rather than emit a predictable ID -- a guessable session ID is a security hole, so failing closed is the safe choice.

(let [id (session-id-new)] ...)  ;; => owned String "9f1c...". 64 hex chars

Since: v0.1.0 (owned String return since v0.3.0)

Internal definitions
__session-id-cstr-- generate a fresh 64-char hex ID as a malloc'd cstr.