Giter VIP home page Giter VIP logo

passwordless-client-js's Introduction

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 specification 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

  1. Call the function register or (e.g. signinWithDiscoverable()).
  2. 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.
  3. 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 [email protected]

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.

passwordless-client-js's People

Contributors

abergs avatar antonlydell avatar davidfant avatar johannesl avatar jonashendrickx avatar jrmccannon avatar mmccabe4 avatar renovate[bot] avatar tyrrrz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passwordless-client-js's Issues

Linting is not properly working

Steps To Reproduce

Linting is not properly working, was introduced in #45. It also appears be trying to lint the files in the 'dist' folder.

Expected Result

Only lint Typescript files, not the files/bundles generated by rollup.

Actual Result

npm run format lints all files with *.js and *.vue extensions.

Screenshots or Videos

n/a

Unknown errorCode "Invalid 'sameOriginWithAncestors' value" when signed in to Bitwarden browser extension

Background

When I try to register a passkey for an account on Streamlit Passwordless I get an error from the underlying javascript library passwordless-client-js saying:

{
'from': 'client',
'errorCode': 'unknown',
'title': "Invalid 'sameOriginWithAncestors' value",
} 

I get this error when I am signed in to the Bitwarden browser extension and when the extension is locked. It does not matter if I have a security key that can handle passkeys inserted into my machine or not. If I log out from the browser extension I can register a passkey with the security key without any issues. I have tested with both Firefox and Chromium and I get the same result. It works ok to register a passkey using the 1Password browser extension.

Versions

Steps to reproduce

  1. Open Firefox or Chromium and install the Bitwarden browser extension.

  2. Sign in to your Bitwarden account in the browser extension.

  3. Navigate to Streamlit Passwordless.

  4. Enter a username in the "Username" field and press enter.

  5. Click the "Register" button.

  6. Observe the error.

  7. Lock the browser extension.

  8. Repeat step 4-6.

  9. Log out from the browser extension.

  10. Repeat step 4-6.

  11. Observe the WebAuthn pop up that appears.

Register returns 500 error response

After creating a token and passing it the Passwordless Client, a client does get registered but no authentication happens and a 500 error is returned.

I know it is getting registered because when I try to register again with the same username an error is shown that a user already exists:

See screenshots for details.

Screen Shot 2022-08-04 at 11 05 46 AM

Screen Shot 2022-08-04 at 11 08 30 AM

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm rollup-plugin-terser Available

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • [deps]: Update actions/upload-artifact action to v4.3.6
  • [deps]: Update npm minor to v9.9.0 (@eslint/js, eslint)
  • [deps]: Lock file maintenance

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3@1e60f620b9541d16bece96c5465dc8ee9832be0b
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3@1e60f620b9541d16bece96c5465dc8ee9832be0b
  • actions/upload-artifact v4.3.5@89ef406dd8d7e03cfd12d9e0a4a378f454709029
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/workflow-linter.yml
npm
package.json
  • @eslint/js 9.8.0
  • @rollup/plugin-typescript 11.1.6
  • @types/jest 29.5.12
  • eslint 9.8.0
  • eslint-config-prettier 9.1.0
  • jest 29.7.0
  • jest-environment-jsdom 29.7.0
  • prettier 3.3.3
  • prettier-plugin-organize-imports 3.2.4
  • rimraf 5.0.10
  • rollup 2.79.1
  • rollup-plugin-terser 7.0.2
  • tslib 2.6.3
  • typescript 5.5.4
  • ts-jest 29.2.4

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.