nitrokey.trussed

Submodules

Apparaat Objecten

class nitrokey.trussed.TrussedBase

Basisklasse voor Nitrokey apparaten die het Trussed framework gebruiken en de firmware of de bootloader uitvoeren.

abstract close()
Return type:

None

abstract reboot()
Return type:

bool

abstract uuid()
Return type:

Uuid | None

abstract property name: str
abstract property path: str
abstract property pid: int
property vid: int
class nitrokey.trussed.TrussedDevice

Basisklassen: TrussedBase

__init__(device, fido2_certs)
Parameters:
  • device (CtapHidDevice)

  • fido2_certs (Sequence[Fido2Certs])

Return type:

None

close()
Return type:

None

abstract classmethod from_device(device)
Parameters:

device (CtapHidDevice)

Return type:

T

classmethod list()
Return type:

list[T]

classmethod open(path)
Parameters:

path (str)

Return type:

T | None

reboot()
Return type:

bool

uuid()
Return type:

Uuid | None

wink()
Return type:

None

property path: str
class nitrokey.trussed.TrussedBootloader

Basisklassen: TrussedBase

abstract update(image, callback=None)
Parameters:
  • image (bytes)

  • callback (Callable[[int, int], None] | None)

Return type:

None

abstract property variant: Variant

Update Container Objects

nitrokey.trussed.parse_firmware_image(variant, data, model)
Parameters:
Return type:

FirmwareMetadata

class nitrokey.trussed.FirmwareContainer

FirmwareContainer(versie: nitrokey.trussed._utils.Version, pynitrokey: Optioneel[nitrokey.trussed._utils.Version], images: Dict[nitrokey.trussed._bootloader.Variant, bytes])

__init__(version, pynitrokey, images)
Parameters:
Return type:

None

classmethod parse(path, model)
Parameters:
  • path (str | BytesIO)

  • model (Model)

Return type:

FirmwareContainer

images: Dict[Variant, bytes]
pynitrokey: Version | None
version: Version
class nitrokey.trussed.FirmwareMetadata

FirmwareMetadata(versie: nitrokey.trussed._utils.Version, signed_by: Optional[str] = None, signed_by_nitrokey: bool = False)

__init__(version, signed_by=None, signed_by_nitrokey=False)
Parameters:
  • version (Version)

  • signed_by (str | None)

  • signed_by_nitrokey (bool)

Return type:

None

signed_by: str | None = None
signed_by_nitrokey: bool = False
version: Version
class nitrokey.trussed.Variant

Basisklassen: Enum

classmethod from_str(s)
Parameters:

s (str)

Return type:

Variant

LPC55 = 'lpc55'
NRF52 = 'nrf52'

Objecten

class nitrokey.trussed.App

Basisklassen: Enum

Verkoperspecifieke CTAPHID-commando’s voor toepassingen met truss.

ADMIN = 114
PROVISIONER = 113
SECRETS = 112
class nitrokey.trussed.Fido2Certs

Fido2Certs(start: nitrokey.trussed._utils.Version, hashes: lijst[str])

__init__(start, hashes)
Parameters:
  • start (Version)

  • hashes (list[str])

Return type:

None

static get(certs, version)
Parameters:
Return type:

Fido2Certs | None

hashes: list[str]
start: Version
class nitrokey.trussed.Model

Basisklassen: Enum

classmethod from_str(s)
Parameters:

s (str)

Return type:

Model

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)
Parameters:

value (int)

Return type:

None

value: int
class nitrokey.trussed.Version

De versie van een Nitrokey Trussed apparaat, volgens Semantic Versioning 2.0.0.

Sommige bronnen voor versie-informatie, namelijk de versie die teruggestuurd wordt door oudere apparaten en de firmware binaries, bevatten niet de pre-release component. Deze instanties worden gemarkeerd met complete=False. Deze vlag beïnvloedt de vergelijking: Er wordt alleen rekening gehouden met de pre-release versie als beide versie-instanties compleet zijn.

>>> 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)
Parameters:
  • major (int)

  • minor (int)

  • patch (int)

  • pre (str | None)

  • build (str | None)

  • complete (bool)

Return type:

None

core()

Geeft het kerngedeelte van deze versie terug, d. w. z. de versie zonder de pre-release en build componenten.

>>> 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)
Return type:

Version

classmethod from_int(version)
Parameters:

version (int)

Return type:

Version

classmethod from_str(s)
Parameters:

s (str)

Return type:

Version

classmethod from_v_str(s)
Parameters:

s (str)

Return type:

Version

build: str | None = None
complete: bool = False
major: int
minor: int
patch: int
pre: str | None = None

Trussed Exceptions

class nitrokey.trussed.TrussedException

Basisklassen: Exception

class nitrokey.trussed.TimeoutException

Basisklassen: TrussedException

__init__()
Return type:

None