Skip to content

Commit

Permalink
fix: Use bcrypt (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityachoudhari26 authored Aug 31, 2024
1 parent 02e3834 commit 4dbe83f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
3 changes: 2 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@octokit/types": "^13.5.0",
"@t3-oss/env-core": "^0.10.1",
"@trpc/server": "11.0.0-rc.364",
"argon2": "^0.41.0",
"bcryptjs": "^2.4.3",
"bullmq": "^5.12.10",
"date-fns": "^3.6.0",
"google-auth-library": "^9.13.0",
Expand All @@ -47,6 +47,7 @@
"@ctrlplane/prettier-config": "workspace:*",
"@ctrlplane/tsconfig": "workspace:*",
"@octokit/types": "^13.5.0",
"@types/bcryptjs": "^2.4.6",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.5",
"@types/ms": "^0.7.34",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/router/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import argon2 from "argon2";
import { hash } from "bcryptjs";
import { omit } from "lodash";
import { v4 } from "uuid";
import { z } from "zod";
Expand Down Expand Up @@ -52,7 +52,7 @@ export const userRouter = createTRPCRouter({
.input(z.object({ name: z.string() }))
.mutation(async ({ ctx, input }) => {
const key = v4();
const keyHash = await argon2.hash(key);
const keyHash = await hash(key, 10);
const apiKey = await ctx.db
.insert(userApiKey)
.values({
Expand Down
47 changes: 16 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4dbe83f

Please sign in to comment.