group conversations with models and local files
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix passphrase login: use ESM imports for node:crypto

Used `require('node:crypto')` inline for timingSafeEqual + createHash,
but the server is ESM (package.json type=module) — `require` isn't
defined in that scope so the finish call threw "require is not defined"
and the browser surfaced it as the login error. Hoist the imports to
the top of the file.

dietrich ayala (May 26, 2026, 3:04 PM +0200) 9eb9b62a 4b308bb9

+1 -4
+1 -4
server/auth.ts
··· 10 10 // - Otherwise registration requires a valid invite token. 11 11 // - Authentication requires the email to match an existing user. 12 12 13 - import { randomBytes, randomUUID } from 'node:crypto' 13 + import { createHash, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto' 14 14 import { 15 15 generateRegistrationOptions, 16 16 verifyRegistrationResponse, ··· 446 446 // HMAC(SHA256, deployment-secret, email) would be ideal; for the 447 447 // prototype just deterministically hash the email so the same 448 448 // unknown email gets the same dummy reply. 449 - // (sha256 is fine; we're not protecting anything with this.) 450 - const { createHash } = require('node:crypto') as typeof import('node:crypto') 451 449 return createHash('sha256').update(email).digest().subarray(0, 16) 452 450 } 453 451 ··· 490 488 if (supplied.length !== expected.length) { 491 489 throw new Error('invalid passphrase') 492 490 } 493 - const { timingSafeEqual } = require('node:crypto') as typeof import('node:crypto') 494 491 if (!timingSafeEqual(supplied, expected)) { 495 492 throw new Error('invalid passphrase') 496 493 }