a LOTTTA more migration hoopla shii

This commit is contained in:
user
2026-02-28 16:20:47 +02:00
parent 4d107c8cab
commit 2c8cd1fd15
18 changed files with 208 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
import { errAsync, okAsync, ResultAsync } from "neverthrow";
import { FlowExecCtx } from "@core/flow.execution.context";
import { UserRepository } from "@domains/user/repository";
import { getRedisInstance, Redis } from "@pkg/redis";
import { getRedisInstance, Redis } from "@pkg/keystore";
import { TwofaRepository } from "./repository";
import { auth } from "../auth/config.base";
import type { TwoFaSession } from "./data";
@@ -17,6 +17,7 @@ export class TwofaController {
private twofaRepo: TwofaRepository,
private userRepo: UserRepository,
private store: Redis,
private secret: string,
) {}
checkTotp(secret: string, code: string) {
@@ -42,7 +43,7 @@ export class TwofaController {
.andThen((enabled) =>
enabled
? errAsync(twofaErrors.alreadyEnabled(fctx))
: this.twofaRepo.setup(fctx, user.id),
: this.twofaRepo.setup(fctx, user.id, this.secret),
)
.map((secret) => {
const appName = settings.appName;
@@ -345,5 +346,6 @@ export function getTwofaController() {
new TwofaRepository(db, _redis),
new UserRepository(db),
_redis,
settings.twoFaSecret,
);
}