Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fido2/lib/main.js>MdsCollection

A node.js library for performing FIDO 2.0 / WebAuthn server functionality
Go to Latest
class MdsCollection
Re-export
import { MdsCollection } from "https://deno.land/x/fido2@3.3.5/lib/main.js";

A class for managing, validating, and finding metadata that describes authenticators

This class does not do any of the downloading of the TOC or any of the entries in the TOC, but assumes that you can download the data and pass it to this class. This allows for cleverness and flexibility in how, when, and what is downloaded -- while at the same time allowing this class to take care of the not-so-fun parts of validating signatures, hashes, certificat chains, and certificate revocation lists.

Typically this will be created through Fido2Lib#createMdsCollection and then set as the global MDS collection via Fido2Lib#setMdsCollection

Examples

var mc = Fido2Lib.createMdsCollection() // download TOC from https://mds.fidoalliance.org ... var tocObj = await mc.addToc(tocBase64); tocObj.entries.forEach((entry) => { // download entry.url ... mc.addEntry(entryBase64); }); Fido2Lib.setMdsCollection(mc); // performs validation var entry = Fido2Lib.findEntry("4e4e#4005");

Constructors

new
MdsCollection(collectionName)

Creates a new MdsCollection

Methods

addEntry(entryStr)

Parses and adds a new MDS entry to the collection. The entry will not be available through findEntry until validate has been called

addToc(
tocStr,
rootCert,
crls,
)

Validates and stores the Table of Contents (TOC) for future reference. This method validates the TOC JSON Web Token (JWT) signature, as well as the certificate chain. The certiciate chain is validated using the rootCert and crls that are provided.

Looks up an entry by AAID, AAGUID, or attestationCertificateKeyIdentifiers. Only entries that have been validated will be found.

Returns the parsed and validated Table of Contents object from getToc

Validates all entries that have been added. Note that MdsCollection#findEntry will not find an MdsEntry until it has been validated.