nitrokey.trussed

Submodules

Indlejrede objekter

class nitrokey.trussed.TrussedBase

Basisklasse for Nitrokey-enheder, der bruger Trussed-frameworket og kører firmwaren eller bootloaderen.

abstract close()
Returtype:

None

abstract reboot()
Returtype:

bool

abstract uuid()
Returtype:

Uuid | None

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

Baser: TrussedBase

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

  • fido2_certs (Sequence[Fido2Certs])

Returtype:

None

close()
Returtype:

None

abstract classmethod from_device(device)
Parametre:

device (CtapHidDevice)

Returtype:

T

classmethod list()
Returtype:

list[T]

classmethod open(path)
Parametre:

path (str)

Returtype:

T | None

reboot()
Returtype:

bool

uuid()
Returtype:

Uuid | None

wink()
Returtype:

None

property path: str
class nitrokey.trussed.TrussedBootloader

Baser: TrussedBase

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

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

Returtype:

None

abstract property variant: Variant

Update Container Objects

nitrokey.trussed.parse_firmware_image(variant, data, model)
Parametre:
Returtype:

FirmwareMetadata

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)
Parametre:
Returtype:

None

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

  • model (Model)

Returtype:

FirmwareContainer

images: Dict[Variant, bytes]
pynitrokey: Version | None
version: Version
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)
Parametre:
  • version (Version)

  • signed_by (str | None)

  • signed_by_nitrokey (bool)

Returtype:

None

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

Baser: Enum

classmethod from_str(s)
Parametre:

s (str)

Returtype:

Variant

LPC55 = 'lpc55'
NRF52 = 'nrf52'

Utility-objekter

class nitrokey.trussed.App

Baser: Enum

Leverandørspecifikke CTAPHID-kommandoer til Trussed-apps.

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

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

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

  • hashes (list[str])

Returtype:

None

static get(certs, version)
Parametre:
Returtype:

Fido2Certs | None

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

Baser: Enum

classmethod from_str(s)
Parametre:

s (str)

Returtype:

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

value (int)

Returtype:

None

value: int
class nitrokey.trussed.Version

Versionen af en Nitrokey Trussed-enhed i henhold til Semantic Versioning 2.0.0.

Nogle kilder til versionsoplysninger, nemlig den version, der returneres af ældre enheder og firmware-binærfiler, indeholder ikke pre-release-komponenten. Disse tilfælde er markeret med complete=False. Dette flag påvirker sammenligningen: Pre-release-versionen tages kun i betragtning, hvis begge versionsforekomster er komplette.

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

  • minor (int)

  • patch (int)

  • pre (str | None)

  • build (str | None)

  • complete (bool)

Returtype:

None

core()

Returnerer kernedelen af denne version, dvs. versionen uden pre-release- og build-komponenterne.

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

Version

classmethod from_int(version)
Parametre:

version (int)

Returtype:

Version

classmethod from_str(s)
Parametre:

s (str)

Returtype:

Version

classmethod from_v_str(s)
Parametre:

s (str)

Returtype:

Version

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

Trussed Exceptions

class nitrokey.trussed.TrussedException

Baser: Exception

class nitrokey.trussed.TimeoutException

Baser: TrussedException

__init__()
Returtype:

None