nitrokey.trussed

Submodules

Kronšteinu ierīču objekti

class nitrokey.trussed.TrussedBase

Bāzes klase Nitrokey ierīcēm, kas izmanto Trussed ietvaru un kurās darbojas programmaparatūra vai bootloader.

abstract close()
Atgriežamais tips:

None

abstract reboot()
Atgriežamais tips:

bool

abstract uuid()
Atgriežamais tips:

Uuid | None

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

Bāzes: TrussedBase

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

  • fido2_certs (Sequence[Fido2Certs])

Atgriežamais tips:

None

close()
Atgriežamais tips:

None

abstract classmethod from_device(device)
Parametri:

device (CtapHidDevice)

Atgriežamais tips:

T

classmethod list()
Atgriežamais tips:

list[T]

classmethod open(path)
Parametri:

path (str)

Atgriežamais tips:

T | None

reboot()
Atgriežamais tips:

bool

uuid()
Atgriežamais tips:

Uuid | None

wink()
Atgriežamais tips:

None

property path: str
class nitrokey.trussed.TrussedBootloader

Bāzes: TrussedBase

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

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

Atgriežamais tips:

None

abstract property variant: Variant

Update Container Objects

nitrokey.trussed.parse_firmware_image(variant, data, model)
Parametri:
Atgriežamais tips:

FirmwareMetadata

class nitrokey.trussed.FirmwareContainer

FirmwareContainer(version: nitrokey.trussed._utils.Version, pynitrokey: Optional[nitrokey.trussed._utils.Version], images: Dict[nitrokey.trussed._bootloader.Variant, baiti])

__init__(version, pynitrokey, images)
Parametri:
Atgriežamais tips:

None

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

  • model (Model)

Atgriežamais tips:

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)
Parametri:
  • version (Version)

  • signed_by (str | None)

  • signed_by_nitrokey (bool)

Atgriežamais tips:

None

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

Bases: Enum

classmethod from_str(s)
Parametri:

s (str)

Atgriežamais tips:

Variant

LPC55 = 'lpc55'
NRF52 = 'nrf52'

Lietderīgie objekti

class nitrokey.trussed.App

Bases: Enum

Pārdevējam specifiskas CTAPHID komandas kopņu lietojumprogrammām.

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

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

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

  • hashes (list[str])

Atgriežamais tips:

None

static get(certs, version)
Parametri:
Atgriežamais tips:

Fido2Certs | None

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

Bases: Enum

classmethod from_str(s)
Parametri:

s (str)

Atgriežamais tips:

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

value (int)

Atgriežamais tips:

None

value: int
class nitrokey.trussed.Version

Nitrokey Trussed ierīces versija saskaņā ar semantisko versiju 2.0.0.

Dažos versijas informācijas avotos, proti, vecāku ierīču atgrieztajās versijās un programmaparatūras binārajās kopijās, nav pirmsizlaides komponenta. Šie gadījumi ir atzīmēti ar complete=False. Šis karodziņš ietekmē salīdzināšanu: Pirmsizlaides versija tiek ņemta vērā tikai tad, ja abi versijas gadījumi ir pilnīgi.

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

  • minor (int)

  • patch (int)

  • pre (str | None)

  • build (str | None)

  • complete (bool)

Atgriežamais tips:

None

core()

Atgriež šīs versijas pamatdaļu, t. i., versiju bez pirmsizlaides un izveides komponentiem.

>>> 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)
Atgriežamais tips:

Version

classmethod from_int(version)
Parametri:

version (int)

Atgriežamais tips:

Version

classmethod from_str(s)
Parametri:

s (str)

Atgriežamais tips:

Version

classmethod from_v_str(s)
Parametri:

s (str)

Atgriežamais tips:

Version

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

Trussed Exceptions

class nitrokey.trussed.TrussedException

Bases: Exception

class nitrokey.trussed.TimeoutException

Bāzes: TrussedException

__init__()
Atgriežamais tips:

None