npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tanglemesh/webauthn-server

v1.0.1

Published

Implementation of strong authentication with the webauthn standard and FIDO2. Strong authentication is an authentication method using a physical key.

Downloads

13

Readme

webauthn

Implementation of strong authentication with the webauthn standard and FIDO2. Strong authentication is an authentication method using a physical key.

For a more thorough introduction see these two nice articles:

Installation

npm install @tanglemesh/webauthn-server

Usage

const WebAuthn = require ("@tanglemesh/webauthn-server");

or

import WebAuthn from "@tanglemesh/webauthn-server";

Then initialize a new Object like

const webAuthn = new WebAuthn ({
    …options
});

Options

  • originstring representing the domain origin that should be allowed
  • relyingParty.idstring identifying your platform
  • relyingParty.namestring identifying your platform as display name
  • relyingParty.iconstring*optional a URL for the service's icon. Can be a RFC 2397 data URL.
  • authenticator (default: platform) – string Indicates whether authenticators should be part of the OS ("platform"), or can be roaming authenticators ("cross-platform").
  • attestation (default: direct) – string The preferred attestation type to be used. See [AttestationConveyancePreference]{https://w3.org/TR/webauthn/#enumdef-attestationconveyancepreference} in the WebAuthn spec.
  • userVerification (default: preferred) – string Indicates whether user verification should be performed. Options are "required", "preferred", or "discouraged".
  • timeout (default: 60000) – number The amount of time to wait, in milliseconds, before a call has timed out.
  • attestationType (default: public-key) – string The type that should be used to by the fido2 device.
  • assertionTransports (default: ['usb','nfc','ble','internal']) – array<string> The assertion transports that can be used by the fido2 device. ],

Methods

  • generateAttestation (user = { id, name, displayName*optional }): Generate a challenge from a relying party and a user { relyingParty: { name }, user: { id, name, displayName } } to be sent back to the client, in order to register.
  • parseAttestation (attestationResponse): Parse the attestation response from the fido2 device and validate it. Response: { valid, key: { fmt, publicKey, counter, credID } }.
  • generateAssertion (key): Generate a challenge from a user's key (returned by parseAttestation) to be sent back to the client, in order to log in.
  • parseAssertion (assertionResponse, key): Parse the assertion response from the fido2 device and validate it. Response: { valid, key: { fmt, publicKey, counter, credID }, challenge, id }.
  • getClientData (attestationOrAssertionResponse): Extract challenge and key from the register request body. The challenge allow to retrieve the user, and the key must be stored server side linked to the user. Response { type, challenge, origin, crossOrigin }.

Example

See an example in example

You can use the example to test the web-authn package. Just start up the test server with npm install && npm start. Now you can navigate to http://localhost:8000 and test the different requests and web-authn steps.