1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-25 07:48:10 +00:00

update api

This commit is contained in:
Pavol Rusnak 2016-02-01 15:16:33 +01:00
parent a8d5432fd5
commit 0c954769d5
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -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
```