verifyCertificateChain
verifyCertificateChain
All-in-one certificate chain verification: builds a candidate path then validates time, constraints, policy, purpose, and optional service identity.
Equivalent to calling buildCandidatePath followed by validateCandidatePath (plus identity matching when configured).
Success authenticates the certification path of leaf. Authenticating a remote peer also takes the transport's proof that the peer holds the leaf's private key: pass the certificate the handshake authenticated as leaf, the rest of the peer's chain as intermediates, and apply authorization to value.leaf.
ts
function verifyCertificateChain(
callerInput: VerifyCertificateChainInput,
): Promise<VerifyChainResult>Parameters
callerInput:VerifyCertificateChainInput
Examples
ts
import { verifyCertificateChain } from 'micro509';
const result = await verifyCertificateChain({
leaf: serverCertPem,
intermediates: [intermediatePem],
roots: [rootCaPem],
purpose: 'serverAuth',
serviceIdentity: { type: 'dns', value: 'example.com' },
});
if (!result.ok) {
console.error(result.error.code, result.error.message);
}