& so it begins

This commit is contained in:
user
2026-02-28 14:50:04 +02:00
commit f00381f2b6
536 changed files with 26294 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
import * as v from "valibot";
export const startVerificationSchema = v.object({
userId: v.string(),
sessionId: v.string(),
});
export const verifyCodeSchema = v.object({
verificationToken: v.string(),
code: v.string(),
});
export const enable2FACodeSchema = v.object({
code: v.string(),
});
export const disable2FASchema = v.object({
code: v.string(),
});
export const twoFactorSchema = v.object({
id: v.string(),
secret: v.string(),
backupCodes: v.array(v.string()),
userId: v.string(),
createdAt: v.date(),
updatedAt: v.date(),
});
export type TwoFactor = v.InferOutput<typeof twoFactorSchema>;
export type TwoFaSessionStatus = "pending" | "verified" | "failed" | "expired";
export const twoFaSessionSchema = v.object({
id: v.string(),
userId: v.string(),
sessionId: v.string(),
verificationToken: v.string(),
codeUsed: v.optional(v.string()),
status: v.picklist(["pending", "verified", "failed", "expired"]),
attempts: v.number(),
maxAttempts: v.number(),
verifiedAt: v.optional(v.date()),
expiresAt: v.date(),
createdAt: v.date(),
ipAddress: v.string(),
userAgent: v.string(),
});
export type TwoFaSession = v.InferOutput<typeof twoFaSessionSchema>;