web-biometric
TypeScript icon, indicating that this package has built-in type declarations

1.5.4 • Public • Published

Web Biometric Authentication

Installation

yarn add web-biometric

login with device fingerprint

Usage

import { StringToUint8Array, Challenge } from "web-biometric";

const options = {
	publicKey:{
		rp: {
			name: "Web App Name",
			id: "my-website.com",
		},

		user: {
			id: StringToUint8Array("user-uuid-with-16-char-length"),
			name: "userEmailAddress@example.com",
			displayName: "User Display Name"
		},

		pubKeyCredParams: [{
			type: "public-key",
			alg: -7
		}],

		attestation: "none",

		timeout: 60000,

		// these option should be provided from server
		challenge: Challenge("this-is-challenge-text-and-should-be-long"),

		authenticatorSelection: {
			authenticatorAttachment: "platform",
			userVerification: "required",
		}
	}
}

const registerBiometricFunction = () => {
	try {
		const { credential } = await Register(options);

		const base64EncodedId = credential.id;

		console.log(base64EncodedId)
	} catch (err) {
		console.error(err);
	}
}

Package Sidebar

Install

npm i web-biometric

Weekly Downloads

10

Version

1.5.4

License

ISC

Unpacked Size

14.6 kB

Total Files

18

Last publish

Collaborators

  • arun-devp