createSelfSignedCertificate
Create a self-signed certificate.
Reuses input.keyPair when provided; otherwise generates a new key pair from input.algorithm. The returned certificate uses input.subject as both issuer and subject.
ts
function createSelfSignedCertificate(
input: CreateSelfSignedCertificateInput,
): Promise<SelfSignedCertificateResult>Parameters
input:CreateSelfSignedCertificateInput— Certificate subject, key, validity, and extension settings.
Returns — The certificate plus the key pair used to sign it.
Examples
ts
const { certificate, keyPair } = await createSelfSignedCertificate({
subject: { commonName: 'example.com' },
algorithm: { kind: 'ecdsa', curve: 'P-256' },
});