From ba7438ad3f4bf0c4afa0b349cb453b17968db0bb Mon Sep 17 00:00:00 2001 From: Thomas Marrec Date: Wed, 1 May 2024 20:44:49 +1000 Subject: [PATCH] docs: update password hashing parameters (#1560) --- docs/pages/guides/email-and-password/basics.md | 12 ++++++------ .../guides/email-and-password/password-reset.md | 6 +++--- docs/pages/tutorials/username-and-password/astro.md | 12 ++++++------ .../tutorials/username-and-password/nextjs-app.md | 12 ++++++------ .../tutorials/username-and-password/nextjs-pages.md | 12 ++++++------ docs/pages/tutorials/username-and-password/nuxt.md | 12 ++++++------ .../tutorials/username-and-password/sveltekit.md | 12 ++++++------ docs/pages/upgrade-v3/index.md | 6 +++--- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/pages/guides/email-and-password/basics.md b/docs/pages/guides/email-and-password/basics.md index 480ab9d2a..fd4f8fd88 100644 --- a/docs/pages/guides/email-and-password/basics.md +++ b/docs/pages/guides/email-and-password/basics.md @@ -81,9 +81,9 @@ app.post("/signup", async (request: Request) => { const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); const userId = generateIdFromEntropySize(10); // 16 characters long @@ -172,9 +172,9 @@ app.post("/login", async (request: Request) => { } const validPassword = await verify(user.password_hash, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/guides/email-and-password/password-reset.md b/docs/pages/guides/email-and-password/password-reset.md index c90984506..7301cc99e 100644 --- a/docs/pages/guides/email-and-password/password-reset.md +++ b/docs/pages/guides/email-and-password/password-reset.md @@ -119,9 +119,9 @@ app.post("/reset-password/:token", async () => { await lucia.invalidateUserSessions(token.user_id); const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); await db.table("user").where("id", "=", token.user_id).update({ diff --git a/docs/pages/tutorials/username-and-password/astro.md b/docs/pages/tutorials/username-and-password/astro.md index 18cc230f7..2e71f5471 100644 --- a/docs/pages/tutorials/username-and-password/astro.md +++ b/docs/pages/tutorials/username-and-password/astro.md @@ -106,9 +106,9 @@ export async function POST(context: APIContext): Promise { const userId = generateIdFromEntropySize(10); // 16 characters long const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); @@ -205,9 +205,9 @@ export async function POST(context: APIContext): Promise { } const validPassword = await verify(existingUser.password, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/tutorials/username-and-password/nextjs-app.md b/docs/pages/tutorials/username-and-password/nextjs-app.md index bfd99d243..b28e009a5 100644 --- a/docs/pages/tutorials/username-and-password/nextjs-app.md +++ b/docs/pages/tutorials/username-and-password/nextjs-app.md @@ -118,9 +118,9 @@ async function signup(_: any, formData: FormData): Promise { const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); const userId = generateIdFromEntropySize(10); // 16 characters long @@ -243,9 +243,9 @@ async function login(_: any, formData: FormData): Promise { } const validPassword = await verify(existingUser.password, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/tutorials/username-and-password/nextjs-pages.md b/docs/pages/tutorials/username-and-password/nextjs-pages.md index ad1694f24..69a01ec03 100644 --- a/docs/pages/tutorials/username-and-password/nextjs-pages.md +++ b/docs/pages/tutorials/username-and-password/nextjs-pages.md @@ -135,9 +135,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); const userId = generateIdFromEntropySize(10); // 16 characters long @@ -266,9 +266,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } const validPassword = await verify(existingUser.password, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/tutorials/username-and-password/nuxt.md b/docs/pages/tutorials/username-and-password/nuxt.md index 270e50e8d..395a7418f 100644 --- a/docs/pages/tutorials/username-and-password/nuxt.md +++ b/docs/pages/tutorials/username-and-password/nuxt.md @@ -115,9 +115,9 @@ export default eventHandler(async (event) => { const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); const userId = generateIdFromEntropySize(10); // 16 characters long @@ -222,9 +222,9 @@ export default eventHandler(async (event) => { } const validPassword = await verify(existingUser.password, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/tutorials/username-and-password/sveltekit.md b/docs/pages/tutorials/username-and-password/sveltekit.md index 0f835fba6..ba89aaa44 100644 --- a/docs/pages/tutorials/username-and-password/sveltekit.md +++ b/docs/pages/tutorials/username-and-password/sveltekit.md @@ -111,9 +111,9 @@ export const actions: Actions = { const userId = generateIdFromEntropySize(10); // 16 characters long const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); @@ -217,9 +217,9 @@ export const actions: Actions = { } const validPassword = await verify(existingUser.password_hash, password, { - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); if (!validPassword) { diff --git a/docs/pages/upgrade-v3/index.md b/docs/pages/upgrade-v3/index.md index a1d464d22..090757c3c 100644 --- a/docs/pages/upgrade-v3/index.md +++ b/docs/pages/upgrade-v3/index.md @@ -17,9 +17,9 @@ For a simple password-based auth, the password can just be stored in the user ta ```ts const passwordHash = await hash(password, { // recommended minimum parameters - memorySize: 19456, - iterations: 2, - tagLength: 32, + memoryCost: 19456, + timeCost: 2, + outputLen: 32, parallelism: 1 }); const userId = generateIdFromEntropySize(10); // 16 characters long