Code documentation
ragger.backend
ragger.backend.interface
Interface contract
The contract a backend must respect:
Response management policy
To change the behavior of the backend on response APDU, one can
tinker with the RaisePolicy
:
ragger.error
- class ragger.error.ExceptionRAPDU(status: int, data: bytes = b'')
Depending on the
RaisePolicy
, communication with an application can raise this exception.Just like
RAPDU
, it is composed of two attributes:status
(int
), which is extracted from the two last bytes of the response,data
(bytes
), which is the entire response payload, except the two last bytes.
ragger.firmware
Most Ragger
high-level class needs to know which Firmware they
should expect. This is declared with this class:
- class ragger.firmware.Firmware(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- NANOS = 1
- NANOSP = 2
- NANOX = 3
- STAX = 4
- FLEX = 5
- property device: str
A proxy property for
Firmware.name
. This property is deprecated. It is advise to not use it.
- property is_nano
States if the firmware’s name starts with ‘nano’ or not.
- property name: str
Returns the name of the current firmware’s device
ragger.utils
ragger.utils.structs
- class ragger.utils.structs.RAPDU(status: int, data: bytes)
The dataclass containing the application’s response of an APDU from the client to the application.
It is composed of two attributes:
status
(int
): from the two last bytes of the payload. Common values are 0x9000 for success, other being errors.data
(bytes
): the rest of the response (the entire payload without the two last bytes)