1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00
trezor-firmware/docs/api.md
Pavol Rusnak 0f2670f12e
add trezor.crypto
split modTrezorUi into more files
2016-09-27 17:22:48 +02:00

78 lines
1.9 KiB
Markdown

#TREZOR OS API
Auxiliary classes used to tighten the type checking.
``` python
bytes16 = bytes # bytes variable of exactly 16 bytes
bytes20 = bytes # bytes variable of exactly 20 bytes
bytes21 = bytes # bytes variable of exactly 21 bytes
bytes24 = bytes # bytes variable of exactly 24 bytes
bytes32 = bytes # bytes variable of exactly 32 bytes
bytes33 = bytes # bytes variable of exactly 33 bytes
bytes64 = bytes # bytes variable of exactly 64 bytes
bytes65 = bytes # bytes variable of exactly 65 bytes
```
Syntax used below is a valid Python function declaration with type hints defined in [PEP 0484](https://www.python.org/dev/peps/pep-0484/).
##trezor.crypto
###trezor.crypto.base58
``` python
def trezor.crypto.base58.encode(data: bytes) -> str
def trezor.crypto.base58.decode(string: str) -> bytes
```
##trezor.msg
``` python
def trezor.msg.receive(callback) -> None
def trezor.msg.send(message) -> None
```
##trezor.protobuf
``` python
def trezor.protobuf.encode(message) -> bytes
def trezor.protobuf.decode(data: bytes) -> object
```
##trezor.ui
###trezor.ui.display
``` python
trezor.ui.display.bar(self, x: int, y: int, w: int, h: int, color: int) -> None
trezor.ui.display.blit(self, x: int, y: int, w: int, h: int, data: bytes) -> None
trezor.ui.display.image(self, x: int, y: int, image: bytes) -> None
trezor.ui.display.icon(self, x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
trezor.ui.display.text(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
trezor.ui.display.qrcode(self, x: int, y: int, data: bytes, scale: int) -> None
trezor.ui.display.orientation(self, degrees: int) -> None
trezor.ui.display.raw(self, reg: int, data: bytes) -> None
trezor.ui.display.backlight(self, val: int) -> None
```
###trezor.ui.touch
``` python
trezor.ui.touch.start(self, callback) -> None
trezor.ui.touch.move(self, callback) -> None
trezor.ui.touch.end(self, callback) -> None
```