Skip to main content
Module

x/fido2/lib/main.js>Fido2Lib

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

Constructors

new
Fido2Lib(opts)

Creates a FIDO2 server class

Methods

Creates an assertion challenge and any other parameters for the navigator.credentials.get() call. The challenge property is an ArrayBuffer and will need to be encoded to be transmitted to the client.

assertionResult(res, expected)

Parses and validates an assertion response from the client

Gets a challenge and any other parameters for the navigator.credentials.create() call The challenge property is an ArrayBuffer and will need to be encoded to be transmitted to the client.

attestationResult(res, expected)

Parses and validates an attestation response from the client

Disables the specified extension.

Enables the specified extension.

generateExtensionOptions(
extName,
type,
options,
)

Generates the options to send to the client for the specified extension

setExtensionOptions(extName, options)

Specifies the options to be used for the extension

Static Methods

addAttestationFormat(
fmt,
parseFn,
validateFn,
)

Adds a new attestation format that will automatically be recognized and parsed for any future Fido2CreateRequest messages

addExtension(
extName,
optionGeneratorFn,
resultParserFn,
resultValidatorFn,
)

Adds a new global extension that will be available to all instantiations of Fido2Lib. Note that the extension must still be enabled by calling enableExtension for each instantiation of a Fido2Lib.

addMdsCollection(mdsCollection)

Adds a new MdsCollection to the global MDS collection list that will be used for findMdsEntry

Removes all entries from the global MDS collections list. Mostly used for testing.

createMdsCollection(collectionName)

Creates a new MdsCollection

Deletes all currently registered attestation formats.

Removes all extensions from the global extension registry. Mostly used for testing.

Returns MdsEntry objects that match the requested id. The lookup is done by calling MdsCollection#findEntry on the current global MDS collection. If no global MDS collection has been specified using setMdsCollection, an Error will be thrown.

parseAttestation(fmt, attStmt)

Parses an attestation statememnt of the format specified

parseExtensionResult(
extName,
clientThing,
authnrThing,
)

Validates an attestation response. Will be called within the context (this) of a Fido2AttestationResult