Skip to content

Commit ba7438a

Browse files
authored
docs: update password hashing parameters (#1560)
1 parent 30b2264 commit ba7438a

File tree

8 files changed

+42
-42
lines changed

8 files changed

+42
-42
lines changed

docs/pages/guides/email-and-password/basics.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ app.post("/signup", async (request: Request) => {
8181

8282
const passwordHash = await hash(password, {
8383
// recommended minimum parameters
84-
memorySize: 19456,
85-
iterations: 2,
86-
tagLength: 32,
84+
memoryCost: 19456,
85+
timeCost: 2,
86+
outputLen: 32,
8787
parallelism: 1
8888
});
8989
const userId = generateIdFromEntropySize(10); // 16 characters long
@@ -172,9 +172,9 @@ app.post("/login", async (request: Request) => {
172172
}
173173

174174
const validPassword = await verify(user.password_hash, password, {
175-
memorySize: 19456,
176-
iterations: 2,
177-
tagLength: 32,
175+
memoryCost: 19456,
176+
timeCost: 2,
177+
outputLen: 32,
178178
parallelism: 1
179179
});
180180
if (!validPassword) {

docs/pages/guides/email-and-password/password-reset.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ app.post("/reset-password/:token", async () => {
119119
await lucia.invalidateUserSessions(token.user_id);
120120
const passwordHash = await hash(password, {
121121
// recommended minimum parameters
122-
memorySize: 19456,
123-
iterations: 2,
124-
tagLength: 32,
122+
memoryCost: 19456,
123+
timeCost: 2,
124+
outputLen: 32,
125125
parallelism: 1
126126
});
127127
await db.table("user").where("id", "=", token.user_id).update({

docs/pages/tutorials/username-and-password/astro.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export async function POST(context: APIContext): Promise<Response> {
106106
const userId = generateIdFromEntropySize(10); // 16 characters long
107107
const passwordHash = await hash(password, {
108108
// recommended minimum parameters
109-
memorySize: 19456,
110-
iterations: 2,
111-
tagLength: 32,
109+
memoryCost: 19456,
110+
timeCost: 2,
111+
outputLen: 32,
112112
parallelism: 1
113113
});
114114

@@ -205,9 +205,9 @@ export async function POST(context: APIContext): Promise<Response> {
205205
}
206206

207207
const validPassword = await verify(existingUser.password, password, {
208-
memorySize: 19456,
209-
iterations: 2,
210-
tagLength: 32,
208+
memoryCost: 19456,
209+
timeCost: 2,
210+
outputLen: 32,
211211
parallelism: 1
212212
});
213213
if (!validPassword) {

docs/pages/tutorials/username-and-password/nextjs-app.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ async function signup(_: any, formData: FormData): Promise<ActionResult> {
118118

119119
const passwordHash = await hash(password, {
120120
// recommended minimum parameters
121-
memorySize: 19456,
122-
iterations: 2,
123-
tagLength: 32,
121+
memoryCost: 19456,
122+
timeCost: 2,
123+
outputLen: 32,
124124
parallelism: 1
125125
});
126126
const userId = generateIdFromEntropySize(10); // 16 characters long
@@ -243,9 +243,9 @@ async function login(_: any, formData: FormData): Promise<ActionResult> {
243243
}
244244

245245
const validPassword = await verify(existingUser.password, password, {
246-
memorySize: 19456,
247-
iterations: 2,
248-
tagLength: 32,
246+
memoryCost: 19456,
247+
timeCost: 2,
248+
outputLen: 32,
249249
parallelism: 1
250250
});
251251
if (!validPassword) {

docs/pages/tutorials/username-and-password/nextjs-pages.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
135135

136136
const passwordHash = await hash(password, {
137137
// recommended minimum parameters
138-
memorySize: 19456,
139-
iterations: 2,
140-
tagLength: 32,
138+
memoryCost: 19456,
139+
timeCost: 2,
140+
outputLen: 32,
141141
parallelism: 1
142142
});
143143
const userId = generateIdFromEntropySize(10); // 16 characters long
@@ -266,9 +266,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
266266
}
267267

268268
const validPassword = await verify(existingUser.password, password, {
269-
memorySize: 19456,
270-
iterations: 2,
271-
tagLength: 32,
269+
memoryCost: 19456,
270+
timeCost: 2,
271+
outputLen: 32,
272272
parallelism: 1
273273
});
274274
if (!validPassword) {

docs/pages/tutorials/username-and-password/nuxt.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ export default eventHandler(async (event) => {
115115

116116
const passwordHash = await hash(password, {
117117
// recommended minimum parameters
118-
memorySize: 19456,
119-
iterations: 2,
120-
tagLength: 32,
118+
memoryCost: 19456,
119+
timeCost: 2,
120+
outputLen: 32,
121121
parallelism: 1
122122
});
123123
const userId = generateIdFromEntropySize(10); // 16 characters long
@@ -222,9 +222,9 @@ export default eventHandler(async (event) => {
222222
}
223223

224224
const validPassword = await verify(existingUser.password, password, {
225-
memorySize: 19456,
226-
iterations: 2,
227-
tagLength: 32,
225+
memoryCost: 19456,
226+
timeCost: 2,
227+
outputLen: 32,
228228
parallelism: 1
229229
});
230230
if (!validPassword) {

docs/pages/tutorials/username-and-password/sveltekit.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ export const actions: Actions = {
111111
const userId = generateIdFromEntropySize(10); // 16 characters long
112112
const passwordHash = await hash(password, {
113113
// recommended minimum parameters
114-
memorySize: 19456,
115-
iterations: 2,
116-
tagLength: 32,
114+
memoryCost: 19456,
115+
timeCost: 2,
116+
outputLen: 32,
117117
parallelism: 1
118118
});
119119

@@ -217,9 +217,9 @@ export const actions: Actions = {
217217
}
218218

219219
const validPassword = await verify(existingUser.password_hash, password, {
220-
memorySize: 19456,
221-
iterations: 2,
222-
tagLength: 32,
220+
memoryCost: 19456,
221+
timeCost: 2,
222+
outputLen: 32,
223223
parallelism: 1
224224
});
225225
if (!validPassword) {

docs/pages/upgrade-v3/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ For a simple password-based auth, the password can just be stored in the user ta
1717
```ts
1818
const passwordHash = await hash(password, {
1919
// recommended minimum parameters
20-
memorySize: 19456,
21-
iterations: 2,
22-
tagLength: 32,
20+
memoryCost: 19456,
21+
timeCost: 2,
22+
outputLen: 32,
2323
parallelism: 1
2424
});
2525
const userId = generateIdFromEntropySize(10); // 16 characters long

0 commit comments

Comments
 (0)