Merge branch 'next' into feat/new-workflow

This commit is contained in:
Fu Diwei
2025-01-22 20:21:32 +08:00
16 changed files with 589 additions and 5 deletions

View File

@@ -22,3 +22,45 @@ export const archive = async (certificateId: string, format?: CertificateFormatT
return resp;
};
type ValidateCertificateResp = {
domains: string;
};
export const validateCertificate = async (certificate: string) => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse<ValidateCertificateResp>>(`/api/certificates/validate/certificate`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: {
certificate: certificate,
},
});
if (resp.code != 0) {
throw new ClientResponseError({ status: resp.code, response: resp, data: {} });
}
return resp;
};
export const validatePrivateKey = async (privateKey: string) => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse>(`/api/certificates/validate/private-key`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: {
privateKey: privateKey,
},
});
if (resp.code != 0) {
throw new ClientResponseError({ status: resp.code, response: resp, data: {} });
}
return resp;
};