mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
tweaks
This commit is contained in:
@@ -105,9 +105,12 @@ export const buildCertificateChain = async ({
|
|||||||
kmsService,
|
kmsService,
|
||||||
kmsId
|
kmsId
|
||||||
}: TBuildCertificateChainDTO) => {
|
}: TBuildCertificateChainDTO) => {
|
||||||
|
if (!encryptedCertificateChain && (!caCert || !caCertChain)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let certificateChain = `${caCert}\n${caCertChain}`.trim();
|
let certificateChain = `${caCert}\n${caCertChain}`.trim();
|
||||||
|
|
||||||
// If the certificate was generated after ~05/01/25 it will have a encryptedCertificateChain attached to it's body
|
|
||||||
if (encryptedCertificateChain) {
|
if (encryptedCertificateChain) {
|
||||||
const kmsDecryptor = await kmsService.decryptWithKmsKey({ kmsId });
|
const kmsDecryptor = await kmsService.decryptWithKmsKey({ kmsId });
|
||||||
const decryptedCertChain = await kmsDecryptor({
|
const decryptedCertChain = await kmsDecryptor({
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ export type TGetCertificateCredentialsDTO = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type TBuildCertificateChainDTO = {
|
export type TBuildCertificateChainDTO = {
|
||||||
caCert: string;
|
caCert?: string;
|
||||||
caCertChain: string;
|
caCertChain?: string;
|
||||||
encryptedCertificateChain?: Buffer;
|
encryptedCertificateChain?: Buffer;
|
||||||
kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey">;
|
kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey">;
|
||||||
kmsId: string;
|
kmsId: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user