2024-10-07 22:35:54 +11:00
|
|
|
import { CertificateAuthority } from "../internal/clients/ca";
|
2025-04-15 20:04:45 -04:00
|
|
|
import { dbCertificateStore } from "../internal/clients/ca-store";
|
2024-10-07 22:35:54 +11:00
|
|
|
|
|
|
|
|
let ca: CertificateAuthority | undefined;
|
|
|
|
|
|
2024-11-24 15:29:14 +11:00
|
|
|
export const useCertificateAuthority = () => {
|
2024-10-07 22:35:54 +11:00
|
|
|
if (!ca) throw new Error("CA not initialised");
|
|
|
|
|
return ca;
|
|
|
|
|
};
|
|
|
|
|
|
2025-04-15 20:04:45 -04:00
|
|
|
export default defineNitroPlugin(async () => {
|
2025-05-10 16:18:28 -04:00
|
|
|
// const store = fsCertificateStore();
|
2024-10-07 22:35:54 +11:00
|
|
|
|
2025-03-14 10:53:37 -04:00
|
|
|
ca = await CertificateAuthority.new(dbCertificateStore());
|
2024-10-07 22:35:54 +11:00
|
|
|
});
|