Skip to content

ExportCertificate

Source: src/AWS/ACM/ExportCertificate.ts

Runtime binding for acm:ExportCertificate.

Bind this operation to a Certificate to get a callable that exports the certificate, its chain, and the encrypted private key. Only exportable certificates can be exported: private-CA certificates, or public certificates requested with export: "ENABLED". The returned PrivateKey is sensitive and comes back wrapped in Redacted — unwrap it with Redacted.value only at the point of use. Provide the implementation with Effect.provide(AWS.ACM.ExportCertificateHttp).

// init — bind the operation to the certificate
const exportCertificate = yield* AWS.ACM.ExportCertificate(certificate);
// runtime — the passphrase encrypts the exported private key
const result = yield* exportCertificate({
Passphrase: Redacted.make(new TextEncoder().encode(passphrase)),
});
const pem = result.Certificate;
const privateKeyPem =
typeof result.PrivateKey === "string"
? result.PrivateKey
: result.PrivateKey && Redacted.value(result.PrivateKey);