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",

100
pnpm-lock.yaml generated
View File

@@ -187,7 +187,7 @@ importers:
specifier: ^3.4.8
version: 3.4.8
typescript:
specifier: ^5.0.0
specifier: ^5.9.3
version: 5.9.3
devDependencies:
'@types/bun':
@@ -212,7 +212,7 @@ importers:
specifier: workspace:*
version: link:../settings
typescript:
specifier: ^5.0.0
specifier: ^5.9.3
version: 5.9.3
winston:
specifier: ^3.17.0
@@ -276,8 +276,8 @@ importers:
specifier: ^8.2.0
version: 8.2.0
otplib:
specifier: ^12.0.1
version: 12.0.1
specifier: ^13.3.0
version: 13.3.0
pdfkit:
specifier: ^0.17.1
version: 0.17.2
@@ -285,7 +285,7 @@ importers:
specifier: ^0.2.3
version: 0.2.5
typescript:
specifier: ^5.0.0
specifier: ^5.9.3
version: 5.9.3
uuid:
specifier: ^11.1.0
@@ -316,7 +316,7 @@ importers:
specifier: ^5.6.1
version: 5.10.0
typescript:
specifier: ^5
specifier: ^5.9.3
version: 5.9.3
devDependencies:
'@types/bun':
@@ -326,7 +326,7 @@ importers:
packages/result:
dependencies:
typescript:
specifier: ^5.0.0
specifier: ^5.9.3
version: 5.9.3
devDependencies:
'@types/bun':
@@ -339,7 +339,7 @@ importers:
specifier: ^17.2.3
version: 17.3.1
typescript:
specifier: ^5.0.0
specifier: ^5.9.3
version: 5.9.3
valibot:
specifier: ^1.2.0
@@ -924,23 +924,23 @@ packages:
resolution: {integrity: sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==}
engines: {node: '>= 20.19.0'}
'@otplib/core@12.0.1':
resolution: {integrity: sha512-4sGntwbA/AC+SbPhbsziRiD+jNDdIzsZ3JUyfZwjtKyc/wufl1pnSIaG4Uqx8ymPagujub0o92kgBnB89cuAMA==}
'@otplib/core@13.3.0':
resolution: {integrity: sha512-pnQDOuCmFVeF/XnboJq9TOJgLoo2idNPJKMymOF8vGqJJ+ReKRYM9bUGjNPRWC0tHjMwu1TXbnzyBp494JgRag==}
'@otplib/plugin-crypto@12.0.1':
resolution: {integrity: sha512-qPuhN3QrT7ZZLcLCyKOSNhuijUi9G5guMRVrxq63r9YNOxxQjPm59gVxLM+7xGnHnM6cimY57tuKsjK7y9LM1g==}
deprecated: Please upgrade to v13 of otplib. Refer to otplib docs for migration paths
'@otplib/hotp@13.3.0':
resolution: {integrity: sha512-XJMZGz2bg4QJwK7ulvl1GUI2VMn/flaIk/E/BTKAejHsX2kUtPF1bRhlZ2+elq8uU5Fs9Z9FHcQK2CPZNQbbUQ==}
'@otplib/plugin-thirty-two@12.0.1':
resolution: {integrity: sha512-MtT+uqRso909UkbrrYpJ6XFjj9D+x2Py7KjTO9JDPhL0bJUYVu5kFP4TFZW4NFAywrAtFRxOVY261u0qwb93gA==}
deprecated: Please upgrade to v13 of otplib. Refer to otplib docs for migration paths
'@otplib/plugin-base32-scure@13.3.0':
resolution: {integrity: sha512-/jYbL5S6GB0Ie3XGEWtLIr9s5ZICl/BfmNL7+8/W7usZaUU4GiyLd2S+JGsNCslPyqNekSudD864nDAvRI0s8w==}
'@otplib/preset-default@12.0.1':
resolution: {integrity: sha512-xf1v9oOJRyXfluBhMdpOkr+bsE+Irt+0D5uHtvg6x1eosfmHCsCC6ej/m7FXiWqdo0+ZUI6xSKDhJwc8yfiOPQ==}
deprecated: Please upgrade to v13 of otplib. Refer to otplib docs for migration paths
'@otplib/plugin-crypto-noble@13.3.0':
resolution: {integrity: sha512-wmV+jBVncepgwv99G7Plrdzd0tHfbpXk2U+OD7MO7DzpDqOYEgOPi+IIneksJSTL8QvWdfi+uQEuhnER4fKouA==}
'@otplib/preset-v11@12.0.1':
resolution: {integrity: sha512-9hSetMI7ECqbFiKICrNa4w70deTUfArtwXykPUvSHWOdzOlfa9ajglu7mNCntlvxycTiOAXkQGwjQCzzDEMRMg==}
'@otplib/totp@13.3.0':
resolution: {integrity: sha512-XfjGNoN8d9S3Ove2j7AwkVV7+QDFsV7Lm7YwSiezNaHffkWtJ60aJYpmf+01dARdPST71U2ptueMsRJso4sq4A==}
'@otplib/uri@13.3.0':
resolution: {integrity: sha512-3oh6nBXy+cm3UX9cxEAGZiDrfxHU2gfelYFV+XNCx+8dq39VaQVymwlU2yjPZiMAi/3agaUeEftf2RwM5F+Cyg==}
'@phc/format@1.0.0':
resolution: {integrity: sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==}
@@ -1129,6 +1129,9 @@ packages:
cpu: [x64]
os: [win32]
'@scure/base@2.0.0':
resolution: {integrity: sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w==}
'@selderee/plugin-htmlparser2@0.11.0':
resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}
@@ -2397,8 +2400,8 @@ packages:
one-time@1.0.0:
resolution: {integrity: sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==}
otplib@12.0.1:
resolution: {integrity: sha512-xDGvUOQjop7RDgxTQ+o4pOol0/3xSZzawTiPKRrHnQWAy0WjhNs/5HdIDJCrqC4MBynmjXgULc6YfioaxZeFgg==}
otplib@13.3.0:
resolution: {integrity: sha512-VYMKyyDG8yt2q+z58sz54/EIyTh7+tyMrjeemR44iVh5+dkKtIs57irTqxjH+IkAL1uMmG1JIFhG5CxTpqdU5g==}
p-limit@2.3.0:
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
@@ -2862,10 +2865,6 @@ packages:
text-hex@1.0.0:
resolution: {integrity: sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==}
thirty-two@1.0.2:
resolution: {integrity: sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==}
engines: {node: '>=0.2.6'}
thread-stream@4.0.0:
resolution: {integrity: sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==}
engines: {node: '>=20'}
@@ -3568,28 +3567,32 @@ snapshots:
'@noble/hashes@2.0.1': {}
'@otplib/core@12.0.1': {}
'@otplib/core@13.3.0': {}
'@otplib/plugin-crypto@12.0.1':
'@otplib/hotp@13.3.0':
dependencies:
'@otplib/core': 12.0.1
'@otplib/core': 13.3.0
'@otplib/uri': 13.3.0
'@otplib/plugin-thirty-two@12.0.1':
'@otplib/plugin-base32-scure@13.3.0':
dependencies:
'@otplib/core': 12.0.1
thirty-two: 1.0.2
'@otplib/core': 13.3.0
'@scure/base': 2.0.0
'@otplib/preset-default@12.0.1':
'@otplib/plugin-crypto-noble@13.3.0':
dependencies:
'@otplib/core': 12.0.1
'@otplib/plugin-crypto': 12.0.1
'@otplib/plugin-thirty-two': 12.0.1
'@noble/hashes': 2.0.1
'@otplib/core': 13.3.0
'@otplib/preset-v11@12.0.1':
'@otplib/totp@13.3.0':
dependencies:
'@otplib/core': 12.0.1
'@otplib/plugin-crypto': 12.0.1
'@otplib/plugin-thirty-two': 12.0.1
'@otplib/core': 13.3.0
'@otplib/hotp': 13.3.0
'@otplib/uri': 13.3.0
'@otplib/uri@13.3.0':
dependencies:
'@otplib/core': 13.3.0
'@phc/format@1.0.0': {}
@@ -3711,6 +3714,8 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.59.0':
optional: true
'@scure/base@2.0.0': {}
'@selderee/plugin-htmlparser2@0.11.0':
dependencies:
domhandler: 5.0.3
@@ -4867,11 +4872,14 @@ snapshots:
dependencies:
fn.name: 1.1.0
otplib@12.0.1:
otplib@13.3.0:
dependencies:
'@otplib/core': 12.0.1
'@otplib/preset-default': 12.0.1
'@otplib/preset-v11': 12.0.1
'@otplib/core': 13.3.0
'@otplib/hotp': 13.3.0
'@otplib/plugin-base32-scure': 13.3.0
'@otplib/plugin-crypto-noble': 13.3.0
'@otplib/totp': 13.3.0
'@otplib/uri': 13.3.0
p-limit@2.3.0:
dependencies:
@@ -5323,8 +5331,6 @@ snapshots:
text-hex@1.0.0: {}
thirty-two@1.0.2: {}
thread-stream@4.0.0:
dependencies:
real-require: 0.2.0