Giter VIP home page Giter VIP logo

passkey-demo's Introduction

Passkey demonstration

This is a relatively simple demonstration of passkeys. It glues together various information that is spread across multiple websites, library documentation and blogs.

Credit and references

https://web.dev/articles/passkey-registration and https://web.dev/articles/passkey-form-autofill were particularly helpful in figuring out what was needed for the front-end, and https://pypi.org/project/webauthn/ helped me figure out the backend.

The file base64url-arraybuffer.js is from https://github.com/herrjemand/Base64URL-ArrayBuffer.

Notes

The Python code generates a self-signed certificate on first run, because passkeys are only supported over https links.

db.py is a relatively simple interface to a user database, without any effort to optimise (e.g. by adding indexes).

Possible improvements

The use of client IP address to maintain the (in-memory) database of login attempts/challenges is fragile: multiple people trying to log in at the same time could collide, and someone on a mobile could see their address change between loading the page and actually logging in. However, this is the best option I can see: we don't have any information about the user when we're calling /api/generate-authentication-options from the UI, so can't tie the challenge to that account.

The other option is to make the user type in their username, even though it's implied by the passkey. This seems like a backwards step for UX.

w3c/webauthn#1856 and w3c/webauthn#1848 both talk about different aspects of the complexity of server-side management of challenges. Not all of the advice from those discussions is included in this demo. (E.g. there's a suggestion that the client should generate new challenges if the login timeout nears)

passkey-demo's People

Contributors

nsw42 avatar

Stargazers

Jonathan Thackray avatar

Watchers

 avatar

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.