Usage Guide

Nitrokey Python SDK は現在、Nitrokey 3 (nitrokey.nk3.NK3) と Nitrokey パスキー (nitrokey.nkpk.NKPK) デバイスをサポートしています。両デバイスは同じプラットフォームである Trussed をベースにしているため、同じ基本クラス nitrokey.trussed.TrussedDevice を共有しています。

トラスデバイスはファームウェアアップデートを適用するために使用されるブートローダモードに再起動することができます。ブートローダモードのデバイスには nitrokey.nk3.NK3Bootloadernitrokey.nkpk.NKPKBootloader (基本クラス 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}")

接続したいモデルがわかっている場合は、 nitrokey.nk3 または nitrokey.nkpk モジュールの``list`` と``open`` 関数を使うこともできます。デバイスのタイプもわかっている場合、 nitrokey.nk3.NK3, nitrokey.nkpk.NKPK, nitrokey.nk3.NK3Bootloader, nitrokey.nkpk.NKPKBootloader クラスの``list`` と``open`` メソッドを使用することができます。

Using Applications

ニトロキーPython SDKは、すべてのTrussedデバイスに対してこれらのアプリケーションをサポートしています:

The Nitrokey 3 also provides these applications:

詳細については、アプリケーション・クラスのAPIリファレンスを参照してください。