Files
HealthLog/src/lib/auth/argon2-params.mjs
T
Marc-André Bombeck fcf1366fea feat(insights): cycle ring replaces strain tile, tidy overview spacing, nav order, password-reset CLI
When cycle tracking is on, the cycle ring takes the Strain slot in the
health-scores strip rather than adding a sixth tile: the wellness strip
gains a hideStrain flag the insights page sets from the cycle gate, so
Strain is hidden for cycle accounts and shown unchanged for everyone else.

Fix the oversized vertical gap on the insights overview. The cycle summary
card set data-revealed on the same node that carried wellness-tile-rise,
but the entrance keyframe selector is a descendant combinator, so the
animation never matched and the card stayed at the rise rule's opacity: 0 —
invisible yet still occupying its box. Wrap the card so data-revealed sits
on an ancestor, restoring the entrance and removing the phantom gap.

Move the gated cycle entry directly after Medications (before Insights) in
the sidebar nav instead of appending it at the end, spliced by the
Medications index so the position survives a list reorder.

Add an operator-only password-reset CLI. It runs under plain node in the
production standalone image (which strips tsx) via the in-image pg and
@node-rs/argon2, reusing the app's Argon2id parameters through a shared
.mjs module so a reset hash matches one the app would mint. It matches a
single user by username or email, reads the new password without echoing,
never prints it back, and exits non-zero on zero or multiple matches.
Documented in docs/ops/password-reset.md.
2026-06-06 21:31:12 +02:00

24 lines
1009 B
JavaScript

/**
* The single source of truth for the Argon2id hashing parameters.
*
* Both the application's `hashPassword()` (src/lib/auth/password.ts) and the
* operator password-reset CLI (scripts/reset-password.mjs) import these exact
* options so a hash minted from the container matches one minted by the running
* app byte-for-byte. The CLI must run under plain `node` inside the production
* standalone image (which strips `tsx` and cannot import the TS client), so the
* shared params live in a plain `.mjs` module that both an ESM `node` process
* and the bundled TypeScript app can import.
*
* Do not fork these values. Changing them changes the verifier cost for every
* new hash; existing stored hashes carry their own parameters in the encoded
* string and keep verifying regardless.
*
* @type {{ memoryCost: number; timeCost: number; outputLen: number; parallelism: number }}
*/
export const ARGON2_HASH_OPTIONS = {
memoryCost: 19456,
timeCost: 2,
outputLen: 32,
parallelism: 1,
};