fix: update version to 0.5.0, add support for PEM and PFX formats, and implement certificate conversion functionality
This commit is contained in:
+4
-3
@@ -47,15 +47,16 @@ export class KeyVaultStore {
|
||||
return expiresOn.getTime() - Date.now() <= thresholdMs;
|
||||
}
|
||||
|
||||
async importCertificate(name: string, pemBundle: string): Promise<void> {
|
||||
async importCertificate(name: string, cert: string | Buffer, format: 'pem' | 'pfx' = 'pem'): Promise<void> {
|
||||
const options: ImportCertificateOptions = {
|
||||
policy: {
|
||||
contentType: 'application/x-pem-file',
|
||||
contentType: format === 'pfx' ? 'application/x-pkcs12' : 'application/x-pem-file',
|
||||
issuerName: 'Unknown',
|
||||
subject: 'CN=unknown',
|
||||
},
|
||||
};
|
||||
await this.certClient.importCertificate(name, Buffer.from(pemBundle), options);
|
||||
const certBuffer = typeof cert === 'string' ? Buffer.from(cert) : cert;
|
||||
await this.certClient.importCertificate(name, certBuffer, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user