mega updates to things

This commit is contained in:
user
2026-02-28 15:54:51 +02:00
parent 57fbb4ab00
commit 4d107c8cab
8 changed files with 82 additions and 76 deletions

View File

@@ -22,6 +22,6 @@
"drizzle-kit": "^0.28.0"
},
"peerDependencies": {
"typescript": "^5.0.0"
"typescript": "^5.9.3"
}
}

View File

@@ -6,7 +6,7 @@
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
"typescript": "^5.9.3"
},
"dependencies": {
"@axiomhq/winston": "^1.3.1",

View File

@@ -4,10 +4,10 @@ import { hashString, verifyHash } from "@/core/hash.utils";
import { twoFactor, twofaSessions } from "@pkg/db/schema";
import { TwoFactor, type TwoFaSession } from "./data";
import { and, Database, eq, gt, lt } from "@pkg/db";
import { generateSecret, verify } from "otplib";
import { settings } from "@core/settings";
import type { Err } from "@pkg/result";
import { twofaErrors } from "./errors";
import { authenticator } from "otplib";
import { logger } from "@pkg/logger";
import { Redis } from "@pkg/redis";
import { nanoid } from "nanoid";
@@ -30,7 +30,7 @@ export class TwofaRepository {
) {}
checkTotp(secret: string, code: string) {
const checked = authenticator.verify({ secret, token: code });
const checked = verify({ secret, token: code });
logger.debug("TOTP check result", { checked });
return checked;
}
@@ -103,7 +103,7 @@ export class TwofaRepository {
return ResultAsync.fromSafePromise(
(async () => {
const secret = authenticator.generateSecret();
const secret = generateSecret();
const payload = {
secret,
lastUsedCode: "",
@@ -546,7 +546,7 @@ export class TwofaRepository {
() =>
twofaErrors.dbError(fctx, "Failed to cleanup expired sessions"),
).map((result) => {
const count = result.rowCount || 0;
const count = result.length || 0;
logger.info("Expired sessions cleaned up", { ...fctx, count });
return count;
});

View File

@@ -20,7 +20,7 @@
"mailparser": "^3.7.3",
"nanoid": "^5.1.5",
"neverthrow": "^8.2.0",
"otplib": "^12.0.1",
"otplib": "^13.3.0",
"pdfkit": "^0.17.1",
"tmp": "^0.2.3",
"uuid": "^11.1.0",
@@ -34,6 +34,6 @@
"@types/uuid": "^10.0.0"
},
"peerDependencies": {
"typescript": "^5.0.0"
"typescript": "^5.9.3"
}
}

View File

@@ -1,15 +1,15 @@
{
"name": "@pkg/redis",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
},
"dependencies": {
"ioredis": "^5.6.1"
}
"name": "@pkg/redis",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.9.3"
},
"dependencies": {
"ioredis": "^5.6.1"
}
}

View File

@@ -1,9 +1,9 @@
{
"name": "@pkg/result",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
"name": "@pkg/result",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.9.3"
}
}

View File

@@ -6,7 +6,7 @@
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
"typescript": "^5.9.3"
},
"dependencies": {
"dotenv": "^17.2.3",