1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 17:18:29 +00:00
trezor-firmware/docs/api.md

78 lines
1.9 KiB
Markdown
Raw Normal View History

2016-02-01 10:52:57 +00:00
#TREZOR OS API
2016-02-01 16:48:26 +00:00
Auxiliary classes used to tighten the type checking.
2016-02-01 14:16:33 +00:00
2016-02-01 16:18:04 +00:00
``` python
2016-02-02 17:40:29 +00:00
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
2016-02-01 16:18:04 +00:00
```
2016-02-02 17:25:27 +00:00
Syntax used below is a valid Python function declaration with type hints defined in [PEP 0484](https://www.python.org/dev/peps/pep-0484/).
2016-02-01 16:48:26 +00:00
##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
```
2016-04-03 13:26:49 +00:00
##trezor.ui
2016-02-01 10:52:57 +00:00
2016-04-03 13:26:49 +00:00
###trezor.ui.display
2016-02-01 10:52:57 +00:00
2016-02-01 14:16:33 +00:00
``` python
2016-04-03 13:26:49 +00:00
trezor.ui.display.bar(self, x: int, y: int, w: int, h: int, color: int) -> None
2016-02-01 10:52:57 +00:00
2016-04-03 13:26:49 +00:00
trezor.ui.display.blit(self, x: int, y: int, w: int, h: int, data: bytes) -> None
2016-02-01 10:52:57 +00:00
2016-04-03 13:26:49 +00:00
trezor.ui.display.image(self, x: int, y: int, image: bytes) -> None
2016-02-01 16:48:26 +00:00
2016-04-03 13:26:49 +00:00
trezor.ui.display.icon(self, x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
2016-02-01 16:48:26 +00:00
2016-04-03 13:26:49 +00:00
trezor.ui.display.text(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
2016-02-01 16:48:26 +00:00
2016-04-03 23:46:46 +00:00
trezor.ui.display.qrcode(self, x: int, y: int, data: bytes, scale: int) -> None
2016-04-03 13:26:49 +00:00
trezor.ui.display.orientation(self, degrees: int) -> None
2016-02-01 16:48:26 +00:00
trezor.ui.display.raw(self, reg: int, data: bytes) -> None
2016-02-01 16:48:26 +00:00
2016-04-03 13:26:49 +00:00
trezor.ui.display.backlight(self, val: int) -> None
2016-02-01 16:48:26 +00:00
```
2016-04-03 13:26:49 +00:00
###trezor.ui.touch
2016-02-01 16:48:26 +00:00
``` python
2016-04-04 13:14:30 +00:00
trezor.ui.touch.start(self, callback) -> None
2016-02-01 16:48:26 +00:00
2016-04-04 13:14:30 +00:00
trezor.ui.touch.move(self, callback) -> None
2016-02-01 16:18:04 +00:00
2016-04-04 13:14:30 +00:00
trezor.ui.touch.end(self, callback) -> None
2016-02-01 10:52:57 +00:00
```