misc: integrated custom key usages for issue-cert endpoint

This commit is contained in:
Sheen Capadngan
2024-09-11 01:57:16 +08:00
parent 6fab7d9507
commit 4e6b289e1b
12 changed files with 192 additions and 36 deletions
@@ -50,9 +50,7 @@ export const certificateTemplateDALFactory = (db: TDbClient) => {
)
.first();
if (certTemplate) {
return { ...certTemplate, keyUsages: certTemplate.keyUsages || [] };
}
return certTemplate;
} catch (error) {
throw new DatabaseError({ error, name: "Get certificate template by ID" });
}
@@ -9,11 +9,11 @@ export const sanitizedCertificateTemplate = CertificateTemplatesSchema.pick({
commonName: true,
subjectAlternativeName: true,
pkiCollectionId: true,
ttl: true
ttl: true,
keyUsages: true
}).merge(
z.object({
projectId: z.string(),
caName: z.string(),
keyUsages: z.string().array()
caName: z.string()
})
);