mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
remove cpython wrapper - it's broken and nobody uses it
This commit is contained in:
parent
9a8df5a4bb
commit
c80f0fbc52
5
.gitignore
vendored
5
.gitignore
vendored
@ -4,11 +4,6 @@
|
||||
test-openssl
|
||||
test_speed
|
||||
tests
|
||||
build-*/
|
||||
build/
|
||||
dist/
|
||||
MANIFEST
|
||||
TrezorCrypto.c
|
||||
*.os
|
||||
*.so
|
||||
*.pyc
|
||||
|
@ -1,2 +0,0 @@
|
||||
include *.h
|
||||
include *.pyx
|
@ -1,40 +0,0 @@
|
||||
cimport c
|
||||
cimport cython
|
||||
|
||||
cdef class HDNode:
|
||||
|
||||
cdef c.HDNode node
|
||||
|
||||
def __init__(self, str serialized = None, HDNode copyfrom = None):
|
||||
if copyfrom is not None:
|
||||
self.node = copyfrom.node
|
||||
elif serialized is not None:
|
||||
if c.hdnode_deserialize(serialized, cython.address(self.node)) != 0:
|
||||
raise Exception('Invalid xpub/xprv provided')
|
||||
else:
|
||||
raise Exception('Need to provide serialized or node parameter')
|
||||
|
||||
def xpub(self):
|
||||
cdef char[120] string
|
||||
c.hdnode_serialize_public(cython.address(self.node), string, 120)
|
||||
return str(string)
|
||||
|
||||
def xprv(self):
|
||||
cdef char[120] string
|
||||
c.hdnode_serialize_private(cython.address(self.node), string, 120)
|
||||
return str(string)
|
||||
|
||||
def address(self):
|
||||
cdef char[40] string
|
||||
c.ecdsa_get_address(self.node.public_key, 0, string, 40)
|
||||
return str(string)
|
||||
|
||||
def public_ckd(self, int i):
|
||||
x = HDNode(copyfrom=self)
|
||||
c.hdnode_public_ckd(cython.address(x.node), i)
|
||||
return x
|
||||
|
||||
def private_ckd(self, unsigned int i):
|
||||
x = HDNode(copyfrom=self)
|
||||
c.hdnode_private_ckd(cython.address(x.node), i)
|
||||
return x
|
22
c.pxd
22
c.pxd
@ -1,22 +0,0 @@
|
||||
from libc.stdint cimport uint32_t, uint8_t
|
||||
|
||||
cdef extern from "bip32.h":
|
||||
|
||||
ctypedef struct HDNode:
|
||||
uint8_t public_key[33]
|
||||
|
||||
int hdnode_from_seed(const uint8_t *seed, int seed_len, const char *curve, HDNode *out)
|
||||
|
||||
int hdnode_private_ckd(HDNode *inout, uint32_t i)
|
||||
|
||||
int hdnode_public_ckd(HDNode *inout, uint32_t i)
|
||||
|
||||
void hdnode_serialize_public(const HDNode *node, char *str, int strsize)
|
||||
|
||||
void hdnode_serialize_private(const HDNode *node, char *str, int strsize)
|
||||
|
||||
int hdnode_deserialize(const char *str, HDNode *node)
|
||||
|
||||
cdef extern from "ecdsa.h":
|
||||
|
||||
void ecdsa_get_address(const uint8_t *pub_key, uint8_t version, char *addr, int addrsize)
|
Loading…
Reference in New Issue
Block a user