python-fido2/README.adoc

111 lines
3.9 KiB
Plaintext
Raw Normal View History

== python-fido2
image:https://github.com/Yubico/python-fido2/workflows/build/badge.svg["Github actions build", link="https://github.com/Yubico/python-fido2/actions"]
2018-04-05 14:34:18 +02:00
2018-04-05 11:03:23 +02:00
Provides library functionality for communicating with a FIDO device over USB as
well as verifying attestation and assertion signatures.
2022-04-25 10:58:04 +02:00
This library aims to support the FIDO U2F and FIDO 2 protocols for
communicating with a USB authenticator via the Client-to-Authenticator Protocol
(CTAP 1 and 2). In addition to this low-level device access, classes defined in
2018-09-27 12:15:57 +02:00
the `fido2.client` and `fido2.server` modules implement higher level operations
which are useful when interfacing with an Authenticator, or when implementing
WebAuthn support for a Relying Party.
2018-03-16 13:42:59 +01:00
For usage, see the `examples/` directory.
=== References
These links related to WebAuthn and FIDO2 can help you get started:
* Yubico WebAuthn/FIDO2 guide: https://developers.yubico.com/FIDO2/
* W3C WebAuthn specification: https://www.w3.org/TR/webauthn/
* FIDO specifications: https://fidoalliance.org/specifications/download/
=== License
This project, with the exception of the files mentioned below, is licensed
under the BSD 2-clause license.
2018-03-16 13:42:59 +01:00
See the _COPYING_ file for the full license text.
This project contains source code from pyu2f (https://github.com/google/pyu2f)
which is licensed under the Apache License, version 2.0.
2020-09-11 17:47:18 +02:00
These files are located in `fido2/hid/`.
See http://www.apache.org/licenses/LICENSE-2.0,
2018-03-16 13:42:59 +01:00
or the _COPYING.APLv2_ file for the full license text.
This project also bundles the public suffix list (https://publicsuffix.org)
which is licensed under the Mozilla Public License, version 2.0.
2018-04-05 11:03:23 +02:00
This file is stored as `fido2/public_suffix_list.dat`.
See https://mozilla.org/MPL/2.0/,
2018-03-16 13:42:59 +01:00
or the _COPYING.MPLv2_ file for the full license text.
2020-02-22 11:32:30 +01:00
=== Requirements
2023-04-05 11:49:55 +02:00
fido2 is compatible with Python 3.7 and later, and is tested on Windows, MacOS,
and Linux. Support for OpenBSD, FreeBSD, and NetBSD is provided as-is and
relies on community contributions.
2020-02-22 11:32:30 +01:00
=== Installation
2021-05-11 19:45:16 +02:00
2018-04-05 11:03:23 +02:00
fido2 is installable by running the following command:
2020-02-22 11:32:30 +01:00
pip install fido2
2021-08-19 14:27:21 +02:00
To install the dependencies required for communication with NFC authenticators,
2019-06-17 12:55:31 +02:00
instead use:
2020-02-22 11:32:30 +01:00
pip install fido2[pcsc]
Under Windows 10 (1903 or later) access to FIDO devices is restricted and
requires running as Administrator. This library can still be used when running
as non-administrator, via the `fido.client.WindowsClient` class. An example of
this is included in the file `examples/credential.py`.
2019-06-17 12:55:31 +02:00
2021-05-11 19:45:16 +02:00
Under Linux you will need to add a Udev rule to be able to access the FIDO
device, or run as root. For example, the Udev rule may contain the following:
----
#Udev rule for allowing HID access to Yubico devices for FIDO support.
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", \
MODE="0664", GROUP="plugdev", ATTRS{idVendor}=="1050"
----
2022-10-17 17:04:20 +02:00
There may be a package already available for your distribution that does this
for you, see:
https://support.yubico.com/hc/en-us/articles/360013708900-Using-Your-U2F-YubiKey-with-Linux
Under FreeBSD you will either need to run as root or add rules for your device
to /etc/devd.conf, which can be automated by installing security/u2f-devd:
# pkg install u2f-devd
2022-05-02 13:09:43 +02:00
==== Dependencies
This project depends on Cryptography. For instructions on installing this
2018-04-05 16:10:29 +02:00
dependency, see https://cryptography.io/en/latest/installation/.
2018-09-27 12:15:57 +02:00
2022-05-02 13:09:43 +02:00
NFC support is optionally available via PC/SC, using the pyscard library. For
2019-06-17 12:55:31 +02:00
instructions on installing this dependency, see
https://github.com/LudovicRousseau/pyscard/blob/master/INSTALL.md.
2018-09-27 12:15:57 +02:00
=== Development
2022-04-25 10:58:04 +02:00
For development of the library we use https://python-poetry.org/[poetry]. To
set up the dev environment, run this command in the root directory of the
repository:
2018-09-27 12:15:57 +02:00
2021-01-20 15:03:10 +01:00
poetry install
2018-09-27 12:15:57 +02:00
2022-04-25 10:58:04 +02:00
We also use https://pre-commit.com/[pre-commit] to run some scans on the code
prior to committing.
2018-09-27 12:15:57 +02:00
==== Running tests
While many tests can run on their own, some require a connected U2F or FIDO2
device to run.
2021-01-20 15:03:10 +01:00
poetry run pytest