Usage Guide

Nitrokey Python SDK obsługuje obecnie urządzenia Nitrokey 3 (nitrokey.nk3.NK3) i Nitrokey Passkey (nitrokey.nkpk.NKPK). Oba urządzenia są oparte na tej samej platformie, Trussed, i dlatego dzielą tę samą klasę bazową nitrokey.trussed.TrussedDevice.

Urządzenia z kratownicą mogą zostać zrestartowane do trybu bootloadera, który jest używany do stosowania aktualizacji firmware. Urządzenia w trybie bootloadera mogą być dostępne przy użyciu nitrokey.nk3.NK3Bootloader i nitrokey.nkpk.NKPKBootloader (klasa bazowa nitrokey.trussed.TrussedBootloader).

Listing and Opening Devices

Use the nitrokey.trussed.list() function to list and open all connected devices:

import nitrokey.trussed

print("Connected Nitrokey devices:")
for device in nitrokey.trussed.list():
    print(f"- {device.name} at {device.path}")

If you know the device path, use nitrokey.trussed.open() instead:

import nitrokey.trussed

path = "/dev/hidraw1"
device = nitrokey.trussed.open(path)
if device is not None:
    print(f"Found {device.name} at {path}")
else:
    print(f"No device found at {path}")

Jeśli znasz model, z którym chcesz się połączyć, możesz również użyć funkcji list i open w modułach nitrokey.nk3 lub nitrokey.nkpk. Jeśli znasz również typ urządzenia, możesz użyć metod list i open klas nitrokey.nk3.NK3, nitrokey.nkpk.NKPK, nitrokey.nk3.NK3Bootloader i nitrokey.nkpk.NKPKBootloader.

Using Applications

Nitrokey Python SDK obsługuje te aplikacje dla wszystkich urządzeń Trussed:

The Nitrokey 3 also provides these applications:

  • py:class:nitrokey.nk3.secrets_app.SecretsApp: bezpieczne przechowywanie haseł i danych uwierzytelniających

Więcej informacji można znaleźć w odnośniku API dla klas aplikacji.