Skip to main content

Attestation API

webauthn-server-buildkit exports its attestation building blocks so you can verify statements, supply FIDO MDS trust anchors, and work with X.509 chains directly. Most applications only need StaticMetadataService and APPLE_WEBAUTHN_ROOT_CA_PEM; the rest are available for advanced use. See the Attestation guide for the conceptual overview.

Trust-anchor provider

import { StaticMetadataService, APPLE_WEBAUTHN_ROOT_CA_PEM } from 'webauthn-server-buildkit';

const metadataService = new StaticMetadataService({
defaultRoots: [APPLE_WEBAUTHN_ROOT_CA_PEM],
});
ExportKindPurpose
StaticMetadataServiceclassA MetadataService backed by a fixed set of roots (StaticMetadataServiceOptions).
APPLE_WEBAUTHN_ROOT_CA_PEMconstantThe bundled Apple WebAuthn Root CA (PEM).
MetadataServicetypeInterface for supplying roots and MetadataStatements (implement for full FIDO MDS).
MetadataRootQuery, MetadataStatement, MetadataStatusReporttypesMDS lookup/query shapes.

Per-format verifiers

Each verifier takes an AttestationVerifierInput and returns an AttestationVerificationResult ({ fmt, attestationVerified, ... }).

FunctionFormat
verifyAppleAttestationapple (anchors to the bundled root)
verifyPackedAttestationpacked (self + x5c)
verifyFidoU2fAttestationfido-u2f
verifyAndroidKeyAttestationandroid-key
verifyTpmAttestationtpm
verifyAndroidSafetyNetAttestationandroid-safetynet (deprecated by Google)

Related types: AttestationVerifierInput, AttestationVerificationResult, AttestationFormatVerifier.

X.509 helpers

Thin wrappers over Node's built-in crypto.X509Certificate:

import { parseCertPem, verifyCertChain, publicKeyMatchesCOSE } from 'webauthn-server-buildkit';
FunctionPurpose
parseCert, parseCertPemParse DER/PEM into a certificate object.
derToX509, pemToDerConvert between encodings.
isValidAtCheck validity at a timestamp.
isIssuedByCheck issuer relationship.
verifyCertChainVerify a leaf-first chain to a trusted root.
publicKeyMatchesCOSEConfirm a cert's public key matches a COSE key.

Minimal DER / ASN.1 reader

For parsing attestation extensions without a heavyweight dependency:

import { readSequence, decodeOID, findExtension, ASN1_TAG } from 'webauthn-server-buildkit';

Exports: ASN1_TAG, readTLV, readChildren, readSequence, readSet, decodeOID, readOctetString, readInteger, readBitString, findExtension, and the Asn1Node type.

Honesty contract

attestationVerified from any verifier is true only when the statement is both cryptographically verified and trust-anchored (apple via the bundled root, chain formats via your metadataService). There is no CRL/OCSP revocation checking — attestation is offline by design.