Skip to main content

Pythonic WebAuthn

Project description

py_webauthn

PyPI GitHub license Pythonic WebAuthn

A Python3 implementation of the WebAuthn API focused on making it easy to leverage the power of WebAuthn.

This library supports all FIDO2-compliant authenticators, including security keys, Touch ID, Face ID, Windows Hello, Android biometrics...and pretty much everything else.

Installation

This module is available on PyPI:

pip install webauthn

Requirements

  • Python 3.8 and up

Usage

The library exposes just a few core methods on the root webauthn module:

  • generate_registration_options()
  • verify_registration_response()
  • generate_authentication_options()
  • verify_authentication_response()

Two additional helper methods are also exposed:

  • options_to_json()
  • base64url_to_bytes()

Additional data structures are available on webauthn.helpers.structs. These are useful for constructing inputs to the methods above, and for type hinting. These Pydantic-powered dataclasses provide runtime data validation to help ensure consistency in the shape of data being passed around.

Registration

See examples/registration.py for practical examples of using generate_registration_options() and verify_registration_response().

You can also run these examples with the following:

# See "Development" below for venv setup instructions
venv $> python -m examples.registration

Authentication

See examples/authentication.py for practical examples of using generate_authentication_options() and verify_authentication_response().

You can also run these examples with the following:

# See "Development" below for venv setup instructions
venv $> python -m examples.authentication

Development

Installation

Set up a virtual environment, and then install the project's requirements:

$> python3 -m venv venv
$> source venv/bin/activate
venv $> pip install -r requirements.txt

Testing

Python's unittest module can be used to execute everything in the tests/ directory:

venv $> python -m unittest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webauthn-1.1.0.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

webauthn-1.1.0-py3-none-any.whl (57.0 kB view details)

Uploaded Python 3

File details

Details for the file webauthn-1.1.0.tar.gz.

File metadata

  • Download URL: webauthn-1.1.0.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for webauthn-1.1.0.tar.gz
Algorithm Hash digest
SHA256 523e6e488a4d5e8c4fe183dde154a7cdfc9dad62e6e30e97c1d52e4a4ae6390e
MD5 dc694489f4ae01d078e5b842713906f5
BLAKE2b-256 00b450209dd14af266a1c666fad0f84bff075f863896939d9897abcbed42f66e

See more details on using hashes here.

File details

Details for the file webauthn-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: webauthn-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 57.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for webauthn-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a24696c67f8f3eb09267b10b3bfa4aade86bf08e2c41333d8c00f199c528b97
MD5 4b45c7528fb5988f7389f30340a901f4
BLAKE2b-256 4d97a82ad36156e73f322fa5f91991f2bb36ffa106c3190a4efe999a8c115088

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page