1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

wallet: fix GetPublicKey msg, regenerate protobuf

This commit is contained in:
Pavol Rusnak 2017-05-08 18:04:05 +02:00
parent 9e42a45b10
commit e6d93c5933
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
12 changed files with 103 additions and 70 deletions

View File

@ -5,12 +5,17 @@ from trezor.utils import unimport
async def layout_get_public_key(session_id, msg):
from trezor.messages.HDNodeType import HDNodeType
from trezor.messages.PublicKey import PublicKey
from ..common import coins
from ..common import seed
node = await seed.get_root(session_id)
node.derive_path(msg.address_n or ())
address_n = msg.address_n or ()
coin_name = msg.coin_name or 'Bitcoin'
node_xpub = node.serialize_public()
node = await seed.get_root(session_id)
node.derive_path(address_n)
coin = coins.by_name(coin_name)
node_xpub = node.serialize_public(coin.xpub_magic)
node_type = HDNodeType(
depth=node.depth(),
child_num=node.child_num(),

View File

@ -11,4 +11,7 @@ class CoinType(p.MessageType):
6: ('address_type_p2wpkh', p.UVarintType, 0), # default=6
7: ('address_type_p2wsh', p.UVarintType, 0), # default=10
8: ('signed_message_header', p.UnicodeType, 0),
9: ('xpub_magic', p.UVarintType, 0), # default=76067358
10: ('xprv_magic', p.UVarintType, 0), # default=76066276
11: ('segwit', p.BoolType, 0),
}

View File

@ -11,5 +11,6 @@ class EthereumSignTx(p.MessageType):
6: ('value', p.BytesType, 0),
7: ('data_initial_chunk', p.BytesType, 0),
8: ('data_length', p.UVarintType, 0),
9: ('chain_id', p.UVarintType, 0),
}
MESSAGE_WIRE_TYPE = 58

View File

@ -0,0 +1,9 @@
# Automatically generated by pb2py
import protobuf as p
class FirmwareRequest(p.MessageType):
FIELDS = {
1: ('offset', p.UVarintType, 0),
2: ('length', p.UVarintType, 0),
}
MESSAGE_WIRE_TYPE = 8

View File

@ -4,5 +4,6 @@ import protobuf as p
class FirmwareUpload(p.MessageType):
FIELDS = {
1: ('payload', p.BytesType, 0), # required
2: ('hash', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 7

View File

@ -6,5 +6,6 @@ class GetPublicKey(p.MessageType):
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('ecdsa_curve_name', p.UnicodeType, 0),
3: ('show_display', p.BoolType, 0),
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
}
MESSAGE_WIRE_TYPE = 11

View File

@ -7,6 +7,7 @@ ChangePin = const(4)
WipeDevice = const(5)
FirmwareErase = const(6)
FirmwareUpload = const(7)
FirmwareRequest = const(8)
GetEntropy = const(9)
Entropy = const(10)
GetPublicKey = const(11)

View File

@ -9,6 +9,7 @@ class RecoveryDevice(p.MessageType):
4: ('language', p.UnicodeType, 0), # default=u'english'
5: ('label', p.UnicodeType, 0),
6: ('enforce_wordlist', p.BoolType, 0),
7: ('u2f_counter', p.UVarintType, 0),
8: ('type', p.UVarintType, 0),
9: ('u2f_counter', p.UVarintType, 0),
}
MESSAGE_WIRE_TYPE = 45

View File

@ -0,0 +1,3 @@
# Automatically generated by pb2py
ScrambledWords = const(0)
Matrix = const(1)

View File

@ -2,4 +2,7 @@
import protobuf as p
class WordRequest(p.MessageType):
FIELDS = {
1: ('type', p.UVarintType, 0),
}
MESSAGE_WIRE_TYPE = 46

View File

@ -0,0 +1,4 @@
# Automatically generated by pb2py
Plain = const(0)
Matrix9 = const(1)
Matrix6 = const(2)

View File

@ -1,66 +1,67 @@
WordRequest = 46
DebugLinkMemoryWrite = 112
ButtonAck = 27
MessageSignature = 40
EthereumAddress = 57
EthereumTxAck = 60
Ping = 1
EncryptedMessage = 50
DebugLinkStop = 103
EstimateTxSize = 43
GetPublicKey = 11
GetFeatures = 55
GetECDHSessionKey = 61
PinMatrixRequest = 18
ClearSession = 24
LoadDevice = 13
VerifyMessage = 39
EthereumSignTx = 58
PassphraseRequest = 41
TxAck = 22
ChangePin = 4
DebugLinkLog = 104
FirmwareErase = 6
TxRequest = 21
EthereumGetAddress = 56
DebugLinkState = 102
EthereumTxRequest = 59
FirmwareUpload = 7
SignedIdentity = 54
Failure = 3
EntropyRequest = 35
ApplySettings = 25
DebugLinkFlashErase = 113
Address = 30
Initialize = 0
PinMatrixAck = 19
SetU2FCounter = 63
SignTx = 15
DebugLinkGetState = 101
Success = 2
ResetDevice = 14
WordAck = 47
SimpleSignTx = 16
GetAddress = 29
TxSize = 44
PassphraseAck = 42
SignMessage = 38
DecryptedMessage = 52
DecryptMessage = 51
GetEntropy = 9
EntropyAck = 36
WipeDevice = 5
CipherKeyValue = 23
Features = 17
RecoveryDevice = 45
SignIdentity = 53
DebugLinkDecision = 100
CipheredKeyValue = 48
ButtonRequest = 26
PublicKey = 12
DebugLinkMemory = 111
Entropy = 10
Cancel = 20
DebugLinkMemoryRead = 110
EncryptMessage = 49
ECDHSessionKey = 62
WordRequest = const(46)
DebugLinkMemoryWrite = const(112)
ButtonAck = const(27)
MessageSignature = const(40)
EthereumAddress = const(57)
EthereumTxAck = const(60)
Ping = const(1)
EncryptedMessage = const(50)
DebugLinkStop = const(103)
EstimateTxSize = const(43)
GetPublicKey = const(11)
GetFeatures = const(55)
GetECDHSessionKey = const(61)
PinMatrixRequest = const(18)
ClearSession = const(24)
LoadDevice = const(13)
VerifyMessage = const(39)
EthereumSignTx = const(58)
PassphraseRequest = const(41)
TxAck = const(22)
ChangePin = const(4)
DebugLinkLog = const(104)
FirmwareErase = const(6)
TxRequest = const(21)
EthereumGetAddress = const(56)
DebugLinkState = const(102)
EthereumTxRequest = const(59)
FirmwareUpload = const(7)
SignedIdentity = const(54)
Failure = const(3)
EntropyRequest = const(35)
ApplySettings = const(25)
DebugLinkFlashErase = const(113)
Address = const(30)
Initialize = const(0)
PinMatrixAck = const(19)
SetU2FCounter = const(63)
SignTx = const(15)
DebugLinkGetState = const(101)
FirmwareRequest = const(8)
Success = const(2)
ResetDevice = const(14)
WordAck = const(47)
SimpleSignTx = const(16)
GetAddress = const(29)
TxSize = const(44)
PassphraseAck = const(42)
SignMessage = const(38)
DecryptedMessage = const(52)
DecryptMessage = const(51)
GetEntropy = const(9)
EntropyAck = const(36)
WipeDevice = const(5)
CipherKeyValue = const(23)
Features = const(17)
RecoveryDevice = const(45)
SignIdentity = const(53)
DebugLinkDecision = const(100)
CipheredKeyValue = const(48)
ButtonRequest = const(26)
PublicKey = const(12)
DebugLinkMemory = const(111)
Entropy = const(10)
Cancel = const(20)
DebugLinkMemoryRead = const(110)
EncryptMessage = const(49)
ECDHSessionKey = const(62)