mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
22 lines
619 B
TypeScript
22 lines
619 B
TypeScript
import { CertificateAuthority } from "../internal/clients/ca";
|
|
import fs from "fs";
|
|
import {
|
|
dbCertificateStore,
|
|
fsCertificateStore,
|
|
} from "../internal/clients/ca-store";
|
|
|
|
let ca: CertificateAuthority | undefined;
|
|
|
|
export const useCertificateAuthority = () => {
|
|
if (!ca) throw new Error("CA not initialised");
|
|
return ca;
|
|
};
|
|
|
|
export default defineNitroPlugin(async (nitro) => {
|
|
// const basePath = process.env.CLIENT_CERTIFICATES ?? "./certs";
|
|
// fs.mkdirSync(basePath, { recursive: true });
|
|
// const store = fsCertificateStore(basePath);
|
|
|
|
ca = await CertificateAuthority.new(dbCertificateStore());
|
|
});
|