This release is a pre-release and may not be stable for production use.
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
import nitrokey.trussed
print("Connected Nitrokey devices:")
for device in nitrokey.trussed.list():
print(f"- {device.name} at {device.path}")
Compatibility
The Nitrokey Python SDK currently requires Python 3.11 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.11 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 installinstalls the SDK and its dependencies as specified in the lockfile (must be up-to-date)make lockupdates the lockfile without changing pinned dependency versionsmake updatebumps all dependencies, installs them and updates the lockfile
For more information, see poetry’s documentation on Managing depencies and Commands.
Publishing Releases
Releases are published using Github Actions. To create a new release:
- Update the
versionfield inpyproject.tomlmanually or usingpoetry version. - Update the changelog for the release.
- Commit these changes, create a PR and merge into
main. - Trigger the
full.yamlworkflow for the release branch to run the full compatibility tests. - Create a signed tag with the version number and a
vprefix, for examplev0.2.4, and push it to this repository. - Create a new release for this tag and copy the relevant parts from the changelog to the release description.
- Wait for the deployment action to run and approve the deployment to PyPI.
- Update the
NITROKEY_SDK_PY_VERSIONandNITROKEY_SDK_PY_CHECKSUMvariables in theMakefileof the nitrokey-documentation repository to update the documentation on docs.nitrokey.com.
All commits to main are automatically deployed to TestPyPI.
It is also possible to publish release candidates (pre-releases) with a suffix like -rc.1.
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.
Release files for nitrokey 0.5.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nitrokey-0.5.0rc3.tar.gz | 138.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nitrokey-0.5.0rc3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 335.9 kB
Release files / nitrokey-0.5.0rc3.tar.gz
| Download URL | nitrokey-0.5.0rc3.tar.gz |
|---|---|
| Size | 138.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8285054e89fe0462a7c6e1fa0ce12158be5924d1e23579d5310faa930a730084
|
|
BLAKE2b-256 checksum How to use checksums |
43997dcce03c2802df4f32a47b0cef6e6714dd967c998b42194996b35906f680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / nitrokey-0.5.0rc3-py3-none-any.whl
| Download URL | nitrokey-0.5.0rc3-py3-none-any.whl |
|---|---|
| Size | 197.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b4825e470aca49378fabbc3289e37ede826deb9390ad594690ba77378c9bbcc
|
|
BLAKE2b-256 checksum How to use checksums |
e91ce1bda8c3502031206e6001f776bacc11d1b351f22f9e6be1e5d3b91855e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency log