Nitrokey Python SDK
Project description
Nitrokey Python SDK
The Nitrokey Python SDK can be used to use and configure Nitrokey devices.
Features
The SDK supports these devices and features:
- Nitrokey 3
- device and bootloader management (
nitrokey.nk3
) - admin app (
nitrokey.trussed.admin_app
) - provisioner app (
nitrokey.trussed.provisioner_app
) - secrets app (
nitrokey.nk3.secrets_app
)
- device and bootloader management (
- Nitrokey Passkey
- device and bootloader management (
nitrokey.nkpk
) - admin app (
nitrokey.trussed.admin_app
) - provisioner app (
nitrokey.trussed.provisioner_app
)
- device and bootloader management (
Installation
The Nitrokey Python SDK is released to the Python Package Index (PyPI) and can be installed with pip
:
$ pip install nitrokey
The releases are also available as signed tags in the GitHub repository Nitrokey/nitrokey-sdk-py.
Getting Started
from nitrokey.nk3 import NK3
from nitrokey.nkpk import NKPK
print("Connected Nitrokey devices:")
for device in NK3.list():
print(f"- {device.name} at {device.path}")
for device in NKPK.list():
print(f"- {device.name} at {device.path}")
Compatibility
The Nitrokey Python SDK currently requires Python 3.9 or later. Support for old Python versions may be dropped in minor releases.
Related Projects
- pynitrokey: A command line interface for the Nitrokey FIDO2, Nitrokey Start, Nitrokey 3 and NetHSM
- nitrokey-app2: A graphical application to manage and use Nitrokey 3 devices
- nethsm-sdk-py: A client-side Python SDK for NetHSM
Development
The following software is required for the development of the SDK:
- Python 3.9 or newer
- poetry
- GNU Make
- git
After checking out the source code from GitHub, you can install the SDK and its dev dependencies into a new virtual environment managed by poetry using make install
:
$ git clone https://github.com/Nitrokey/nitrokey-sdk-py.git
$ cd nitrokey-sdk-py
$ make install
We use multiple checks and linters for this project.
Use make check
to run all required checks.
Some problems can automatically be fixed by running make fix
.
The SDK also includes minimal tests to ensure that it is installed and loaded correctly.
Use make test
to run these tests.
Dependency Management
We use poetry for dependency management.
poetry maintains a lockfile with pinned dependency versions that is used for development environments and in CI.
This lockfile includes the hash of the pyproject.toml
file, so it needs to be updated if pyproject.toml
is changed.
These make targets can be used to invoke poetry for the most common tasks:
make install
installs the SDK and its dependencies as specified in the lockfile (must be up-to-date)make lock
updates the lockfile without changing pinned dependency versionsmake update
bumps all dependencies, installs them and updates the lockfile
For more information, see poetry’s documentation on Managing depencies and Commands.
License
This software is fully open source.
All software, unless otherwise noted, is dual licensed under Apache 2.0 and MIT. You may use the software under the terms of either the Apache 2.0 license or MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nitrokey-0.2.2.tar.gz
.
File metadata
- Download URL: nitrokey-0.2.2.tar.gz
- Upload date:
- Size: 115.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b46ebe762cab6ae244ce93c6df7f92e68d629379f8e3fe38deccd1eef5c7e201 |
|
MD5 | c6c225784d44b96880463c1c8efc95f2 |
|
BLAKE2b-256 | f606a791f80bc84f20921459b1465be88b9349fd113d72c068bf0bb017875ad9 |
File details
Details for the file nitrokey-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: nitrokey-0.2.2-py3-none-any.whl
- Upload date:
- Size: 161.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92da75e168d8fb10f7d7495d9f9a7d91aa5ebca3d660b8fbaa2a68855e9882a7 |
|
MD5 | 89ac702a1f38afc7c0b242b2912487a3 |
|
BLAKE2b-256 | 6e8fc05b6995f596f63c07c880082d467b7f10fd948b3308d59995b38775b23f |