Skip to content

Commit 874e188

Browse files
committed
Fix scrypt memory error by explicitly setting maxmem to 2× estimated usage (~64 MiB), bypassing Node’s 32 MiB default limit.
1 parent 0d03e30 commit 874e188

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

app/utils/auth.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ async function generateKey(
319319
N: SCRYPT_PARAMS.N,
320320
r: SCRYPT_PARAMS.r,
321321
p: SCRYPT_PARAMS.p,
322+
maxmem: 128 * SCRYPT_PARAMS.N * SCRYPT_PARAMS.r * 2,
322323
},
323324
(err, key) => {
324325
if (err) reject(err)

tests/db-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function createPassword(password: string = faker.internet.password()) {
3535
N: 2 ** 14,
3636
r: 16,
3737
p: 1,
38+
maxmem: 128 * 2 ** 14 * 16 * 2,
3839
})
3940
return {
4041
hash: `${salt}:${hash.toString('hex')}`,

0 commit comments

Comments
 (0)