switch back to json

This commit is contained in:
Huskydog9988
2025-03-23 20:29:50 -04:00
parent c1272dc7a7
commit 690aa042df
4 changed files with 34 additions and 28 deletions

View File

@ -1,6 +1,10 @@
import { AuthMec, Invitation } from "@prisma/client";
import prisma from "~/server/internal/db/database";
import { createHashArgon2 } from "~/server/internal/security/simple";
import {
createHashArgon2,
simpleAuth,
SimpleAuthType,
} from "~/server/internal/security/simple";
import { v4 as uuidv4 } from "uuid";
import * as jdenticon from "jdenticon";
import objectHandler from "~/server/internal/objects";
@ -67,13 +71,16 @@ export default defineEventHandler(async (h3) => {
[`internal:read`, `${userId}:write`]
);
const hash = await createHashArgon2(user.password);
const creds: SimpleAuthType = {
version: "v1.0.0",
password: await createHashArgon2(user.password),
};
const [linkMec] = await prisma.$transaction([
prisma.linkedAuthMec.create({
data: {
mec: AuthMec.Simple,
credentials: {},
password: hash,
credentials: creds,
user: {
create: {
id: userId,