Usage Guide

Nitrokey Python SDK pašlaik atbalsta Nitrokey 3 (nitrokey.nk3.NK3) un Nitrokey Passkey (nitrokey.nkpk.NKPK) ierīces. Abu ierīču pamatā ir viena un tā pati platforma Trussed, tāpēc tām ir viena un tā pati bāzes klase nitrokey.trussed.TrussedDevice.

Šasijas ierīces var pārstartēt bootloader režīmā, ko izmanto, lai piemērotu programmaparatūras atjauninājumus. Ierīcēm bootloader režīmā var piekļūt, izmantojot nitrokey.nk3.NK3Bootloader un nitrokey.nkpk.NKPKBootloader (bāzes klases 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}")

Ja jūs zināt modeli, ar kuru vēlaties izveidot savienojumu, varat izmantot arī list un open funkcijas moduļos nitrokey.nk3 vai nitrokey.nkpk. Ja ir zināms arī ierīces tips, var izmantot list un open metodes nitrokey.nk3.NK3, nitrokey.nkpk.NKPK, nitrokey.nk3.NK3Bootloader un nitrokey.nkpk.NKPKBootloader klasēs.

Using Applications

Nitrokey Python SDK atbalsta šīs lietojumprogrammas visām Trussed ierīcēm:

The Nitrokey 3 also provides these applications:

Lai iegūtu vairāk informācijas, skatiet API atsauces uz lietojumprogrammu klasēm.