Usage Guide¶
Nitrokey Python SDK v súčasnosti podporuje zariadenia Nitrokey 3 (nitrokey.nk3.NK3) a Nitrokey Passkey (nitrokey.nkpk.NKPK). Obe zariadenia sú založené na rovnakej platforme Trussed, a preto majú rovnakú základnú triedu nitrokey.trussed.TrussedDevice.
Zariadenia s priehradkami možno reštartovať do režimu zavádzača, ktorý sa používa na aktualizácie firmvéru. Zariadenia v režime zavádzača možno sprístupniť pomocou nitrokey.nk3.NK3Bootloader a nitrokey.nkpk.NKPKBootloader (základná trieda 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}")
If you know the model you want to connect to, you can also use the list and open functions in the nitrokey.nk3 or nitrokey.nkpk modules.
If you also know the type of the device, you can use the list and open methods of the nitrokey.nk3.NK3, nitrokey.nkpk.NKPK, nitrokey.nk3.NK3Bootloader and nitrokey.nkpk.NKPKBootloader classes.
Using Applications¶
Nitrokey Python SDK podporuje tieto aplikácie pre všetky zariadenia Trussed:
nitrokey.trussed.admin_app.AdminApp: prístup k metadátam zariadenia a správa stavu konfigurácie zariadenianitrokey.trussed.provisioner_app.ProvisionerApp: nastavenie zariadenia v režime provisioner (platí len pre zariadenia Hacker)
The Nitrokey 3 also provides these applications:
nitrokey.nk3.secrets_app.SecretsApp: bezpečné ukladanie hesiel a poverení
Viac informácií nájdete v referencii API pre triedy aplikácie.