mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 06:18:48 +00:00
21 lines
750 B
TypeScript
21 lines
750 B
TypeScript
import { json } from "@sveltejs/kit";
|
|
import { authorize } from "$lib/server/modules/auth";
|
|
import { masterKeyListResponse, type MasterKeyListResponse } from "$lib/server/schemas/mek";
|
|
import { getClientMekList } from "$lib/server/services/mek";
|
|
import type { RequestHandler } from "./$types";
|
|
|
|
export const GET: RequestHandler = async ({ cookies }) => {
|
|
const { userId, clientId } = await authorize(cookies, "activeClient");
|
|
const { encMeks } = await getClientMekList(userId, clientId);
|
|
return json(
|
|
masterKeyListResponse.parse({
|
|
meks: encMeks.map(({ version, state, encMek, encMekSig }) => ({
|
|
version,
|
|
state,
|
|
mek: encMek,
|
|
mekSig: encMekSig,
|
|
})),
|
|
} satisfies MasterKeyListResponse),
|
|
);
|
|
};
|