1.1.6 • Published 2 months ago

@passageidentity/webauthnutils v1.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

About

This package contains utility functions that simplify the creation and management of WebAuthn credentials and passkeys in web applications. Also included are functions that check if the current browser supports different features of WebAuthn, including hybrid credentials and conditional UI (autofill).

Getting Started

Install this package using npm.

npm i --save @passageidentity/webauthnutils

Usage

All the utility functions are static methods on classes. Full Typescript support is included. There are two static classes with functionality for getting and creating credentials, GetCredentialUtils and CreateCredentialUtils.

Methods can be invoked in this manner:

import { CreateCredentialUtils, GetCredentialUtils } from '@passageidentity/webauthnutils'

const createCredentialFeatures = CreateCredentialUtils.createCredentialAvailable()
const getCredendialFeatures = GetCredentialUtils.getCredentialAvailable()

These two methods can be used to check if the current browser supports WebAuthn and features like autofill. Use these methods to conditionally show

A typical credential creation flow will look like this:

// get challenge from server
// ...

// create credential
const supportedFeatures = await CreateCredentialUtils.createCredentialAvailable();
if supportedFeatures.available {
    const { credential, transports } = await CreateCredentialUtils.createCredential(
        challenge
    ).catch((_) => {
        // handle error
    });
}

See inline JSDoc comments for full documentation.

1.1.6

2 months ago

1.1.5

2 months ago

1.1.4

2 months ago

1.1.3

2 months ago

1.1.2

8 months ago

1.1.1

11 months ago

1.1.0

1 year ago

1.0.0

1 year ago