Skip to content

client-certificate-auth API Reference


client-certificate-auth API Reference / helpers / allowFingerprints

Function: allowFingerprints()

allowFingerprints(fingerprints): ValidationCallback

Defined in: helpers.js:54

Create a validation callback that allows certificates with matching fingerprints. Supports SHA-1 fingerprints (compared against cert.fingerprint) and SHA-256 fingerprints with "SHA256:" prefix (compared against cert.fingerprint256). Fingerprints without a prefix are treated as SHA-1. Hex inputs are normalized: case and colon delimiters are ignored on both sides.

Parameters

fingerprints

string[]

Allowed fingerprints

Returns

ValidationCallback

Example

ts
app.use(clientCertificateAuth(allowFingerprints([
  'SHA256:AB:CD:EF:...',  // matched against cert.fingerprint256
  'AB:CD:EF:...',         // colon-delimited, matched against cert.fingerprint
  'ABCDEF...'             // contiguous hex also matches cert.fingerprint
])));

Released under the MIT License.