nitrokey.trussed¶
Submodules
桁架式装置物体¶
- class nitrokey.trussed.TrussedBase¶
用于使用 Trussed 框架并运行固件或引导加载程序的硝基设备的基类。
- abstract close()¶
- 返回类型:
None
- abstract reboot()¶
- 返回类型:
bool
- abstract property name: str¶
- abstract property path: str¶
- abstract property pid: int¶
- property vid: int¶
- class nitrokey.trussed.TrussedDevice¶
基类:
TrussedBase
- __init__(device, fido2_certs)¶
- 参数:
device (CtapHidDevice)
fido2_certs (Sequence[Fido2Certs])
- 返回类型:
None
- close()¶
- 返回类型:
None
- abstract classmethod from_device(device)¶
- 参数:
device (CtapHidDevice)
- 返回类型:
T
- classmethod list()¶
- 返回类型:
list[T]
- classmethod open(path)¶
- 参数:
path (str)
- 返回类型:
T | None
- reboot()¶
- 返回类型:
bool
- wink()¶
- 返回类型:
None
- property path: str¶
- class nitrokey.trussed.TrussedBootloader¶
基类:
TrussedBase
- abstract update(image, callback=None)¶
- 参数:
image (bytes)
callback (Callable[[int, int], None] | None)
- 返回类型:
None
Update Container Objects¶
- nitrokey.trussed.parse_firmware_image(variant, data, model)¶
- 参数:
- 返回类型:
- class nitrokey.trussed.FirmwareContainer¶
FirmwareContainer(version: nitrokey.trussed._utils.Version, pynitrokey: Optional[nitrokey.trussed._utils.Version], images:Dict[nitrokey.trussed._bootloader.Variant, bytes])
- __init__(version, pynitrokey, images)¶
- class nitrokey.trussed.FirmwareMetadata¶
FirmwareMetadata(version: nitrokey.trussed._utils.Version, signed_by:Optional[str] = None, signed_by_nitrokey: bool = False)
- __init__(version, signed_by=None, signed_by_nitrokey=False)¶
- 参数:
version (Version)
signed_by (str | None)
signed_by_nitrokey (bool)
- 返回类型:
None
- signed_by: str | None = None¶
- signed_by_nitrokey: bool = False¶
实用工具¶
- class nitrokey.trussed.App¶
基类:
Enum
用于桁架式应用程序的特定供应商 CTAPHID 命令。
- ADMIN = 114¶
- PROVISIONER = 113¶
- SECRETS = 112¶
- class nitrokey.trussed.Fido2Certs¶
Fido2Certs(start: Nitrokey.trussed._utils.Version, hashes: list[str])
- static get(certs, version)¶
- 参数:
certs (Sequence[Fido2Certs])
version (Version)
- 返回类型:
Fido2Certs | None
- hashes: list[str]¶
- class nitrokey.trussed.Model¶
基类:
Enum
- NK3 = 'Nitrokey 3'¶
- NKPK = 'Nitrokey Passkey'¶
- property firmware_pattern: Pattern[str]¶
- property firmware_repository: Repository¶
- class nitrokey.trussed.Uuid¶
UUID of a Nitrokey Trussed device.
- __init__(value)¶
- 参数:
value (int)
- 返回类型:
None
- value: int¶
- class nitrokey.trussed.Version¶
硝基桁架设备的版本,遵循 Semantic Versioning 2.0.0。
某些版本信息来源(即旧设备返回的版本和固件二进制文件)不包含预发布组件。 这些实例用*complete=False* 标记。 该标记会影响比较: 只有当两个版本实例都完整时,才会考虑发布前版本。
>>> Version(1, 0, 0) Version(major=1, minor=0, patch=0, pre=None, build=None) >>> Version.from_str("1.0.0") Version(major=1, minor=0, patch=0, pre=None, build=None) >>> Version.from_v_str("v1.0.0") Version(major=1, minor=0, patch=0, pre=None, build=None) >>> Version(1, 0, 0, "rc.1") Version(major=1, minor=0, patch=0, pre='rc.1', build=None) >>> Version.from_str("1.0.0-rc.1") Version(major=1, minor=0, patch=0, pre='rc.1', build=None) >>> Version.from_v_str("v1.0.0-rc.1") Version(major=1, minor=0, patch=0, pre='rc.1', build=None) >>> Version.from_v_str("v1.0.0-rc.1+git") Version(major=1, minor=0, patch=0, pre='rc.1', build='git')
- __init__(major, minor, patch, pre=None, build=None, complete=False)¶
- 参数:
major (int)
minor (int)
patch (int)
pre (str | None)
build (str | None)
complete (bool)
- 返回类型:
None
- core()¶
返回该版本的核心部分,即不包含预发布和构建组件的版本。
>>> Version(1, 0, 0).core() Version(major=1, minor=0, patch=0, pre=None, build=None) >>> Version(1, 0, 0, "rc.1").core() Version(major=1, minor=0, patch=0, pre=None, build=None) >>> Version(1, 0, 0, "rc.1", "git").core() Version(major=1, minor=0, patch=0, pre=None, build=None)
- 返回类型:
- build: str | None = None¶
- complete: bool = False¶
- major: int¶
- minor: int¶
- patch: int¶
- pre: str | None = None¶
Trussed Exceptions¶
- class nitrokey.trussed.TrussedException¶
基类:
Exception