diff --git a/docs/api.md b/docs/api.md index c5a67dbf9e..3baf011b76 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,26 +1,33 @@ #TREZOR OS API +Syntax used below are valid Python function declarations with anotations defined in [PEP 3107](https://www.python.org/dev/peps/pep-3107/). + ##trezor.crypto ###trezor.crypto.ed25519 -``` -def to_public(bytes[32] secret_key) => bytes[32] public_key +``` python +def to_public(secret_key: bytes[32]) -> bytes[32]: # public_key -def sign(bytes message, bytes[32] secret_key, bytes[32] public_key = None) => bytes[64] signature +def sign(message: bytes, secret_key: bytes[32], public_key: bytes[32] = None) -> bytes[64]: # signature -def verify(bytes message, bytes[32] public_key, bytes[64] signature) => bool valid +def verify(message: bytes, public_key: bytes[32], signature: bytes[64]) -> bool: # valid ``` ###trezor.crypto.func -``` -aes() -base58() -hmac() -sha256() -ripemd160() -pbkdf2() +``` python +def aes(): + +def base58(): + +def hmac(): + +def sha256(): + +def ripemd160(): + +def pbkdf2(): ``` ###trezor.crypto.hd @@ -29,22 +36,22 @@ pbkdf2() ###trezor.crypto.nistp256 -``` -def to_public() +``` python +def to_public(secret_key: bytes[32]) -> bytes[33]: # public_key -def sign() +def sign(message: bytes, secret_key: bytes[32], public_key: bytes[33] = None) -> bytes[65]: # signature -def verify() +def verify(message: bytes, public_key: bytes[33], signature: bytes[65]) -> bool: # valid ``` ###trezor.crypto.secp256k1 -``` -def to_public() +``` python +def to_public(secret_key: bytes[32]) -> bytes[33]: # public_key -def sign() +def sign(message: bytes, secret_key: bytes[32], public_key: bytes[33] = None) -> bytes[65]: # signature -def verify() +def verify(message: bytes, public_key: bytes[33], signature: bytes[65]) -> bool: # valid ``` ##trezor.hw @@ -53,9 +60,11 @@ def verify() ###trezor.hw.display -##trezor.qrenc +##trezor.utils -``` +###trezor.utils.qrenc + +``` python enum QRLEVEL { L = 0, M = 1, @@ -63,5 +72,5 @@ enum QRLEVEL { H = 3, } -def encode(bytes source, qrlevel level = QRLEVEL.H) => bool[][] qrcode +def encode(source: bytes, level: QRLEVEL = QRLEVEL.H) -> bool[][]: # qrcode ```