Creates an instance of PkiService.
The ECC provider for ECDSA/Ed25519 operations
Generates a key pair based on the provided options. Uses a switch for native type narrowing without casting.
PrivategeneratePrivategenerateGenerate ECDSA Key Pair (via @peculiar/x509)
PrivategenerateGenerate Ed25519 Key Pair (via @peculiar/x509)
Create a Certificate Signing Request (CSR) Routes to RSA (node-forge) or ECC (@peculiar/x509) based on key type
Create CSR with RSA key (node-forge) - synchronous for backward compatibility.
CSR generation options including subject, extensions, and key pair
PEM string or DER Buffer depending on options.encoding
PrivatecreateCreate CSR with ECC key (ECDSA or Ed25519) via @peculiar/x509.
CSR generation options including subject, extensions, and key pair
PEM string or DER Buffer depending on options.encoding
Save a Public Key / Certificate / CSR to disk with read-only permissions (444)
PrivatesavePrivateparseParse Subject Alternative Names into node-forge format. Supports DNS, IP (v4/v6), URI, and EMAIL types.
PrivateparseParse a single SAN entry (e.g., "DNS:example.com", "IP:192.168.1.1").
Privateparse
PKI Service for cryptographic operations including key generation and CSR creation.
Remarks
Uses dependency injection pattern. The EccProvider dependency must be passed to the constructor. Instantiate via composition root or directly for testing.
Example