nitrokey.trussed

Submodules

Föremål med trussed Device

class nitrokey.trussed.TrussedBase

Basklass för Nitrokey-enheter som använder Trussed-ramverket och kör den fasta programvaran eller startladdaren.

abstract close()
Returtyp:

None

abstract reboot()
Returtyp:

bool

abstract uuid()
Returtyp:

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)
Parametrar:
  • device (CtapHidDevice)

  • fido2_certs (Sequence[Fido2Certs])

Returtyp:

None

close()
Returtyp:

None

abstract classmethod from_device(device)
Parametrar:

device (CtapHidDevice)

Returtyp:

T

classmethod list()
Returtyp:

list[T]

classmethod open(path)
Parametrar:

path (str)

Returtyp:

T | None

reboot()
Returtyp:

bool

uuid()
Returtyp:

Uuid | None

wink()
Returtyp:

None

property path: str
class nitrokey.trussed.TrussedBootloader

Baser: TrussedBase

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

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

Returtyp:

None

abstract property variant: Variant

Update Container Objects

nitrokey.trussed.parse_firmware_image(variant, data, model)
Parametrar:
Returtyp:

FirmwareMetadata

class nitrokey.trussed.FirmwareContainer

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

__init__(version, pynitrokey, images)
Parametrar:
Returtyp:

None

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

  • model (Model)

Returtyp:

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

  • signed_by (str | None)

  • signed_by_nitrokey (bool)

Returtyp:

None

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

Bas: Enum

classmethod from_str(s)
Parametrar:

s (str)

Returtyp:

Variant

LPC55 = 'lpc55'
NRF52 = 'nrf52'

Verktygsobjekt

class nitrokey.trussed.App

Bas: Enum

Leverantörsspecifika CTAPHID-kommandon för Trussed apps.

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

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

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

  • hashes (list[str])

Returtyp:

None

static get(certs, version)
Parametrar:
Returtyp:

Fido2Certs | None

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

Bas: Enum

classmethod from_str(s)
Parametrar:

s (str)

Returtyp:

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

value (int)

Returtyp:

None

value: int
class nitrokey.trussed.Version

Versionen av en Nitrokey Trussed-enhet, enligt Semantic Versioning 2.0.0.

Vissa källor för versionsinformation, nämligen den version som returneras av äldre enheter och firmware-binärfiler, innehåller inte pre-release-komponenten. Dessa fall är markerade med complete=False. Denna flagga påverkar jämförelsen: Förhandsversionen beaktas endast om båda versionsinstanserna är kompletta.

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

  • minor (int)

  • patch (int)

  • pre (str | None)

  • build (str | None)

  • complete (bool)

Returtyp:

None

core()

Returnerar kärndelen av denna version, dvs. versionen utan pre-release- och build-komponenterna.

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

Version

classmethod from_int(version)
Parametrar:

version (int)

Returtyp:

Version

classmethod from_str(s)
Parametrar:

s (str)

Returtyp:

Version

classmethod from_v_str(s)
Parametrar:

s (str)

Returtyp:

Version

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

Trussed Exceptions

class nitrokey.trussed.TrussedException

Bas: Exception

class nitrokey.trussed.TimeoutException

Bas: TrussedException

__init__()
Returtyp:

None