Usage Guide¶
Nitrokey Python SDK は現在、Nitrokey 3 (nitrokey.nk3.NK3) と Nitrokey パスキー (nitrokey.nkpk.NKPK) デバイスをサポートしています。両デバイスは同じプラットフォームである Trussed をベースにしているため、同じ基本クラス nitrokey.trussed.TrussedDevice を共有しています。
トラスデバイスはファームウェアアップデートを適用するために使用されるブートローダモードに再起動することができます。ブートローダモードのデバイスには nitrokey.nk3.NK3Bootloader と nitrokey.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デバイスに対してこれらのアプリケーションをサポートしています:
nitrokey.trussed.admin_app.AdminApp: デバイスのメタデータにアクセスし、デバイスの設定状態を管理します。nitrokey.trussed.provisioner_app.ProvisionerApp: プロビジョナーモードでデバイスをセットアップする (Hacker デバイスにのみ適用可能)
The Nitrokey 3 also provides these applications:
nitrokey.nk3.secrets_app.SecretsApp: パスワードと認証情報を安全に保存する
詳細については、アプリケーション・クラスのAPIリファレンスを参照してください。