Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

348 B
Raw Blame
import * as x509 from "@peculiar/x509";

import { asNonSharedBuffer } from "@app/lib/fn";

export type TCertificateSource = Buffer | x509.X509Certificate;

export const toX509Certificate = (source: TCertificateSource): x509.X509Certificate =>
  source instanceof x509.X509Certificate ? source : new x509.X509Certificate(asNonSharedBuffer(source));