Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@simplewebauthn/browser

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplewebauthn/browser

SimpleWebAuthn for Browsers

  • 8.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
153K
increased by6.28%
Maintainers
1
Weekly downloads
 
Created

What is @simplewebauthn/browser?

@simplewebauthn/browser is a JavaScript library that provides a simple interface for implementing WebAuthn (Web Authentication) in web applications. It allows developers to easily integrate passwordless authentication and second-factor authentication using hardware security keys, biometric sensors, and other authenticators that support the WebAuthn standard.

What are @simplewebauthn/browser's main functionalities?

Registration

This feature allows users to register a new authenticator (e.g., a security key or biometric device) with the web application. The code sample demonstrates how to start the registration process, send the registration options to the client, and verify the registration response on the server.

const { startRegistration } = require('@simplewebauthn/browser');

async function register() {
  const options = await fetch('/generate-registration-options').then(res => res.json());
  const attResp = await startRegistration(options);
  const verification = await fetch('/verify-registration', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(attResp),
  }).then(res => res.json());
  if (verification.verified) {
    console.log('Registration successful!');
  } else {
    console.log('Registration failed.');
  }
}

Authentication

This feature allows users to authenticate using a previously registered authenticator. The code sample demonstrates how to start the authentication process, send the authentication options to the client, and verify the authentication response on the server.

const { startAuthentication } = require('@simplewebauthn/browser');

async function authenticate() {
  const options = await fetch('/generate-authentication-options').then(res => res.json());
  const assertionResp = await startAuthentication(options);
  const verification = await fetch('/verify-authentication', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(assertionResp),
  }).then(res => res.json());
  if (verification.verified) {
    console.log('Authentication successful!');
  } else {
    console.log('Authentication failed.');
  }
}

Other packages similar to @simplewebauthn/browser

Keywords

FAQs

Package last updated on 03 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc