2016-02-01 02:52:57 -08:00
|
|
|
#TREZOR OS API
|
|
|
|
|
2016-02-02 09:25:27 -08: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 08:48:26 -08:00
|
|
|
|
2016-04-04 11:48:48 -07:00
|
|
|
##trezor.crypto
|
|
|
|
|
|
|
|
###trezor.crypto.base58
|
|
|
|
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.base58.encode(data: bytes) -> str
|
2016-05-05 12:41:03 -07:00
|
|
|
```
|
|
|
|
``` python
|
2016-04-04 11:48:48 -07:00
|
|
|
def trezor.crypto.base58.decode(string: str) -> bytes
|
|
|
|
```
|
2016-04-04 07:12:13 -07:00
|
|
|
``` python
|
2016-05-05 12:41:03 -07:00
|
|
|
def trezor.crypto.base58.encode_check(data: bytes) -> str
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.base58.decode_check(string: str) -> bytes
|
2016-04-04 07:12:13 -07:00
|
|
|
```
|
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
###trezor.crypto.curve
|
2016-04-04 07:12:13 -07:00
|
|
|
|
|
|
|
``` python
|
2016-05-05 12:41:03 -07:00
|
|
|
def trezor.crypto.curve.ed25519.publickey(self, secret_key: bytes) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.ed25519.sign(self, secret_key: bytes, message: bytes) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.ed25519.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool
|
|
|
|
```
|
2016-04-04 07:12:13 -07:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.nist256p1.publickey(self, secret_key: bytes, compressed: bool=True) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.nist256p1.sign(self, secret_key: bytes, message: bytes) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.nist256p1.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool
|
2016-04-04 07:12:13 -07:00
|
|
|
```
|
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.secp256k1.publickey(self, secret_key: bytes, compressed: bool=True) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.secp256k1.sign(self, secret_key: bytes, message: bytes) -> bytes
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.crypto.curve.secp256k1.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool
|
|
|
|
```
|
2016-02-01 02:52:57 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
###trezor.crypto.hashlib
|
2016-02-01 02:52:57 -08:00
|
|
|
|
2016-02-01 06:16:33 -08:00
|
|
|
``` python
|
2016-05-05 12:41:03 -07:00
|
|
|
def trezor.crypto.hashlib.ripemd160(self, data: bytes=None) -> Ripemd160
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Ripemd160.update(self, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Ripemd160.digest(self) -> bytes
|
|
|
|
```
|
2016-02-01 02:52:57 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.hashlib.sha256(self, data: bytes=None) -> Sha256
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha256.update(self, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha256.digest(self) -> bytes
|
|
|
|
```
|
2016-02-01 02:52:57 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.hashlib.sha512(self, data: bytes=None) -> Sha512
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha512.hash(self, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha512.digest(self) -> bytes
|
|
|
|
```
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.hashlib.sha3_256(self, data: bytes=None) -> Sha3_256
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha3_256.update(self, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha3_256.digest(self) -> bytes
|
|
|
|
```
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.hashlib.sha3_512(self, data: bytes=None) -> Sha3_512
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha3_512.update(self, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def Sha3_512.digest(self) -> bytes
|
|
|
|
```
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
###trezor.crypto.hmac
|
2016-04-03 16:46:46 -07:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.crypto.hmac.new(key, msg, digestmod) -> Hmac
|
|
|
|
```
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
##trezor.msg
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.msg.send(self, message) -> int
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.msg.select(self, timeout_us: int) -> tuple
|
2016-02-01 08:48:26 -08:00
|
|
|
```
|
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
##trezor.ui
|
2016-02-01 08:48:26 -08:00
|
|
|
|
|
|
|
``` python
|
2016-05-05 12:41:03 -07:00
|
|
|
def trezor.ui.rgbcolor(r: int, g: int, b: int) -> int
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.lerpi(a: int, b: int, t: float) -> int
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.blend(ca: int, cb: int, t: float) -> int
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.animate_pulse(func, ca, cb, speed=200000, delay=30000)
|
|
|
|
```
|
2016-02-01 08:48:26 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
###trezor.ui.display
|
2016-02-01 08:18:04 -08:00
|
|
|
|
2016-05-05 12:41:03 -07:00
|
|
|
``` python
|
|
|
|
def trezor.ui.display.bar(self, x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.blit(self, x: int, y: int, w: int, h: int, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.image(self, x: int, y: int, image: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.icon(self, x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.text(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.text_center(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.text_right(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.text_width(self, text: bytes, font: int) -> int
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.qrcode(self, x: int, y: int, data: bytes, scale: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.loader(self, progress: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.orientation(self, degrees: int) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.raw(self, reg: int, data: bytes) -> None
|
|
|
|
```
|
|
|
|
``` python
|
|
|
|
def trezor.ui.display.backlight(self, val: int) -> None
|
2016-02-01 02:52:57 -08:00
|
|
|
```
|