Skip to content

Commit 7b5b22b

Browse files
committed
hotfix: update oslojs codes
1 parent 6f8704e commit 7b5b22b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chadnext",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"private": true,
55
"scripts": {
66
"dev": "prisma generate && next dev",

src/actions/auth.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import { revalidatePath } from "next/cache";
44
import { redirect } from "next/navigation";
5-
import { alphabet, generateRandomString } from "oslo/crypto";
5+
import { generateRandomString, RandomReader } from "@oslojs/crypto/random";
66
import { deleteSessionTokenCookie } from "~/lib/server/cookies";
77
import prisma from "~/lib/server/prisma";
88
import { getCurrentSession, invalidateSession } from "~/lib/server/session";
99

10+
const digits = "0123456789";
11+
1012
export async function logout() {
1113
const { session } = await getCurrentSession();
1214
if (!session) {
@@ -30,7 +32,12 @@ export async function generateEmailVerificationCode(
3032
userId,
3133
},
3234
});
33-
const code = generateRandomString(6, alphabet("0-9"));
35+
const random: RandomReader = {
36+
read(bytes) {
37+
crypto.getRandomValues(bytes);
38+
},
39+
};
40+
const code = generateRandomString(random, digits, 6);
3441
await prisma.emailVerificationCode.create({
3542
data: {
3643
userId,

0 commit comments

Comments
 (0)