Expand description
Local accounts (ADR-0021 § 2): the sessions login opens and the password hashes it checks.
Their tables are crate::MIGRACION_USUARIOS and crate::MIGRACION_AUTH, which
puerto new --auth local writes into the project.
A session is an opaque token — 32 random bytes, base64url — and its row keeps only the token’s
SHA-256. Revoking is a DELETE; there is no signing key to keep or rotate, and a lookup per
request is the cost.
Structs§
- Credenciales
Postgres credenciales: one password hash per user.- Sesiones
Postgres sesiones: anAlmacenSesionesforloginandlogout, and theAutenticadorof a local project — the presented token’s hash, joined with its user. The roles are theusuarios.rolescolumn (make auth/conceder).
Constants§
- TTL_
SESION_ POR_ DEFECTO - How long a session lasts when
AUTH_SESSION_TTLis not set.
Functions§
- generar_
token - A new session token: 256 random bits, base64url without padding (43 characters).
- hash_
token - What a session row keeps of its token.
- parsear_
ttl <n>d,<n>hor<n>m,n> 0.- ttl_
sesion_ from_ env AUTH_SESSION_TTL—30d,12h,90m— orTTL_SESION_POR_DEFECTOwhen it is not set. A set but invalid value is an error: a startup error, not a silent default.