🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@passwordlessdev/passwordless-client

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@passwordlessdev/passwordless-client

This library allows you to to easily add passwordless sign in (using fido2/webauthn) to your web application.

Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
1.1K
4.63%
Maintainers
1
Weekly downloads
 
Created
Source

passwordless by bitwarden

Welcome to Passwordless.dev by Bitwarden. Passwordless.dev is a software toolkit that helps developers bring FIDO2 WebAuthn passkeys to their end users. Provide passwordless authentication without the need to read W3C spoecification documentation, determine cryptography, or manage stored public keys. Passwordless with Bitwarden does this for you.

Get started

Passwordless.dev consists of three key parts:

  • An open-source client side library, used by your frontend to make requests to the end-user's browser WebAuthn API and requests to the passwordless.dev APIs.
  • A public RESTful API used to complete FIDO2 WebAuthn cryptographic exchanges with the browser.
  • a private RESTful API used to initiate key registrations, verify signins, and retrieve keys for end-users.

To start, download the Passwordless.js library:

NPM package

Install the Passwordless.dev JS client:

yarn add @passwordlessdev/passwordless-client

Or:

npm install @passwordlessdev/passwordless-client

Next, your front end must import the library to call the methods:

import { Client } from '@passwordlessdev/passwordless-client';
const p = new Client({apiKey: ""});

HTML

Install the Passwordless.dev JS client:

<script src="https://cdn.passwordless.dev/dist/1.1.0/passwordless.iife.js" crossorigin="anonymous"></script>`

Next, your front end must import the libary to call the methods:

<script>
const p = new Passwordless.Client({apiKey: ""});
</script>

Registering a token could look like:

// Instantiate a passwordless client using your API public key.
const p = new Passwordless.Client({
    apiKey: "myapplication:public:4364b1a49a404b38b843fe3697b803c8"
});

// Fetch the registration token from the backend.
const backendUrl = "https://localhost:8002";
const registerToken = await fetch(backendUrl + "/create-token?userId" + userId).then(r => r.json());

// Register the token with the end-user's device.
const { token, error } = await p.register(registerToken);

Advanced configuration

When selfhosting, the apiUrl property in the constructor can be used to configure the URL for the Passwordless.dev server.

For advanced usages, you can also configure the origin and the rpid.

Build the library

Run:

yarn build

Obtaining your API credentials

Passwordless.dev's Admin Panel is a GUI for application and API key management. You can manage your users and receive your public API key and private API key (also known as secret) from the user interface.

To create an application, follow the instructions here.

To create an account for yourself or your organization, visit this link

Next steps

  • Call the function register or (e.g. signinWithDiscoverable()).
  • Add two endpoints to your backend that integrate to your existing user system (set cookie, sessions, and more) and will communicate secrets with our API.
  • Make a request between your clientside code and the verification endpoints on your backend to verify the registration or sign in.

We've written a more detailed guide, with more language examples and SDKs in the Passwordless.dev documentation.

Help

To talk to the passwordless team, send us an email at support@passwordless.dev

References

Bitwarden

You can fine Bitwarden's other code repositories at https://github.com/bitwarden and more information on https://bitwarden.com/.

Contribute

We encourage all contributions to docs.passwordless.dev, whether that's opening issues to request edits or additions, or adding them yourself in PRs.

FAQs

Package last updated on 24 Aug 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