Usage Guide

L’SDK Nitrokey Python supporta attualmente i dispositivi Nitrokey 3 (nitrokey.nk3.NK3) e Nitrokey Chiave d’accesso (nitrokey.nkpk.NKPK). Entrambi i dispositivi sono basati sulla stessa piattaforma, Trussed, e quindi condividono la stessa classe base nitrokey.trussed.TrussedDevice.

I dispositivi collegati possono essere riavviati in modalità bootloader, utilizzata per applicare gli aggiornamenti del firmware. È possibile accedere ai dispositivi in modalità bootloader utilizzando nitrokey.nk3.NK3Bootloader e nitrokey.nkpk.NKPKBootloader (classe base 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}")

Se si conosce il modello a cui ci si vuole collegare, si possono usare anche le funzioni list e open dei moduli nitrokey.nk3 o nitrokey.nkpk. Se si conosce anche il tipo di dispositivo, si possono usare i metodi list e open delle classi nitrokey.nk3.NK3, nitrokey.nkpk.NKPK, nitrokey.nk3.NK3Bootloader e nitrokey.nkpk.NKPKBootloader.

Using Applications

L’SDK Nitrokey Python supporta queste applicazioni per tutti i dispositivi Trussed:

The Nitrokey 3 also provides these applications:

Per ulteriori informazioni, consultare il riferimento API per le classi di applicazioni.