feat(acls): refactor & acl descriptions

This commit is contained in:
DecDuck
2025-02-07 17:26:23 +11:00
parent d4dd259b5f
commit ce8887528f
23 changed files with 291 additions and 253 deletions

View File

@ -1,6 +1,7 @@
import path from "path";
import fs from "fs";
import droplet from "@drop/droplet";
import { CertificateStore } from "./ca-store";
import { CertificateStore, fsCertificateStore } from "./ca-store";
export type CertificateBundle = {
priv: string;
@ -72,4 +73,4 @@ export class CertificateAuthority {
async blacklistClient(clientId: string) {
await this.certificateStore.blacklistCertificate(clientId);
}
}
}

View File

@ -2,6 +2,7 @@ import { Client, User } from "@prisma/client";
import { EventHandlerRequest, H3Event } from "h3";
import droplet from "@drop/droplet";
import prisma from "../db/database";
import { useCertificateAuthority } from "~/server/plugins/ca";
export type EventHandlerFunction<T> = (
h3: H3Event<EventHandlerRequest>,
@ -47,8 +48,8 @@ export function defineClientEventHandler<T>(handler: EventHandlerFunction<T>) {
});
}
const ca = h3.context.ca;
const certBundle = await ca.fetchClientCertificate(clientId);
const certificateAuthority = useCertificateAuthority();
const certBundle = await certificateAuthority.fetchClientCertificate(clientId);
// This does the blacklist check already
if (!certBundle)
throw createError({