1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00
trezor-firmware/docs/api.md
2016-09-27 17:24:10 +02:00

4.6 KiB

#TREZOR OS API

Syntax used below is a valid Python function declaration with type hints defined in PEP 0484.

##trezor.crypto

###trezor.crypto.base58

def trezor.crypto.base58.encode(data: bytes) -> str
def trezor.crypto.base58.decode(string: str) -> bytes
def trezor.crypto.base58.encode_check(data: bytes) -> str
def trezor.crypto.base58.decode_check(string: str) -> bytes

###trezor.crypto.curve

####trezor.crypto.curve.ed25519

def trezor.crypto.curve.ed25519.publickey(self, secret_key: bytes) -> bytes
def trezor.crypto.curve.ed25519.sign(self, secret_key: bytes, message: bytes) -> bytes
def trezor.crypto.curve.ed25519.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool

####trezor.crypto.curve.nist256p1

def trezor.crypto.curve.nist256p1.publickey(self, secret_key: bytes, compressed: bool=True) -> bytes
def trezor.crypto.curve.nist256p1.sign(self, secret_key: bytes, message: bytes) -> bytes
def trezor.crypto.curve.nist256p1.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool

####trezor.crypto.curve.secp256k1

def trezor.crypto.curve.secp256k1.publickey(self, secret_key: bytes, compressed: bool=True) -> bytes
def trezor.crypto.curve.secp256k1.sign(self, secret_key: bytes, message: bytes) -> bytes
def trezor.crypto.curve.secp256k1.verify(self, public_key: bytes, signature: bytes, message: bytes) -> bool

###trezor.crypto.hashlib

####trezor.crypto.hashlib.ripemd160

def trezor.crypto.hashlib.ripemd160(self, data: bytes=None) -> Ripemd160
def Ripemd160.update(self, data: bytes) -> None
def Ripemd160.digest(self) -> bytes

####trezor.crypto.hashlib.sha256

def trezor.crypto.hashlib.sha256(self, data: bytes=None) -> Sha256
def Sha256.update(self, data: bytes) -> None
def Sha256.digest(self) -> bytes

####trezor.crypto.hashlib.sha512

def trezor.crypto.hashlib.sha512(self, data: bytes=None) -> Sha512
def Sha512.hash(self, data: bytes) -> None
def Sha512.digest(self) -> bytes

####trezor.crypto.hashlib.sha3_256

def trezor.crypto.hashlib.sha3_256(self, data: bytes=None) -> Sha3_256
def Sha3_256.update(self, data: bytes) -> None
def Sha3_256.digest(self) -> bytes

####trezor.crypto.hashlib.sha3_512

def trezor.crypto.hashlib.sha3_512(self, data: bytes=None) -> Sha3_512
def Sha3_512.update(self, data: bytes) -> None
def Sha3_512.digest(self) -> bytes

###trezor.crypto.hmac

def trezor.crypto.hmac.new(key, msg, digestmod) -> Hmac

##trezor.msg

def trezor.msg.send(self, message) -> int
def trezor.msg.select(self, timeout_us: int) -> tuple

##trezor.ui

def trezor.ui.rgbcolor(r: int, g: int, b: int) -> int
def trezor.ui.lerpi(a: int, b: int, t: float) -> int
def trezor.ui.blend(ca: int, cb: int, t: float) -> int
def trezor.ui.animate_pulse(func, ca, cb, speed=200000, delay=30000)

###trezor.ui.display

def trezor.ui.display.bar(self, x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None) -> None
def trezor.ui.display.blit(self, x: int, y: int, w: int, h: int, data: bytes) -> None
def trezor.ui.display.image(self, x: int, y: int, image: bytes) -> None
def trezor.ui.display.icon(self, x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
def trezor.ui.display.text(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
def trezor.ui.display.text_center(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
def trezor.ui.display.text_right(self, x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
def trezor.ui.display.text_width(self, text: bytes, font: int) -> int
def trezor.ui.display.qrcode(self, x: int, y: int, data: bytes, scale: int) -> None
def trezor.ui.display.loader(self, progress: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None
def trezor.ui.display.orientation(self, degrees: int) -> None
def trezor.ui.display.raw(self, reg: int, data: bytes) -> None
def trezor.ui.display.backlight(self, val: int) -> None