mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
accounts/usbwallet: add webusb trezor support (#19588)
This commit is contained in:
parent
100ea1c8e0
commit
2e21b96101
17 changed files with 4814 additions and 5506 deletions
|
|
@ -25,7 +25,7 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/accounts"
|
"github.com/XinFinOrg/XDPoSChain/accounts"
|
||||||
"github.com/XinFinOrg/XDPoSChain/event"
|
"github.com/XinFinOrg/XDPoSChain/event"
|
||||||
"github.com/XinFinOrg/XDPoSChain/log"
|
"github.com/XinFinOrg/XDPoSChain/log"
|
||||||
"github.com/karalabe/hid"
|
"github.com/karalabe/usb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
|
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
|
||||||
|
|
@ -84,14 +84,20 @@ func NewLedgerHub() (*Hub, error) {
|
||||||
}, 0xffa0, 0, newLedgerDriver)
|
}, 0xffa0, 0, newLedgerDriver)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTrezorHub creates a new hardware wallet manager for Trezor devices.
|
// NewTrezorHubWithHID creates a new hardware wallet manager for Trezor devices.
|
||||||
func NewTrezorHub() (*Hub, error) {
|
func NewTrezorHubWithHID() (*Hub, error) {
|
||||||
return newHub(TrezorScheme, 0x534c, []uint16{0x0001 /* Trezor 1 */}, 0xff00, 0, newTrezorDriver)
|
return newHub(TrezorScheme, 0x534c, []uint16{0x0001 /* Trezor HID */}, 0xff00, 0, newTrezorDriver)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTrezorHubWithWebUSB creates a new hardware wallet manager for Trezor devices with
|
||||||
|
// firmware version > 1.8.0
|
||||||
|
func NewTrezorHubWithWebUSB() (*Hub, error) {
|
||||||
|
return newHub(TrezorScheme, 0x1209, []uint16{0x53c1 /* Trezor WebUSB */}, 0xffff /* No usage id on webusb, don't match unset (0) */, 0, newTrezorDriver)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newHub creates a new hardware wallet manager for generic USB devices.
|
// newHub creates a new hardware wallet manager for generic USB devices.
|
||||||
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) {
|
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) {
|
||||||
if !hid.Supported() {
|
if !usb.Supported() {
|
||||||
return nil, errors.New("unsupported platform")
|
return nil, errors.New("unsupported platform")
|
||||||
}
|
}
|
||||||
hub := &Hub{
|
hub := &Hub{
|
||||||
|
|
@ -133,7 +139,7 @@ func (hub *Hub) refreshWallets() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Retrieve the current list of USB wallet devices
|
// Retrieve the current list of USB wallet devices
|
||||||
var devices []hid.DeviceInfo
|
var devices []usb.DeviceInfo
|
||||||
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
// hidapi on Linux opens the device during enumeration to retrieve some infos,
|
// hidapi on Linux opens the device during enumeration to retrieve some infos,
|
||||||
|
|
@ -148,8 +154,18 @@ func (hub *Hub) refreshWallets() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, info := range hid.Enumerate(hub.vendorID, 0) {
|
infos, err := usb.Enumerate(hub.vendorID, 0)
|
||||||
|
if err != nil {
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
// See rationale before the enumeration why this is needed and only on Linux.
|
||||||
|
hub.commsLock.Unlock()
|
||||||
|
}
|
||||||
|
log.Error("error enumerating USB enumeration: ", "code", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, info := range infos {
|
||||||
for _, id := range hub.productIDs {
|
for _, id := range hub.productIDs {
|
||||||
|
// Windows and Macos use UsageID matching, Linux uses Interface matching
|
||||||
if info.ProductID == id && (info.UsagePage == hub.usageID || info.Interface == hub.endpointID) {
|
if info.ProductID == id && (info.UsagePage == hub.usageID || info.Interface == hub.endpointID) {
|
||||||
devices = append(devices, info)
|
devices = append(devices, info)
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,13 @@ func (w *trezorDriver) trezorDerive(derivationPath []uint32) (common.Address, er
|
||||||
if _, err := w.trezorExchange(&trezor.EthereumGetAddress{AddressN: derivationPath}, address); err != nil {
|
if _, err := w.trezorExchange(&trezor.EthereumGetAddress{AddressN: derivationPath}, address); err != nil {
|
||||||
return common.Address{}, err
|
return common.Address{}, err
|
||||||
}
|
}
|
||||||
return common.BytesToAddress(address.GetAddress()), nil
|
if addr := address.GetAddressBin(); len(addr) > 0 { // Older firmwares use binary fomats
|
||||||
|
return common.BytesToAddress(addr), nil
|
||||||
|
}
|
||||||
|
if addr := address.GetAddressHex(); len(addr) > 0 { // Newer firmwares use hexadecimal fomats
|
||||||
|
return common.HexToAddress(addr), nil
|
||||||
|
}
|
||||||
|
return common.Address{}, errors.New("missing derived address")
|
||||||
}
|
}
|
||||||
|
|
||||||
// trezorSign sends the transaction to the Trezor wallet, and waits for the user
|
// trezorSign sends the transaction to the Trezor wallet, and waits for the user
|
||||||
|
|
@ -212,7 +218,10 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
|
||||||
DataLength: &length,
|
DataLength: &length,
|
||||||
}
|
}
|
||||||
if to := tx.To(); to != nil {
|
if to := tx.To(); to != nil {
|
||||||
request.To = (*to)[:] // Non contract deploy, set recipient explicitly
|
// Non contract deploy, set recipient explicitly
|
||||||
|
hex := to.Hex()
|
||||||
|
request.ToHex = &hex // Newer firmwares (old will ignore)
|
||||||
|
request.ToBin = (*to)[:] // Older firmwares (new will ignore)
|
||||||
}
|
}
|
||||||
if length > 1024 { // Send the data chunked if that was requested
|
if length > 1024 { // Send the data chunked if that was requested
|
||||||
request.DataInitialChunk, data = data[:1024], data[1024:]
|
request.DataInitialChunk, data = data[:1024], data[1024:]
|
||||||
|
|
|
||||||
811
accounts/usbwallet/trezor/messages-common.pb.go
Normal file
811
accounts/usbwallet/trezor/messages-common.pb.go
Normal file
|
|
@ -0,0 +1,811 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: messages-common.proto
|
||||||
|
|
||||||
|
package trezor
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
math "math"
|
||||||
|
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type Failure_FailureType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
Failure_Failure_UnexpectedMessage Failure_FailureType = 1
|
||||||
|
Failure_Failure_ButtonExpected Failure_FailureType = 2
|
||||||
|
Failure_Failure_DataError Failure_FailureType = 3
|
||||||
|
Failure_Failure_ActionCancelled Failure_FailureType = 4
|
||||||
|
Failure_Failure_PinExpected Failure_FailureType = 5
|
||||||
|
Failure_Failure_PinCancelled Failure_FailureType = 6
|
||||||
|
Failure_Failure_PinInvalid Failure_FailureType = 7
|
||||||
|
Failure_Failure_InvalidSignature Failure_FailureType = 8
|
||||||
|
Failure_Failure_ProcessError Failure_FailureType = 9
|
||||||
|
Failure_Failure_NotEnoughFunds Failure_FailureType = 10
|
||||||
|
Failure_Failure_NotInitialized Failure_FailureType = 11
|
||||||
|
Failure_Failure_PinMismatch Failure_FailureType = 12
|
||||||
|
Failure_Failure_FirmwareError Failure_FailureType = 99
|
||||||
|
)
|
||||||
|
|
||||||
|
var Failure_FailureType_name = map[int32]string{
|
||||||
|
1: "Failure_UnexpectedMessage",
|
||||||
|
2: "Failure_ButtonExpected",
|
||||||
|
3: "Failure_DataError",
|
||||||
|
4: "Failure_ActionCancelled",
|
||||||
|
5: "Failure_PinExpected",
|
||||||
|
6: "Failure_PinCancelled",
|
||||||
|
7: "Failure_PinInvalid",
|
||||||
|
8: "Failure_InvalidSignature",
|
||||||
|
9: "Failure_ProcessError",
|
||||||
|
10: "Failure_NotEnoughFunds",
|
||||||
|
11: "Failure_NotInitialized",
|
||||||
|
12: "Failure_PinMismatch",
|
||||||
|
99: "Failure_FirmwareError",
|
||||||
|
}
|
||||||
|
|
||||||
|
var Failure_FailureType_value = map[string]int32{
|
||||||
|
"Failure_UnexpectedMessage": 1,
|
||||||
|
"Failure_ButtonExpected": 2,
|
||||||
|
"Failure_DataError": 3,
|
||||||
|
"Failure_ActionCancelled": 4,
|
||||||
|
"Failure_PinExpected": 5,
|
||||||
|
"Failure_PinCancelled": 6,
|
||||||
|
"Failure_PinInvalid": 7,
|
||||||
|
"Failure_InvalidSignature": 8,
|
||||||
|
"Failure_ProcessError": 9,
|
||||||
|
"Failure_NotEnoughFunds": 10,
|
||||||
|
"Failure_NotInitialized": 11,
|
||||||
|
"Failure_PinMismatch": 12,
|
||||||
|
"Failure_FirmwareError": 99,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Failure_FailureType) Enum() *Failure_FailureType {
|
||||||
|
p := new(Failure_FailureType)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Failure_FailureType) String() string {
|
||||||
|
return proto.EnumName(Failure_FailureType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Failure_FailureType) UnmarshalJSON(data []byte) error {
|
||||||
|
value, err := proto.UnmarshalJSONEnum(Failure_FailureType_value, data, "Failure_FailureType")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*x = Failure_FailureType(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Failure_FailureType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{1, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Type of button request
|
||||||
|
type ButtonRequest_ButtonRequestType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ButtonRequest_ButtonRequest_Other ButtonRequest_ButtonRequestType = 1
|
||||||
|
ButtonRequest_ButtonRequest_FeeOverThreshold ButtonRequest_ButtonRequestType = 2
|
||||||
|
ButtonRequest_ButtonRequest_ConfirmOutput ButtonRequest_ButtonRequestType = 3
|
||||||
|
ButtonRequest_ButtonRequest_ResetDevice ButtonRequest_ButtonRequestType = 4
|
||||||
|
ButtonRequest_ButtonRequest_ConfirmWord ButtonRequest_ButtonRequestType = 5
|
||||||
|
ButtonRequest_ButtonRequest_WipeDevice ButtonRequest_ButtonRequestType = 6
|
||||||
|
ButtonRequest_ButtonRequest_ProtectCall ButtonRequest_ButtonRequestType = 7
|
||||||
|
ButtonRequest_ButtonRequest_SignTx ButtonRequest_ButtonRequestType = 8
|
||||||
|
ButtonRequest_ButtonRequest_FirmwareCheck ButtonRequest_ButtonRequestType = 9
|
||||||
|
ButtonRequest_ButtonRequest_Address ButtonRequest_ButtonRequestType = 10
|
||||||
|
ButtonRequest_ButtonRequest_PublicKey ButtonRequest_ButtonRequestType = 11
|
||||||
|
ButtonRequest_ButtonRequest_MnemonicWordCount ButtonRequest_ButtonRequestType = 12
|
||||||
|
ButtonRequest_ButtonRequest_MnemonicInput ButtonRequest_ButtonRequestType = 13
|
||||||
|
ButtonRequest_ButtonRequest_PassphraseType ButtonRequest_ButtonRequestType = 14
|
||||||
|
ButtonRequest_ButtonRequest_UnknownDerivationPath ButtonRequest_ButtonRequestType = 15
|
||||||
|
)
|
||||||
|
|
||||||
|
var ButtonRequest_ButtonRequestType_name = map[int32]string{
|
||||||
|
1: "ButtonRequest_Other",
|
||||||
|
2: "ButtonRequest_FeeOverThreshold",
|
||||||
|
3: "ButtonRequest_ConfirmOutput",
|
||||||
|
4: "ButtonRequest_ResetDevice",
|
||||||
|
5: "ButtonRequest_ConfirmWord",
|
||||||
|
6: "ButtonRequest_WipeDevice",
|
||||||
|
7: "ButtonRequest_ProtectCall",
|
||||||
|
8: "ButtonRequest_SignTx",
|
||||||
|
9: "ButtonRequest_FirmwareCheck",
|
||||||
|
10: "ButtonRequest_Address",
|
||||||
|
11: "ButtonRequest_PublicKey",
|
||||||
|
12: "ButtonRequest_MnemonicWordCount",
|
||||||
|
13: "ButtonRequest_MnemonicInput",
|
||||||
|
14: "ButtonRequest_PassphraseType",
|
||||||
|
15: "ButtonRequest_UnknownDerivationPath",
|
||||||
|
}
|
||||||
|
|
||||||
|
var ButtonRequest_ButtonRequestType_value = map[string]int32{
|
||||||
|
"ButtonRequest_Other": 1,
|
||||||
|
"ButtonRequest_FeeOverThreshold": 2,
|
||||||
|
"ButtonRequest_ConfirmOutput": 3,
|
||||||
|
"ButtonRequest_ResetDevice": 4,
|
||||||
|
"ButtonRequest_ConfirmWord": 5,
|
||||||
|
"ButtonRequest_WipeDevice": 6,
|
||||||
|
"ButtonRequest_ProtectCall": 7,
|
||||||
|
"ButtonRequest_SignTx": 8,
|
||||||
|
"ButtonRequest_FirmwareCheck": 9,
|
||||||
|
"ButtonRequest_Address": 10,
|
||||||
|
"ButtonRequest_PublicKey": 11,
|
||||||
|
"ButtonRequest_MnemonicWordCount": 12,
|
||||||
|
"ButtonRequest_MnemonicInput": 13,
|
||||||
|
"ButtonRequest_PassphraseType": 14,
|
||||||
|
"ButtonRequest_UnknownDerivationPath": 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x ButtonRequest_ButtonRequestType) Enum() *ButtonRequest_ButtonRequestType {
|
||||||
|
p := new(ButtonRequest_ButtonRequestType)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x ButtonRequest_ButtonRequestType) String() string {
|
||||||
|
return proto.EnumName(ButtonRequest_ButtonRequestType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ButtonRequest_ButtonRequestType) UnmarshalJSON(data []byte) error {
|
||||||
|
value, err := proto.UnmarshalJSONEnum(ButtonRequest_ButtonRequestType_value, data, "ButtonRequest_ButtonRequestType")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*x = ButtonRequest_ButtonRequestType(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ButtonRequest_ButtonRequestType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{2, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Type of PIN request
|
||||||
|
type PinMatrixRequest_PinMatrixRequestType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
PinMatrixRequest_PinMatrixRequestType_Current PinMatrixRequest_PinMatrixRequestType = 1
|
||||||
|
PinMatrixRequest_PinMatrixRequestType_NewFirst PinMatrixRequest_PinMatrixRequestType = 2
|
||||||
|
PinMatrixRequest_PinMatrixRequestType_NewSecond PinMatrixRequest_PinMatrixRequestType = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
var PinMatrixRequest_PinMatrixRequestType_name = map[int32]string{
|
||||||
|
1: "PinMatrixRequestType_Current",
|
||||||
|
2: "PinMatrixRequestType_NewFirst",
|
||||||
|
3: "PinMatrixRequestType_NewSecond",
|
||||||
|
}
|
||||||
|
|
||||||
|
var PinMatrixRequest_PinMatrixRequestType_value = map[string]int32{
|
||||||
|
"PinMatrixRequestType_Current": 1,
|
||||||
|
"PinMatrixRequestType_NewFirst": 2,
|
||||||
|
"PinMatrixRequestType_NewSecond": 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x PinMatrixRequest_PinMatrixRequestType) Enum() *PinMatrixRequest_PinMatrixRequestType {
|
||||||
|
p := new(PinMatrixRequest_PinMatrixRequestType)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x PinMatrixRequest_PinMatrixRequestType) String() string {
|
||||||
|
return proto.EnumName(PinMatrixRequest_PinMatrixRequestType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PinMatrixRequest_PinMatrixRequestType) UnmarshalJSON(data []byte) error {
|
||||||
|
value, err := proto.UnmarshalJSONEnum(PinMatrixRequest_PinMatrixRequestType_value, data, "PinMatrixRequest_PinMatrixRequestType")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*x = PinMatrixRequest_PinMatrixRequestType(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (PinMatrixRequest_PinMatrixRequestType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{4, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Success of the previous request
|
||||||
|
// @end
|
||||||
|
type Success struct {
|
||||||
|
Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Success) Reset() { *m = Success{} }
|
||||||
|
func (m *Success) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Success) ProtoMessage() {}
|
||||||
|
func (*Success) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Success) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Success.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Success) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Success.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *Success) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Success.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *Success) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Success.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Success) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Success.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Success proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Success) GetMessage() string {
|
||||||
|
if m != nil && m.Message != nil {
|
||||||
|
return *m.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Failure of the previous request
|
||||||
|
// @end
|
||||||
|
type Failure struct {
|
||||||
|
Code *Failure_FailureType `protobuf:"varint,1,opt,name=code,enum=hw.trezor.messages.common.Failure_FailureType" json:"code,omitempty"`
|
||||||
|
Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Failure) Reset() { *m = Failure{} }
|
||||||
|
func (m *Failure) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Failure) ProtoMessage() {}
|
||||||
|
func (*Failure) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Failure) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Failure.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Failure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Failure.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *Failure) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Failure.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *Failure) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Failure.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Failure) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Failure.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Failure proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Failure) GetCode() Failure_FailureType {
|
||||||
|
if m != nil && m.Code != nil {
|
||||||
|
return *m.Code
|
||||||
|
}
|
||||||
|
return Failure_Failure_UnexpectedMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Failure) GetMessage() string {
|
||||||
|
if m != nil && m.Message != nil {
|
||||||
|
return *m.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Device is waiting for HW button press.
|
||||||
|
// @auxstart
|
||||||
|
// @next ButtonAck
|
||||||
|
type ButtonRequest struct {
|
||||||
|
Code *ButtonRequest_ButtonRequestType `protobuf:"varint,1,opt,name=code,enum=hw.trezor.messages.common.ButtonRequest_ButtonRequestType" json:"code,omitempty"`
|
||||||
|
Data *string `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ButtonRequest) Reset() { *m = ButtonRequest{} }
|
||||||
|
func (m *ButtonRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ButtonRequest) ProtoMessage() {}
|
||||||
|
func (*ButtonRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ButtonRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ButtonRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ButtonRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ButtonRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ButtonRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ButtonRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ButtonRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ButtonRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ButtonRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ButtonRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ButtonRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *ButtonRequest) GetCode() ButtonRequest_ButtonRequestType {
|
||||||
|
if m != nil && m.Code != nil {
|
||||||
|
return *m.Code
|
||||||
|
}
|
||||||
|
return ButtonRequest_ButtonRequest_Other
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ButtonRequest) GetData() string {
|
||||||
|
if m != nil && m.Data != nil {
|
||||||
|
return *m.Data
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Computer agrees to wait for HW button press
|
||||||
|
// @auxend
|
||||||
|
type ButtonAck struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ButtonAck) Reset() { *m = ButtonAck{} }
|
||||||
|
func (m *ButtonAck) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ButtonAck) ProtoMessage() {}
|
||||||
|
func (*ButtonAck) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ButtonAck) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ButtonAck.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ButtonAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ButtonAck.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *ButtonAck) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ButtonAck.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *ButtonAck) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ButtonAck.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ButtonAck) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ButtonAck.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ButtonAck proto.InternalMessageInfo
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
|
||||||
|
// @auxstart
|
||||||
|
// @next PinMatrixAck
|
||||||
|
type PinMatrixRequest struct {
|
||||||
|
Type *PinMatrixRequest_PinMatrixRequestType `protobuf:"varint,1,opt,name=type,enum=hw.trezor.messages.common.PinMatrixRequest_PinMatrixRequestType" json:"type,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PinMatrixRequest) Reset() { *m = PinMatrixRequest{} }
|
||||||
|
func (m *PinMatrixRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PinMatrixRequest) ProtoMessage() {}
|
||||||
|
func (*PinMatrixRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PinMatrixRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PinMatrixRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PinMatrixRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PinMatrixRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PinMatrixRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PinMatrixRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PinMatrixRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PinMatrixRequest) GetType() PinMatrixRequest_PinMatrixRequestType {
|
||||||
|
if m != nil && m.Type != nil {
|
||||||
|
return *m.Type
|
||||||
|
}
|
||||||
|
return PinMatrixRequest_PinMatrixRequestType_Current
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Computer responds with encoded PIN
|
||||||
|
// @auxend
|
||||||
|
type PinMatrixAck struct {
|
||||||
|
Pin *string `protobuf:"bytes,1,req,name=pin" json:"pin,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PinMatrixAck) Reset() { *m = PinMatrixAck{} }
|
||||||
|
func (m *PinMatrixAck) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PinMatrixAck) ProtoMessage() {}
|
||||||
|
func (*PinMatrixAck) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PinMatrixAck) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PinMatrixAck.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PinMatrixAck.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixAck) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PinMatrixAck.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixAck) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PinMatrixAck.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PinMatrixAck) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PinMatrixAck.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PinMatrixAck proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PinMatrixAck) GetPin() string {
|
||||||
|
if m != nil && m.Pin != nil {
|
||||||
|
return *m.Pin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Device awaits encryption passphrase
|
||||||
|
// @auxstart
|
||||||
|
// @next PassphraseAck
|
||||||
|
type PassphraseRequest struct {
|
||||||
|
OnDevice *bool `protobuf:"varint,1,opt,name=on_device,json=onDevice" json:"on_device,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseRequest) Reset() { *m = PassphraseRequest{} }
|
||||||
|
func (m *PassphraseRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PassphraseRequest) ProtoMessage() {}
|
||||||
|
func (*PassphraseRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PassphraseRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PassphraseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PassphraseRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PassphraseRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PassphraseRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PassphraseRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PassphraseRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PassphraseRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PassphraseRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PassphraseRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PassphraseRequest) GetOnDevice() bool {
|
||||||
|
if m != nil && m.OnDevice != nil {
|
||||||
|
return *m.OnDevice
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Send passphrase back
|
||||||
|
// @next PassphraseStateRequest
|
||||||
|
type PassphraseAck struct {
|
||||||
|
Passphrase *string `protobuf:"bytes,1,opt,name=passphrase" json:"passphrase,omitempty"`
|
||||||
|
State []byte `protobuf:"bytes,2,opt,name=state" json:"state,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseAck) Reset() { *m = PassphraseAck{} }
|
||||||
|
func (m *PassphraseAck) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PassphraseAck) ProtoMessage() {}
|
||||||
|
func (*PassphraseAck) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseAck) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PassphraseAck.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PassphraseAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PassphraseAck.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PassphraseAck) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PassphraseAck.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PassphraseAck) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PassphraseAck.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PassphraseAck) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PassphraseAck.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PassphraseAck proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PassphraseAck) GetPassphrase() string {
|
||||||
|
if m != nil && m.Passphrase != nil {
|
||||||
|
return *m.Passphrase
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseAck) GetState() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.State
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Device awaits passphrase state
|
||||||
|
// @next PassphraseStateAck
|
||||||
|
type PassphraseStateRequest struct {
|
||||||
|
State []byte `protobuf:"bytes,1,opt,name=state" json:"state,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseStateRequest) Reset() { *m = PassphraseStateRequest{} }
|
||||||
|
func (m *PassphraseStateRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PassphraseStateRequest) ProtoMessage() {}
|
||||||
|
func (*PassphraseStateRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseStateRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PassphraseStateRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PassphraseStateRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PassphraseStateRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PassphraseStateRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PassphraseStateRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PassphraseStateRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PassphraseStateRequest) GetState() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.State
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Send passphrase state back
|
||||||
|
// @auxend
|
||||||
|
type PassphraseStateAck struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseStateAck) Reset() { *m = PassphraseStateAck{} }
|
||||||
|
func (m *PassphraseStateAck) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PassphraseStateAck) ProtoMessage() {}
|
||||||
|
func (*PassphraseStateAck) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{9}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PassphraseStateAck) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PassphraseStateAck.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PassphraseStateAck.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateAck) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PassphraseStateAck.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateAck) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PassphraseStateAck.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PassphraseStateAck) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PassphraseStateAck.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PassphraseStateAck proto.InternalMessageInfo
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Structure representing BIP32 (hierarchical deterministic) node
|
||||||
|
// Used for imports of private key into the device and exporting public key out of device
|
||||||
|
// @embed
|
||||||
|
type HDNodeType struct {
|
||||||
|
Depth *uint32 `protobuf:"varint,1,req,name=depth" json:"depth,omitempty"`
|
||||||
|
Fingerprint *uint32 `protobuf:"varint,2,req,name=fingerprint" json:"fingerprint,omitempty"`
|
||||||
|
ChildNum *uint32 `protobuf:"varint,3,req,name=child_num,json=childNum" json:"child_num,omitempty"`
|
||||||
|
ChainCode []byte `protobuf:"bytes,4,req,name=chain_code,json=chainCode" json:"chain_code,omitempty"`
|
||||||
|
PrivateKey []byte `protobuf:"bytes,5,opt,name=private_key,json=privateKey" json:"private_key,omitempty"`
|
||||||
|
PublicKey []byte `protobuf:"bytes,6,opt,name=public_key,json=publicKey" json:"public_key,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) Reset() { *m = HDNodeType{} }
|
||||||
|
func (m *HDNodeType) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*HDNodeType) ProtoMessage() {}
|
||||||
|
func (*HDNodeType) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_aaf30d059fdbc38d, []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_HDNodeType.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *HDNodeType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_HDNodeType.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *HDNodeType) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_HDNodeType.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *HDNodeType) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_HDNodeType.Size(m)
|
||||||
|
}
|
||||||
|
func (m *HDNodeType) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_HDNodeType.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_HDNodeType proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetDepth() uint32 {
|
||||||
|
if m != nil && m.Depth != nil {
|
||||||
|
return *m.Depth
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetFingerprint() uint32 {
|
||||||
|
if m != nil && m.Fingerprint != nil {
|
||||||
|
return *m.Fingerprint
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetChildNum() uint32 {
|
||||||
|
if m != nil && m.ChildNum != nil {
|
||||||
|
return *m.ChildNum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetChainCode() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.ChainCode
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetPrivateKey() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.PrivateKey
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HDNodeType) GetPublicKey() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.PublicKey
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterEnum("hw.trezor.messages.common.Failure_FailureType", Failure_FailureType_name, Failure_FailureType_value)
|
||||||
|
proto.RegisterEnum("hw.trezor.messages.common.ButtonRequest_ButtonRequestType", ButtonRequest_ButtonRequestType_name, ButtonRequest_ButtonRequestType_value)
|
||||||
|
proto.RegisterEnum("hw.trezor.messages.common.PinMatrixRequest_PinMatrixRequestType", PinMatrixRequest_PinMatrixRequestType_name, PinMatrixRequest_PinMatrixRequestType_value)
|
||||||
|
proto.RegisterType((*Success)(nil), "hw.trezor.messages.common.Success")
|
||||||
|
proto.RegisterType((*Failure)(nil), "hw.trezor.messages.common.Failure")
|
||||||
|
proto.RegisterType((*ButtonRequest)(nil), "hw.trezor.messages.common.ButtonRequest")
|
||||||
|
proto.RegisterType((*ButtonAck)(nil), "hw.trezor.messages.common.ButtonAck")
|
||||||
|
proto.RegisterType((*PinMatrixRequest)(nil), "hw.trezor.messages.common.PinMatrixRequest")
|
||||||
|
proto.RegisterType((*PinMatrixAck)(nil), "hw.trezor.messages.common.PinMatrixAck")
|
||||||
|
proto.RegisterType((*PassphraseRequest)(nil), "hw.trezor.messages.common.PassphraseRequest")
|
||||||
|
proto.RegisterType((*PassphraseAck)(nil), "hw.trezor.messages.common.PassphraseAck")
|
||||||
|
proto.RegisterType((*PassphraseStateRequest)(nil), "hw.trezor.messages.common.PassphraseStateRequest")
|
||||||
|
proto.RegisterType((*PassphraseStateAck)(nil), "hw.trezor.messages.common.PassphraseStateAck")
|
||||||
|
proto.RegisterType((*HDNodeType)(nil), "hw.trezor.messages.common.HDNodeType")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("messages-common.proto", fileDescriptor_aaf30d059fdbc38d) }
|
||||||
|
|
||||||
|
var fileDescriptor_aaf30d059fdbc38d = []byte{
|
||||||
|
// 846 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcd, 0x52, 0x23, 0x37,
|
||||||
|
0x10, 0x2e, 0xff, 0x80, 0xed, 0xb6, 0xd9, 0x08, 0xc5, 0x80, 0x09, 0xb0, 0x38, 0xc3, 0x21, 0x5c,
|
||||||
|
0xe2, 0x4a, 0xe5, 0x98, 0x53, 0x58, 0x83, 0x2b, 0xd4, 0x16, 0x86, 0x1a, 0xd8, 0xda, 0xa3, 0x4b,
|
||||||
|
0xd1, 0xf4, 0x32, 0x2a, 0xcf, 0x48, 0x13, 0x8d, 0x06, 0xf0, 0x5e, 0xf2, 0x6a, 0x79, 0x89, 0xbc,
|
||||||
|
0x42, 0xaa, 0x52, 0xb9, 0xe4, 0x11, 0xb6, 0x34, 0x3f, 0x78, 0xc6, 0x66, 0x39, 0xcd, 0xe8, 0xfb,
|
||||||
|
0xbe, 0xee, 0x96, 0xba, 0x3f, 0x09, 0x76, 0x42, 0x8c, 0x63, 0x76, 0x8f, 0xf1, 0x8f, 0x5c, 0x85,
|
||||||
|
0xa1, 0x92, 0xa3, 0x48, 0x2b, 0xa3, 0xe8, 0xbe, 0xff, 0x38, 0x32, 0x1a, 0x3f, 0x2b, 0x3d, 0x2a,
|
||||||
|
0x04, 0xa3, 0x4c, 0xe0, 0x9c, 0x40, 0xeb, 0x36, 0xe1, 0x1c, 0xe3, 0x98, 0x0e, 0xa0, 0x95, 0xb3,
|
||||||
|
0x83, 0xda, 0xb0, 0x76, 0xda, 0x71, 0x8b, 0xa5, 0xf3, 0x77, 0x03, 0x5a, 0x13, 0x26, 0x82, 0x44,
|
||||||
|
0x23, 0x7d, 0x07, 0x4d, 0xae, 0xbc, 0x4c, 0xf2, 0xe6, 0xe7, 0xd1, 0xe8, 0xab, 0xa9, 0x47, 0x79,
|
||||||
|
0x44, 0xf1, 0xbd, 0x5b, 0x44, 0xe8, 0xa6, 0xb1, 0xe5, 0x4a, 0xf5, 0x6a, 0xa5, 0xff, 0xea, 0xd0,
|
||||||
|
0x2d, 0xe9, 0xe9, 0x11, 0xec, 0xe7, 0xcb, 0xd9, 0x07, 0x89, 0x4f, 0x11, 0x72, 0x83, 0xde, 0x55,
|
||||||
|
0x26, 0x26, 0x35, 0xfa, 0x1d, 0xec, 0x16, 0xf4, 0xbb, 0xc4, 0x18, 0x25, 0x2f, 0x72, 0x09, 0xa9,
|
||||||
|
0xd3, 0x1d, 0xd8, 0x2e, 0xb8, 0x73, 0x66, 0xd8, 0x85, 0xd6, 0x4a, 0x93, 0x06, 0x3d, 0x80, 0xbd,
|
||||||
|
0x02, 0x3e, 0xe3, 0x46, 0x28, 0x39, 0x66, 0x92, 0x63, 0x10, 0xa0, 0x47, 0x9a, 0x74, 0x0f, 0xbe,
|
||||||
|
0x2d, 0xc8, 0x1b, 0xb1, 0x4c, 0xb6, 0x41, 0x07, 0xd0, 0x2f, 0x11, 0xcb, 0x90, 0x4d, 0xba, 0x0b,
|
||||||
|
0xb4, 0xc4, 0x5c, 0xca, 0x07, 0x16, 0x08, 0x8f, 0xb4, 0xe8, 0x21, 0x0c, 0x0a, 0x3c, 0x07, 0x6f,
|
||||||
|
0xc5, 0xbd, 0x64, 0x26, 0xd1, 0x48, 0xda, 0x95, 0x7c, 0x5a, 0xd9, 0xf6, 0x67, 0xfb, 0xeb, 0x94,
|
||||||
|
0x8f, 0x34, 0x55, 0xe6, 0x42, 0xaa, 0xe4, 0xde, 0x9f, 0x24, 0xd2, 0x8b, 0x09, 0xac, 0x70, 0x97,
|
||||||
|
0x52, 0x18, 0xc1, 0x02, 0xf1, 0x19, 0x3d, 0xd2, 0x5d, 0xd9, 0xfa, 0x95, 0x88, 0x43, 0x66, 0xb8,
|
||||||
|
0x4f, 0x7a, 0x74, 0x1f, 0x76, 0x0a, 0x62, 0x22, 0x74, 0xf8, 0xc8, 0x34, 0x66, 0xb5, 0xb8, 0xf3,
|
||||||
|
0x4f, 0x13, 0xb6, 0xb2, 0xbe, 0xb9, 0xf8, 0x47, 0x82, 0xb1, 0xa1, 0xd3, 0xca, 0x74, 0x7f, 0x79,
|
||||||
|
0x65, 0xba, 0x95, 0xb8, 0xea, 0xaa, 0x34, 0x69, 0x0a, 0x4d, 0x8f, 0x19, 0x96, 0x8f, 0x39, 0xfd,
|
||||||
|
0x77, 0xfe, 0x6f, 0xc0, 0xf6, 0x9a, 0xde, 0xee, 0xbf, 0x02, 0xce, 0xae, 0x8d, 0x8f, 0x9a, 0xd4,
|
||||||
|
0xa8, 0x03, 0x6f, 0xab, 0xc4, 0x04, 0xf1, 0xfa, 0x01, 0xf5, 0x9d, 0xaf, 0x31, 0xf6, 0x55, 0x60,
|
||||||
|
0x67, 0x7d, 0x0c, 0x07, 0x55, 0xcd, 0x58, 0xc9, 0x4f, 0x42, 0x87, 0xd7, 0x89, 0x89, 0x12, 0x43,
|
||||||
|
0x1a, 0xd6, 0x47, 0x55, 0x81, 0x8b, 0x31, 0x9a, 0x73, 0x7c, 0x10, 0x1c, 0x49, 0x73, 0x9d, 0xce,
|
||||||
|
0xe3, 0x3f, 0x2a, 0x6d, 0xa7, 0x7f, 0x08, 0x83, 0x2a, 0xfd, 0x51, 0x44, 0x98, 0x07, 0x6f, 0xae,
|
||||||
|
0x07, 0xdf, 0x68, 0x65, 0x90, 0x9b, 0x31, 0x0b, 0x02, 0xd2, 0xb2, 0xa3, 0xae, 0xd2, 0xd6, 0x07,
|
||||||
|
0x77, 0x4f, 0xa4, 0xbd, 0xbe, 0xeb, 0x62, 0x3e, 0x63, 0x1f, 0xf9, 0x9c, 0x74, 0xec, 0xe8, 0xaa,
|
||||||
|
0x82, 0x33, 0xcf, 0xd3, 0x18, 0x5b, 0x2b, 0x1c, 0xc0, 0xde, 0x4a, 0xd1, 0xe4, 0xf7, 0x40, 0xf0,
|
||||||
|
0xf7, 0xb8, 0x20, 0x5d, 0x7a, 0x02, 0xc7, 0x55, 0xf2, 0x4a, 0x62, 0xa8, 0xa4, 0xe0, 0xf6, 0x3c,
|
||||||
|
0x63, 0x95, 0x48, 0x43, 0x7a, 0xeb, 0xd5, 0x0b, 0xd1, 0xa5, 0xb4, 0x3d, 0xdb, 0xa2, 0x43, 0x38,
|
||||||
|
0x5c, 0x29, 0xc1, 0xe2, 0x38, 0xf2, 0x35, 0x8b, 0xd3, 0xbb, 0x49, 0xde, 0xd0, 0x1f, 0xe0, 0xa4,
|
||||||
|
0xaa, 0xf8, 0x20, 0xe7, 0x52, 0x3d, 0xca, 0x73, 0xd4, 0xe2, 0x81, 0xd9, 0xcb, 0x75, 0xc3, 0x8c,
|
||||||
|
0x4f, 0xbe, 0x71, 0xba, 0xd0, 0xc9, 0x84, 0x67, 0x7c, 0xee, 0xfc, 0x5b, 0x03, 0x62, 0x2d, 0xca,
|
||||||
|
0x8c, 0x16, 0x4f, 0x85, 0xf1, 0xee, 0xa0, 0x69, 0x16, 0x51, 0x61, 0xbc, 0x5f, 0x5f, 0x31, 0xde,
|
||||||
|
0x6a, 0xe8, 0x1a, 0x90, 0xd9, 0xcf, 0x66, 0x73, 0xfe, 0x84, 0xfe, 0x4b, 0xac, 0x3d, 0xda, 0x4b,
|
||||||
|
0xf8, 0x6c, 0x9c, 0x68, 0x8d, 0xd2, 0x90, 0x1a, 0xfd, 0x1e, 0x8e, 0x5e, 0x54, 0x4c, 0xf1, 0x71,
|
||||||
|
0x22, 0x74, 0x6c, 0x48, 0xdd, 0x1a, 0xf3, 0x6b, 0x92, 0x5b, 0xe4, 0x4a, 0x7a, 0xa4, 0xe1, 0x0c,
|
||||||
|
0xa1, 0xf7, 0xac, 0x39, 0xe3, 0x73, 0x4a, 0xa0, 0x11, 0x09, 0x39, 0xa8, 0x0d, 0xeb, 0xa7, 0x1d,
|
||||||
|
0xd7, 0xfe, 0x3a, 0x3f, 0xc1, 0xf6, 0xb2, 0xaf, 0x45, 0x37, 0x0e, 0xa0, 0xa3, 0xe4, 0xcc, 0x4b,
|
||||||
|
0x1d, 0x96, 0xb6, 0xa4, 0xed, 0xb6, 0x95, 0xcc, 0x1c, 0xe7, 0x5c, 0xc0, 0xd6, 0x32, 0xc2, 0x26,
|
||||||
|
0x7d, 0x0b, 0x10, 0x3d, 0x03, 0xf9, 0xdb, 0x5d, 0x42, 0x68, 0x1f, 0x36, 0x62, 0xc3, 0x4c, 0xf6,
|
||||||
|
0xd8, 0xf6, 0xdc, 0x6c, 0xe1, 0x8c, 0x60, 0x77, 0x99, 0xe6, 0xd6, 0x42, 0x45, 0xf5, 0x67, 0x7d,
|
||||||
|
0xad, 0xac, 0xef, 0x03, 0x5d, 0xd1, 0xdb, 0x61, 0xfe, 0x55, 0x03, 0xf8, 0xed, 0x7c, 0xaa, 0xbc,
|
||||||
|
0xec, 0xbd, 0xee, 0xc3, 0x86, 0x87, 0x91, 0xf1, 0xd3, 0x13, 0x6e, 0xb9, 0xd9, 0x82, 0x0e, 0xa1,
|
||||||
|
0xfb, 0x49, 0xc8, 0x7b, 0xd4, 0x91, 0x16, 0xd2, 0x0c, 0xea, 0x29, 0x57, 0x86, 0xec, 0x81, 0xb9,
|
||||||
|
0x2f, 0x02, 0x6f, 0x26, 0x93, 0x70, 0xd0, 0x48, 0xf9, 0x76, 0x0a, 0x4c, 0x93, 0x90, 0x1e, 0x01,
|
||||||
|
0x70, 0x9f, 0x09, 0x39, 0x4b, 0x9f, 0xa6, 0xe6, 0xb0, 0x7e, 0xda, 0x73, 0x3b, 0x29, 0x32, 0xb6,
|
||||||
|
0x6f, 0xcc, 0x31, 0x74, 0xa3, 0xd4, 0x6f, 0x38, 0x9b, 0xe3, 0x62, 0xb0, 0x91, 0x6e, 0x1a, 0x72,
|
||||||
|
0xe8, 0x3d, 0x2e, 0x6c, 0x7c, 0x94, 0xde, 0x8e, 0x94, 0xdf, 0x4c, 0xf9, 0x4e, 0x54, 0xdc, 0x97,
|
||||||
|
0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x7d, 0x20, 0xa6, 0x35, 0x07, 0x00, 0x00,
|
||||||
|
}
|
||||||
147
accounts/usbwallet/trezor/messages-common.proto
Normal file
147
accounts/usbwallet/trezor/messages-common.proto
Normal file
|
|
@ -0,0 +1,147 @@
|
||||||
|
// This file originates from the SatoshiLabs Trezor `common` repository at:
|
||||||
|
// https://github.com/trezor/trezor-common/blob/master/protob/messages-common.proto
|
||||||
|
// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
package hw.trezor.messages.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Success of the previous request
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message Success {
|
||||||
|
optional string message = 1; // human readable description of action or request-specific payload
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Failure of the previous request
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message Failure {
|
||||||
|
optional FailureType code = 1; // computer-readable definition of the error state
|
||||||
|
optional string message = 2; // human-readable message of the error state
|
||||||
|
enum FailureType {
|
||||||
|
Failure_UnexpectedMessage = 1;
|
||||||
|
Failure_ButtonExpected = 2;
|
||||||
|
Failure_DataError = 3;
|
||||||
|
Failure_ActionCancelled = 4;
|
||||||
|
Failure_PinExpected = 5;
|
||||||
|
Failure_PinCancelled = 6;
|
||||||
|
Failure_PinInvalid = 7;
|
||||||
|
Failure_InvalidSignature = 8;
|
||||||
|
Failure_ProcessError = 9;
|
||||||
|
Failure_NotEnoughFunds = 10;
|
||||||
|
Failure_NotInitialized = 11;
|
||||||
|
Failure_PinMismatch = 12;
|
||||||
|
Failure_FirmwareError = 99;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device is waiting for HW button press.
|
||||||
|
* @auxstart
|
||||||
|
* @next ButtonAck
|
||||||
|
*/
|
||||||
|
message ButtonRequest {
|
||||||
|
optional ButtonRequestType code = 1;
|
||||||
|
optional string data = 2;
|
||||||
|
/**
|
||||||
|
* Type of button request
|
||||||
|
*/
|
||||||
|
enum ButtonRequestType {
|
||||||
|
ButtonRequest_Other = 1;
|
||||||
|
ButtonRequest_FeeOverThreshold = 2;
|
||||||
|
ButtonRequest_ConfirmOutput = 3;
|
||||||
|
ButtonRequest_ResetDevice = 4;
|
||||||
|
ButtonRequest_ConfirmWord = 5;
|
||||||
|
ButtonRequest_WipeDevice = 6;
|
||||||
|
ButtonRequest_ProtectCall = 7;
|
||||||
|
ButtonRequest_SignTx = 8;
|
||||||
|
ButtonRequest_FirmwareCheck = 9;
|
||||||
|
ButtonRequest_Address = 10;
|
||||||
|
ButtonRequest_PublicKey = 11;
|
||||||
|
ButtonRequest_MnemonicWordCount = 12;
|
||||||
|
ButtonRequest_MnemonicInput = 13;
|
||||||
|
ButtonRequest_PassphraseType = 14;
|
||||||
|
ButtonRequest_UnknownDerivationPath = 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Computer agrees to wait for HW button press
|
||||||
|
* @auxend
|
||||||
|
*/
|
||||||
|
message ButtonAck {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
|
||||||
|
* @auxstart
|
||||||
|
* @next PinMatrixAck
|
||||||
|
*/
|
||||||
|
message PinMatrixRequest {
|
||||||
|
optional PinMatrixRequestType type = 1;
|
||||||
|
/**
|
||||||
|
* Type of PIN request
|
||||||
|
*/
|
||||||
|
enum PinMatrixRequestType {
|
||||||
|
PinMatrixRequestType_Current = 1;
|
||||||
|
PinMatrixRequestType_NewFirst = 2;
|
||||||
|
PinMatrixRequestType_NewSecond = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Computer responds with encoded PIN
|
||||||
|
* @auxend
|
||||||
|
*/
|
||||||
|
message PinMatrixAck {
|
||||||
|
required string pin = 1; // matrix encoded PIN entered by user
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device awaits encryption passphrase
|
||||||
|
* @auxstart
|
||||||
|
* @next PassphraseAck
|
||||||
|
*/
|
||||||
|
message PassphraseRequest {
|
||||||
|
optional bool on_device = 1; // passphrase is being entered on the device
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Send passphrase back
|
||||||
|
* @next PassphraseStateRequest
|
||||||
|
*/
|
||||||
|
message PassphraseAck {
|
||||||
|
optional string passphrase = 1;
|
||||||
|
optional bytes state = 2; // expected device state
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device awaits passphrase state
|
||||||
|
* @next PassphraseStateAck
|
||||||
|
*/
|
||||||
|
message PassphraseStateRequest {
|
||||||
|
optional bytes state = 1; // actual device state
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Send passphrase state back
|
||||||
|
* @auxend
|
||||||
|
*/
|
||||||
|
message PassphraseStateAck {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure representing BIP32 (hierarchical deterministic) node
|
||||||
|
* Used for imports of private key into the device and exporting public key out of device
|
||||||
|
* @embed
|
||||||
|
*/
|
||||||
|
message HDNodeType {
|
||||||
|
required uint32 depth = 1;
|
||||||
|
required uint32 fingerprint = 2;
|
||||||
|
required uint32 child_num = 3;
|
||||||
|
required bytes chain_code = 4;
|
||||||
|
optional bytes private_key = 5;
|
||||||
|
optional bytes public_key = 6;
|
||||||
|
}
|
||||||
698
accounts/usbwallet/trezor/messages-ethereum.pb.go
Normal file
698
accounts/usbwallet/trezor/messages-ethereum.pb.go
Normal file
|
|
@ -0,0 +1,698 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: messages-ethereum.proto
|
||||||
|
|
||||||
|
package trezor
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
math "math"
|
||||||
|
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Ask device for public key corresponding to address_n path
|
||||||
|
// @start
|
||||||
|
// @next EthereumPublicKey
|
||||||
|
// @next Failure
|
||||||
|
type EthereumGetPublicKey struct {
|
||||||
|
AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
|
||||||
|
ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetPublicKey) Reset() { *m = EthereumGetPublicKey{} }
|
||||||
|
func (m *EthereumGetPublicKey) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumGetPublicKey) ProtoMessage() {}
|
||||||
|
func (*EthereumGetPublicKey) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetPublicKey) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumGetPublicKey.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetPublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumGetPublicKey.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetPublicKey) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumGetPublicKey.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetPublicKey) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumGetPublicKey.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetPublicKey) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumGetPublicKey.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumGetPublicKey proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumGetPublicKey) GetAddressN() []uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressN
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetPublicKey) GetShowDisplay() bool {
|
||||||
|
if m != nil && m.ShowDisplay != nil {
|
||||||
|
return *m.ShowDisplay
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Contains public key derived from device private seed
|
||||||
|
// @end
|
||||||
|
type EthereumPublicKey struct {
|
||||||
|
Node *HDNodeType `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"`
|
||||||
|
Xpub *string `protobuf:"bytes,2,opt,name=xpub" json:"xpub,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumPublicKey) Reset() { *m = EthereumPublicKey{} }
|
||||||
|
func (m *EthereumPublicKey) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumPublicKey) ProtoMessage() {}
|
||||||
|
func (*EthereumPublicKey) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumPublicKey) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumPublicKey.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumPublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumPublicKey.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumPublicKey) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumPublicKey.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumPublicKey) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumPublicKey.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumPublicKey) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumPublicKey.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumPublicKey proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumPublicKey) GetNode() *HDNodeType {
|
||||||
|
if m != nil {
|
||||||
|
return m.Node
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumPublicKey) GetXpub() string {
|
||||||
|
if m != nil && m.Xpub != nil {
|
||||||
|
return *m.Xpub
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Ask device for Ethereum address corresponding to address_n path
|
||||||
|
// @start
|
||||||
|
// @next EthereumAddress
|
||||||
|
// @next Failure
|
||||||
|
type EthereumGetAddress struct {
|
||||||
|
AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
|
||||||
|
ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetAddress) Reset() { *m = EthereumGetAddress{} }
|
||||||
|
func (m *EthereumGetAddress) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumGetAddress) ProtoMessage() {}
|
||||||
|
func (*EthereumGetAddress) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetAddress) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumGetAddress.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumGetAddress.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetAddress) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumGetAddress.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetAddress) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumGetAddress.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumGetAddress) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumGetAddress.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumGetAddress proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumGetAddress) GetAddressN() []uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressN
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumGetAddress) GetShowDisplay() bool {
|
||||||
|
if m != nil && m.ShowDisplay != nil {
|
||||||
|
return *m.ShowDisplay
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Contains an Ethereum address derived from device private seed
|
||||||
|
// @end
|
||||||
|
type EthereumAddress struct {
|
||||||
|
AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
|
||||||
|
AddressHex *string `protobuf:"bytes,2,opt,name=addressHex" json:"addressHex,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumAddress) Reset() { *m = EthereumAddress{} }
|
||||||
|
func (m *EthereumAddress) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumAddress) ProtoMessage() {}
|
||||||
|
func (*EthereumAddress) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumAddress) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumAddress.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumAddress.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumAddress) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumAddress.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumAddress) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumAddress.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumAddress) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumAddress.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumAddress proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumAddress) GetAddressBin() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressBin
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumAddress) GetAddressHex() string {
|
||||||
|
if m != nil && m.AddressHex != nil {
|
||||||
|
return *m.AddressHex
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Ask device to sign transaction
|
||||||
|
// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
||||||
|
// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
||||||
|
// @start
|
||||||
|
// @next EthereumTxRequest
|
||||||
|
// @next Failure
|
||||||
|
type EthereumSignTx struct {
|
||||||
|
AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
|
||||||
|
Nonce []byte `protobuf:"bytes,2,opt,name=nonce" json:"nonce,omitempty"`
|
||||||
|
GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice" json:"gas_price,omitempty"`
|
||||||
|
GasLimit []byte `protobuf:"bytes,4,opt,name=gas_limit,json=gasLimit" json:"gas_limit,omitempty"`
|
||||||
|
ToBin []byte `protobuf:"bytes,5,opt,name=toBin" json:"toBin,omitempty"`
|
||||||
|
ToHex *string `protobuf:"bytes,11,opt,name=toHex" json:"toHex,omitempty"`
|
||||||
|
Value []byte `protobuf:"bytes,6,opt,name=value" json:"value,omitempty"`
|
||||||
|
DataInitialChunk []byte `protobuf:"bytes,7,opt,name=data_initial_chunk,json=dataInitialChunk" json:"data_initial_chunk,omitempty"`
|
||||||
|
DataLength *uint32 `protobuf:"varint,8,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
|
||||||
|
ChainId *uint32 `protobuf:"varint,9,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"`
|
||||||
|
TxType *uint32 `protobuf:"varint,10,opt,name=tx_type,json=txType" json:"tx_type,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) Reset() { *m = EthereumSignTx{} }
|
||||||
|
func (m *EthereumSignTx) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumSignTx) ProtoMessage() {}
|
||||||
|
func (*EthereumSignTx) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumSignTx.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumSignTx.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignTx) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumSignTx.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignTx) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumSignTx.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignTx) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumSignTx.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumSignTx proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetAddressN() []uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressN
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetNonce() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Nonce
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetGasPrice() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.GasPrice
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetGasLimit() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.GasLimit
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetToBin() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.ToBin
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetToHex() string {
|
||||||
|
if m != nil && m.ToHex != nil {
|
||||||
|
return *m.ToHex
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetValue() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetDataInitialChunk() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.DataInitialChunk
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetDataLength() uint32 {
|
||||||
|
if m != nil && m.DataLength != nil {
|
||||||
|
return *m.DataLength
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetChainId() uint32 {
|
||||||
|
if m != nil && m.ChainId != nil {
|
||||||
|
return *m.ChainId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignTx) GetTxType() uint32 {
|
||||||
|
if m != nil && m.TxType != nil {
|
||||||
|
return *m.TxType
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Device asks for more data from transaction payload, or returns the signature.
|
||||||
|
// If data_length is set, device awaits that many more bytes of payload.
|
||||||
|
// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
||||||
|
// @end
|
||||||
|
// @next EthereumTxAck
|
||||||
|
type EthereumTxRequest struct {
|
||||||
|
DataLength *uint32 `protobuf:"varint,1,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
|
||||||
|
SignatureV *uint32 `protobuf:"varint,2,opt,name=signature_v,json=signatureV" json:"signature_v,omitempty"`
|
||||||
|
SignatureR []byte `protobuf:"bytes,3,opt,name=signature_r,json=signatureR" json:"signature_r,omitempty"`
|
||||||
|
SignatureS []byte `protobuf:"bytes,4,opt,name=signature_s,json=signatureS" json:"signature_s,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) Reset() { *m = EthereumTxRequest{} }
|
||||||
|
func (m *EthereumTxRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumTxRequest) ProtoMessage() {}
|
||||||
|
func (*EthereumTxRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumTxRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumTxRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumTxRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumTxRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumTxRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumTxRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) GetDataLength() uint32 {
|
||||||
|
if m != nil && m.DataLength != nil {
|
||||||
|
return *m.DataLength
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) GetSignatureV() uint32 {
|
||||||
|
if m != nil && m.SignatureV != nil {
|
||||||
|
return *m.SignatureV
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) GetSignatureR() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.SignatureR
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxRequest) GetSignatureS() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.SignatureS
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Transaction payload data.
|
||||||
|
// @next EthereumTxRequest
|
||||||
|
type EthereumTxAck struct {
|
||||||
|
DataChunk []byte `protobuf:"bytes,1,opt,name=data_chunk,json=dataChunk" json:"data_chunk,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxAck) Reset() { *m = EthereumTxAck{} }
|
||||||
|
func (m *EthereumTxAck) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumTxAck) ProtoMessage() {}
|
||||||
|
func (*EthereumTxAck) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumTxAck) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumTxAck.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumTxAck.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxAck) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumTxAck.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxAck) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumTxAck.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumTxAck) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumTxAck.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumTxAck proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumTxAck) GetDataChunk() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.DataChunk
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Ask device to sign message
|
||||||
|
// @start
|
||||||
|
// @next EthereumMessageSignature
|
||||||
|
// @next Failure
|
||||||
|
type EthereumSignMessage struct {
|
||||||
|
AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
|
||||||
|
Message []byte `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignMessage) Reset() { *m = EthereumSignMessage{} }
|
||||||
|
func (m *EthereumSignMessage) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumSignMessage) ProtoMessage() {}
|
||||||
|
func (*EthereumSignMessage) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignMessage) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumSignMessage.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumSignMessage.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignMessage) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumSignMessage.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignMessage) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumSignMessage.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumSignMessage) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumSignMessage.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumSignMessage proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumSignMessage) GetAddressN() []uint32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressN
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumSignMessage) GetMessage() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Message
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Response: Signed message
|
||||||
|
// @end
|
||||||
|
type EthereumMessageSignature struct {
|
||||||
|
AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
|
||||||
|
Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
|
||||||
|
AddressHex *string `protobuf:"bytes,3,opt,name=addressHex" json:"addressHex,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumMessageSignature) Reset() { *m = EthereumMessageSignature{} }
|
||||||
|
func (m *EthereumMessageSignature) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumMessageSignature) ProtoMessage() {}
|
||||||
|
func (*EthereumMessageSignature) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumMessageSignature) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumMessageSignature.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumMessageSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumMessageSignature.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumMessageSignature) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumMessageSignature.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumMessageSignature) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumMessageSignature.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumMessageSignature) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumMessageSignature.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumMessageSignature proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumMessageSignature) GetAddressBin() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressBin
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumMessageSignature) GetSignature() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Signature
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumMessageSignature) GetAddressHex() string {
|
||||||
|
if m != nil && m.AddressHex != nil {
|
||||||
|
return *m.AddressHex
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//*
|
||||||
|
// Request: Ask device to verify message
|
||||||
|
// @start
|
||||||
|
// @next Success
|
||||||
|
// @next Failure
|
||||||
|
type EthereumVerifyMessage struct {
|
||||||
|
AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
|
||||||
|
Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
|
||||||
|
Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
|
||||||
|
AddressHex *string `protobuf:"bytes,4,opt,name=addressHex" json:"addressHex,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) Reset() { *m = EthereumVerifyMessage{} }
|
||||||
|
func (m *EthereumVerifyMessage) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*EthereumVerifyMessage) ProtoMessage() {}
|
||||||
|
func (*EthereumVerifyMessage) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_cb33f46ba915f15c, []int{9}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_EthereumVerifyMessage.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *EthereumVerifyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_EthereumVerifyMessage.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *EthereumVerifyMessage) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_EthereumVerifyMessage.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *EthereumVerifyMessage) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_EthereumVerifyMessage.Size(m)
|
||||||
|
}
|
||||||
|
func (m *EthereumVerifyMessage) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_EthereumVerifyMessage.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_EthereumVerifyMessage proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) GetAddressBin() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.AddressBin
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) GetSignature() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Signature
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) GetMessage() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Message
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *EthereumVerifyMessage) GetAddressHex() string {
|
||||||
|
if m != nil && m.AddressHex != nil {
|
||||||
|
return *m.AddressHex
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*EthereumGetPublicKey)(nil), "hw.trezor.messages.ethereum.EthereumGetPublicKey")
|
||||||
|
proto.RegisterType((*EthereumPublicKey)(nil), "hw.trezor.messages.ethereum.EthereumPublicKey")
|
||||||
|
proto.RegisterType((*EthereumGetAddress)(nil), "hw.trezor.messages.ethereum.EthereumGetAddress")
|
||||||
|
proto.RegisterType((*EthereumAddress)(nil), "hw.trezor.messages.ethereum.EthereumAddress")
|
||||||
|
proto.RegisterType((*EthereumSignTx)(nil), "hw.trezor.messages.ethereum.EthereumSignTx")
|
||||||
|
proto.RegisterType((*EthereumTxRequest)(nil), "hw.trezor.messages.ethereum.EthereumTxRequest")
|
||||||
|
proto.RegisterType((*EthereumTxAck)(nil), "hw.trezor.messages.ethereum.EthereumTxAck")
|
||||||
|
proto.RegisterType((*EthereumSignMessage)(nil), "hw.trezor.messages.ethereum.EthereumSignMessage")
|
||||||
|
proto.RegisterType((*EthereumMessageSignature)(nil), "hw.trezor.messages.ethereum.EthereumMessageSignature")
|
||||||
|
proto.RegisterType((*EthereumVerifyMessage)(nil), "hw.trezor.messages.ethereum.EthereumVerifyMessage")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("messages-ethereum.proto", fileDescriptor_cb33f46ba915f15c) }
|
||||||
|
|
||||||
|
var fileDescriptor_cb33f46ba915f15c = []byte{
|
||||||
|
// 593 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
|
||||||
|
0x10, 0x95, 0x9b, 0xb4, 0x49, 0x26, 0x0d, 0x1f, 0xa6, 0x55, 0x17, 0x0a, 0x34, 0x18, 0x21, 0xe5,
|
||||||
|
0x00, 0x3e, 0x70, 0x43, 0xe2, 0xd2, 0x52, 0x44, 0x2b, 0x4a, 0x55, 0xdc, 0xa8, 0x57, 0x6b, 0x63,
|
||||||
|
0x6f, 0xe3, 0x55, 0x9d, 0xdd, 0xe0, 0x5d, 0xb7, 0x0e, 0x7f, 0x82, 0x23, 0xff, 0x87, 0x5f, 0x86,
|
||||||
|
0xf6, 0x2b, 0x71, 0x52, 0x54, 0x0e, 0xbd, 0x65, 0xde, 0xbc, 0x7d, 0xf3, 0x66, 0xf4, 0x62, 0xd8,
|
||||||
|
0x99, 0x10, 0x21, 0xf0, 0x98, 0x88, 0x77, 0x44, 0x66, 0xa4, 0x20, 0xe5, 0x24, 0x9c, 0x16, 0x5c,
|
||||||
|
0x72, 0x7f, 0x37, 0xbb, 0x09, 0x65, 0x41, 0x7e, 0xf2, 0x22, 0x74, 0x94, 0xd0, 0x51, 0x9e, 0x6d,
|
||||||
|
0xcf, 0x5f, 0x25, 0x7c, 0x32, 0xe1, 0xcc, 0xbc, 0x09, 0x2e, 0x60, 0xeb, 0xb3, 0xa5, 0x7c, 0x21,
|
||||||
|
0xf2, 0xac, 0x1c, 0xe5, 0x34, 0xf9, 0x4a, 0x66, 0xfe, 0x2e, 0x74, 0x70, 0x9a, 0x16, 0x44, 0x88,
|
||||||
|
0x98, 0x21, 0xaf, 0xdf, 0x18, 0xf4, 0xa2, 0xb6, 0x05, 0x4e, 0xfd, 0x57, 0xb0, 0x29, 0x32, 0x7e,
|
||||||
|
0x13, 0xa7, 0x54, 0x4c, 0x73, 0x3c, 0x43, 0x6b, 0x7d, 0x6f, 0xd0, 0x8e, 0xba, 0x0a, 0x3b, 0x34,
|
||||||
|
0x50, 0x30, 0x82, 0xc7, 0x4e, 0x77, 0x21, 0xfa, 0x01, 0x9a, 0x8c, 0xa7, 0x04, 0x79, 0x7d, 0x6f,
|
||||||
|
0xd0, 0x7d, 0xff, 0x26, 0xfc, 0x87, 0x5f, 0x6b, 0xee, 0xe8, 0xf0, 0x94, 0xa7, 0x64, 0x38, 0x9b,
|
||||||
|
0x92, 0x48, 0x3f, 0xf1, 0x7d, 0x68, 0x56, 0xd3, 0x72, 0xa4, 0x47, 0x75, 0x22, 0xfd, 0x3b, 0x18,
|
||||||
|
0x82, 0x5f, 0xf3, 0xbe, 0x6f, 0xdc, 0xdd, 0xdb, 0xf9, 0x77, 0x78, 0xe8, 0x54, 0x9d, 0xe4, 0x4b,
|
||||||
|
0x00, 0xab, 0x70, 0x40, 0x99, 0x76, 0xbf, 0x19, 0xd5, 0x90, 0x5a, 0xff, 0x88, 0x54, 0xd6, 0x62,
|
||||||
|
0x0d, 0x09, 0xfe, 0xac, 0xc1, 0x03, 0xa7, 0x79, 0x4e, 0xc7, 0x6c, 0x58, 0xdd, 0xed, 0x72, 0x0b,
|
||||||
|
0xd6, 0x19, 0x67, 0x09, 0xd1, 0x52, 0x9b, 0x91, 0x29, 0xd4, 0x93, 0x31, 0x16, 0xf1, 0xb4, 0xa0,
|
||||||
|
0x09, 0x41, 0x0d, 0xdd, 0x69, 0x8f, 0xb1, 0x38, 0x53, 0xb5, 0x6b, 0xe6, 0x74, 0x42, 0x25, 0x6a,
|
||||||
|
0xce, 0x9b, 0x27, 0xaa, 0x56, 0x7a, 0x92, 0x2b, 0xeb, 0xeb, 0x46, 0x4f, 0x17, 0x06, 0x55, 0x86,
|
||||||
|
0xbb, 0xda, 0xb0, 0x29, 0x14, 0x7a, 0x8d, 0xf3, 0x92, 0xa0, 0x0d, 0xc3, 0xd5, 0x85, 0xff, 0x16,
|
||||||
|
0xfc, 0x14, 0x4b, 0x1c, 0x53, 0x46, 0x25, 0xc5, 0x79, 0x9c, 0x64, 0x25, 0xbb, 0x42, 0x2d, 0x4d,
|
||||||
|
0x79, 0xa4, 0x3a, 0xc7, 0xa6, 0xf1, 0x49, 0xe1, 0xfe, 0x1e, 0x74, 0x35, 0x3b, 0x27, 0x6c, 0x2c,
|
||||||
|
0x33, 0xd4, 0xee, 0x7b, 0x83, 0x5e, 0x04, 0x0a, 0x3a, 0xd1, 0x88, 0xff, 0x14, 0xda, 0x49, 0x86,
|
||||||
|
0x29, 0x8b, 0x69, 0x8a, 0x3a, 0xba, 0xdb, 0xd2, 0xf5, 0x71, 0xea, 0xef, 0x40, 0x4b, 0x56, 0xb1,
|
||||||
|
0x9c, 0x4d, 0x09, 0x02, 0xdd, 0xd9, 0x90, 0x95, 0xca, 0x41, 0xf0, 0xdb, 0x5b, 0x44, 0x6a, 0x58,
|
||||||
|
0x45, 0xe4, 0x47, 0x49, 0x84, 0x5c, 0x1d, 0xe5, 0xdd, 0x1a, 0xb5, 0x07, 0x5d, 0x41, 0xc7, 0x0c,
|
||||||
|
0xcb, 0xb2, 0x20, 0xf1, 0xb5, 0xbe, 0x68, 0x2f, 0x82, 0x39, 0x74, 0xb1, 0x4c, 0x28, 0xec, 0x61,
|
||||||
|
0x17, 0x84, 0x68, 0x99, 0x20, 0xec, 0x71, 0x17, 0x84, 0xf3, 0x20, 0x84, 0xde, 0xc2, 0xd8, 0x7e,
|
||||||
|
0x72, 0xe5, 0xbf, 0x00, 0xed, 0xc0, 0x5e, 0xc9, 0xe4, 0xa5, 0xa3, 0x10, 0x7d, 0x9e, 0xe0, 0x04,
|
||||||
|
0x9e, 0xd4, 0xd3, 0xf0, 0xcd, 0x64, 0xff, 0xee, 0x48, 0x20, 0x68, 0xd9, 0xff, 0x88, 0x0d, 0x85,
|
||||||
|
0x2b, 0x83, 0x0a, 0x90, 0x53, 0xb3, 0x4a, 0xe7, 0xce, 0xda, 0x7f, 0x83, 0xfb, 0x1c, 0x3a, 0xf3,
|
||||||
|
0x3d, 0xac, 0xee, 0x02, 0x58, 0x89, 0x75, 0xe3, 0x56, 0xac, 0x7f, 0x79, 0xb0, 0xed, 0x46, 0x5f,
|
||||||
|
0x90, 0x82, 0x5e, 0xce, 0xdc, 0x2a, 0xf7, 0x9b, 0x5b, 0xdb, 0xb5, 0xb1, 0xb4, 0xeb, 0x8a, 0xa3,
|
||||||
|
0xe6, 0xaa, 0xa3, 0x83, 0x8f, 0xf0, 0x3a, 0xe1, 0x93, 0x50, 0x60, 0xc9, 0x45, 0x46, 0x73, 0x3c,
|
||||||
|
0x12, 0xee, 0x03, 0x93, 0xd3, 0x91, 0xf9, 0xe2, 0x8d, 0xca, 0xcb, 0x83, 0xed, 0xa1, 0x06, 0xad,
|
||||||
|
0x5b, 0xb7, 0xc2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8a, 0xce, 0x81, 0xc8, 0x59, 0x05, 0x00,
|
||||||
|
0x00,
|
||||||
|
}
|
||||||
131
accounts/usbwallet/trezor/messages-ethereum.proto
Normal file
131
accounts/usbwallet/trezor/messages-ethereum.proto
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
// This file originates from the SatoshiLabs Trezor `common` repository at:
|
||||||
|
// https://github.com/trezor/trezor-common/blob/master/protob/messages-ethereum.proto
|
||||||
|
// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
package hw.trezor.messages.ethereum;
|
||||||
|
|
||||||
|
// Sugar for easier handling in Java
|
||||||
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
||||||
|
option java_outer_classname = "TrezorMessageEthereum";
|
||||||
|
|
||||||
|
import "messages-common.proto";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for public key corresponding to address_n path
|
||||||
|
* @start
|
||||||
|
* @next EthereumPublicKey
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumGetPublicKey {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bool show_display = 2; // optionally show on display before sending the result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Contains public key derived from device private seed
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message EthereumPublicKey {
|
||||||
|
optional hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node
|
||||||
|
optional string xpub = 2; // serialized form of public node
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for Ethereum address corresponding to address_n path
|
||||||
|
* @start
|
||||||
|
* @next EthereumAddress
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumGetAddress {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bool show_display = 2; // optionally show on display before sending the result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Contains an Ethereum address derived from device private seed
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message EthereumAddress {
|
||||||
|
optional bytes addressBin = 1; // Ethereum address as 20 bytes (legacy firmwares)
|
||||||
|
optional string addressHex = 2; // Ethereum address as hex string (newer firmwares)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to sign transaction
|
||||||
|
* All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
||||||
|
* Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
||||||
|
* @start
|
||||||
|
* @next EthereumTxRequest
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumSignTx {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bytes nonce = 2; // <=256 bit unsigned big endian
|
||||||
|
optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
||||||
|
optional bytes gas_limit = 4; // <=256 bit unsigned big endian
|
||||||
|
optional bytes toBin = 5; // recipient address (20 bytes, legacy firmware)
|
||||||
|
optional string toHex = 11; // recipient address (hex string, newer firmware)
|
||||||
|
optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
|
||||||
|
optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
|
||||||
|
optional uint32 data_length = 8; // Length of transaction payload
|
||||||
|
optional uint32 chain_id = 9; // Chain Id for EIP 155
|
||||||
|
optional uint32 tx_type = 10; // (only for Wanchain)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device asks for more data from transaction payload, or returns the signature.
|
||||||
|
* If data_length is set, device awaits that many more bytes of payload.
|
||||||
|
* Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
||||||
|
* @end
|
||||||
|
* @next EthereumTxAck
|
||||||
|
*/
|
||||||
|
message EthereumTxRequest {
|
||||||
|
optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
|
||||||
|
optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
|
||||||
|
optional bytes signature_r = 3; // Computed signature R component (256 bit)
|
||||||
|
optional bytes signature_s = 4; // Computed signature S component (256 bit)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Transaction payload data.
|
||||||
|
* @next EthereumTxRequest
|
||||||
|
*/
|
||||||
|
message EthereumTxAck {
|
||||||
|
optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to sign message
|
||||||
|
* @start
|
||||||
|
* @next EthereumMessageSignature
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumSignMessage {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bytes message = 2; // message to be signed
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Signed message
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message EthereumMessageSignature {
|
||||||
|
optional bytes addressBin = 1; // address used to sign the message (20 bytes, legacy firmware)
|
||||||
|
optional bytes signature = 2; // signature of the message
|
||||||
|
optional string addressHex = 3; // address used to sign the message (hex string, newer firmware)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to verify message
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumVerifyMessage {
|
||||||
|
optional bytes addressBin = 1; // address to verify (20 bytes, legacy firmware)
|
||||||
|
optional bytes signature = 2; // signature to verify
|
||||||
|
optional bytes message = 3; // message to verify
|
||||||
|
optional string addressHex = 4; // address to verify (hex string, newer firmware)
|
||||||
|
}
|
||||||
1621
accounts/usbwallet/trezor/messages-management.pb.go
Normal file
1621
accounts/usbwallet/trezor/messages-management.pb.go
Normal file
File diff suppressed because it is too large
Load diff
289
accounts/usbwallet/trezor/messages-management.proto
Normal file
289
accounts/usbwallet/trezor/messages-management.proto
Normal file
|
|
@ -0,0 +1,289 @@
|
||||||
|
// This file originates from the SatoshiLabs Trezor `common` repository at:
|
||||||
|
// https://github.com/trezor/trezor-common/blob/master/protob/messages-management.proto
|
||||||
|
// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
package hw.trezor.messages.management;
|
||||||
|
|
||||||
|
// Sugar for easier handling in Java
|
||||||
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
||||||
|
option java_outer_classname = "TrezorMessageManagement";
|
||||||
|
|
||||||
|
import "messages-common.proto";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Reset device to default state and ask for device details
|
||||||
|
* @start
|
||||||
|
* @next Features
|
||||||
|
*/
|
||||||
|
message Initialize {
|
||||||
|
optional bytes state = 1; // assumed device state, clear session if set and different
|
||||||
|
optional bool skip_passphrase = 2; // this session should always assume empty passphrase
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask for device details (no device reset)
|
||||||
|
* @start
|
||||||
|
* @next Features
|
||||||
|
*/
|
||||||
|
message GetFeatures {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Reports various information about the device
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message Features {
|
||||||
|
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
|
||||||
|
optional uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
|
||||||
|
optional uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
|
||||||
|
optional uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
|
||||||
|
optional bool bootloader_mode = 5; // is device in bootloader mode?
|
||||||
|
optional string device_id = 6; // device's unique identifier
|
||||||
|
optional bool pin_protection = 7; // is device protected by PIN?
|
||||||
|
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
|
||||||
|
optional string language = 9; // device language
|
||||||
|
optional string label = 10; // device description label
|
||||||
|
optional bool initialized = 12; // does device contain seed?
|
||||||
|
optional bytes revision = 13; // SCM revision of firmware
|
||||||
|
optional bytes bootloader_hash = 14; // hash of the bootloader
|
||||||
|
optional bool imported = 15; // was storage imported from an external source?
|
||||||
|
optional bool pin_cached = 16; // is PIN already cached in session?
|
||||||
|
optional bool passphrase_cached = 17; // is passphrase already cached in session?
|
||||||
|
optional bool firmware_present = 18; // is valid firmware loaded?
|
||||||
|
optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
|
||||||
|
optional uint32 flags = 20; // device flags (equals to Storage.flags)
|
||||||
|
optional string model = 21; // device hardware model
|
||||||
|
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
|
||||||
|
optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode
|
||||||
|
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
|
||||||
|
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
|
||||||
|
optional bytes fw_vendor_keys = 26; // reported firmware vendor keys (their hash)
|
||||||
|
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
|
||||||
|
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: clear session (removes cached PIN, passphrase, etc).
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
*/
|
||||||
|
message ClearSession {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: change language and/or label of the device
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message ApplySettings {
|
||||||
|
optional string language = 1;
|
||||||
|
optional string label = 2;
|
||||||
|
optional bool use_passphrase = 3;
|
||||||
|
optional bytes homescreen = 4;
|
||||||
|
optional PassphraseSourceType passphrase_source = 5;
|
||||||
|
optional uint32 auto_lock_delay_ms = 6;
|
||||||
|
optional uint32 display_rotation = 7; // in degrees from North
|
||||||
|
/**
|
||||||
|
* Structure representing passphrase source
|
||||||
|
*/
|
||||||
|
enum PassphraseSourceType {
|
||||||
|
ASK = 0;
|
||||||
|
DEVICE = 1;
|
||||||
|
HOST = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: set flags of the device
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message ApplyFlags {
|
||||||
|
optional uint32 flags = 1; // bitmask, can only set bits, not unset
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Starts workflow for setting/changing/removing the PIN
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message ChangePin {
|
||||||
|
optional bool remove = 1; // is PIN removal requested?
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Test if the device is alive, device sends back the message in Success response
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
*/
|
||||||
|
message Ping {
|
||||||
|
optional string message = 1; // message to send back in Success message
|
||||||
|
optional bool button_protection = 2; // ask for button press
|
||||||
|
optional bool pin_protection = 3; // ask for PIN if set in device
|
||||||
|
optional bool passphrase_protection = 4; // ask for passphrase if set in device
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Abort last operation that required user interaction
|
||||||
|
* @start
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message Cancel {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Request a sample of random data generated by hardware RNG. May be used for testing.
|
||||||
|
* @start
|
||||||
|
* @next Entropy
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message GetEntropy {
|
||||||
|
required uint32 size = 1; // size of requested entropy
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Reply with random data generated by internal RNG
|
||||||
|
* @end
|
||||||
|
*/
|
||||||
|
message Entropy {
|
||||||
|
required bytes entropy = 1; // chunk of random generated bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Request device to wipe all sensitive data and settings
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message WipeDevice {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Load seed and related internal settings from the computer
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message LoadDevice {
|
||||||
|
optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words)
|
||||||
|
optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 node
|
||||||
|
optional string pin = 3; // set PIN protection
|
||||||
|
optional bool passphrase_protection = 4; // enable master node encryption using passphrase
|
||||||
|
optional string language = 5 [default='english']; // device language
|
||||||
|
optional string label = 6; // device label
|
||||||
|
optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum
|
||||||
|
optional uint32 u2f_counter = 8; // U2F counter
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to do initialization involving user interaction
|
||||||
|
* @start
|
||||||
|
* @next EntropyRequest
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message ResetDevice {
|
||||||
|
optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy
|
||||||
|
optional uint32 strength = 2 [default=256]; // strength of seed in bits
|
||||||
|
optional bool passphrase_protection = 3; // enable master node encryption using passphrase
|
||||||
|
optional bool pin_protection = 4; // enable PIN protection
|
||||||
|
optional string language = 5 [default='english']; // device language
|
||||||
|
optional string label = 6; // device label
|
||||||
|
optional uint32 u2f_counter = 7; // U2F counter
|
||||||
|
optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow
|
||||||
|
optional bool no_backup = 9; // indicate that no backup is going to be made
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Perform backup of the device seed if not backed up using ResetDevice
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
*/
|
||||||
|
message BackupDevice {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Ask for additional entropy from host computer
|
||||||
|
* @next EntropyAck
|
||||||
|
*/
|
||||||
|
message EntropyRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Provide additional entropy for seed generation function
|
||||||
|
* @next Success
|
||||||
|
*/
|
||||||
|
message EntropyAck {
|
||||||
|
optional bytes entropy = 1; // 256 bits (32 bytes) of random data
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Start recovery workflow asking user for specific words of mnemonic
|
||||||
|
* Used to recovery device safely even on untrusted computer.
|
||||||
|
* @start
|
||||||
|
* @next WordRequest
|
||||||
|
*/
|
||||||
|
message RecoveryDevice {
|
||||||
|
optional uint32 word_count = 1; // number of words in BIP-39 mnemonic
|
||||||
|
optional bool passphrase_protection = 2; // enable master node encryption using passphrase
|
||||||
|
optional bool pin_protection = 3; // enable PIN protection
|
||||||
|
optional string language = 4 [default='english']; // device language
|
||||||
|
optional string label = 5; // device label
|
||||||
|
optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process
|
||||||
|
// 7 reserved for unused recovery method
|
||||||
|
optional RecoveryDeviceType type = 8; // supported recovery type
|
||||||
|
optional uint32 u2f_counter = 9; // U2F counter
|
||||||
|
optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation)
|
||||||
|
/**
|
||||||
|
* Type of recovery procedure. These should be used as bitmask, e.g.,
|
||||||
|
* `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
|
||||||
|
* listing every method supported by the host computer.
|
||||||
|
*
|
||||||
|
* Note that ScrambledWords must be supported by every implementation
|
||||||
|
* for backward compatibility; there is no way to not support it.
|
||||||
|
*/
|
||||||
|
enum RecoveryDeviceType {
|
||||||
|
// use powers of two when extending this field
|
||||||
|
RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order
|
||||||
|
RecoveryDeviceType_Matrix = 1; // matrix recovery type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device is waiting for user to enter word of the mnemonic
|
||||||
|
* Its position is shown only on device's internal display.
|
||||||
|
* @next WordAck
|
||||||
|
*/
|
||||||
|
message WordRequest {
|
||||||
|
optional WordRequestType type = 1;
|
||||||
|
/**
|
||||||
|
* Type of Recovery Word request
|
||||||
|
*/
|
||||||
|
enum WordRequestType {
|
||||||
|
WordRequestType_Plain = 0;
|
||||||
|
WordRequestType_Matrix9 = 1;
|
||||||
|
WordRequestType_Matrix6 = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Computer replies with word from the mnemonic
|
||||||
|
* @next WordRequest
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message WordAck {
|
||||||
|
required string word = 1; // one word of mnemonic on asked position
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Set U2F counter
|
||||||
|
* @start
|
||||||
|
* @next Success
|
||||||
|
*/
|
||||||
|
message SetU2FCounter {
|
||||||
|
optional uint32 u2f_counter = 1; // counter
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 The go-ethereum Authors
|
// Copyright 2019 The go-ethereum Authors
|
||||||
// This file is part of the go-ethereum library.
|
// This file is part of the go-ethereum library.
|
||||||
//
|
//
|
||||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
|
@ -16,11 +16,35 @@
|
||||||
|
|
||||||
// This file contains the implementation for interacting with the Trezor hardware
|
// This file contains the implementation for interacting with the Trezor hardware
|
||||||
// wallets. The wire protocol spec can be found on the SatoshiLabs website:
|
// wallets. The wire protocol spec can be found on the SatoshiLabs website:
|
||||||
// https://doc.satoshilabs.com/trezor-tech/api-protobuf.html
|
// https://wiki.trezor.io/Developers_guide-Message_Workflows
|
||||||
|
|
||||||
//go:generate protoc --go_out=import_path=trezor:. types.proto messages.proto
|
// !!! STAHP !!!
|
||||||
|
//
|
||||||
|
// Before you touch the protocol files, you need to be aware of a breaking change
|
||||||
|
// that occurred between firmware versions 1.7.3->1.8.0 (Model One) and 2.0.10->
|
||||||
|
// 2.1.0 (Model T). The Ethereum address representation was changed from the 20
|
||||||
|
// byte binary blob to a 42 byte hex string. The upstream protocol buffer files
|
||||||
|
// only support the new format, so blindly pulling in a new spec will break old
|
||||||
|
// devices!
|
||||||
|
//
|
||||||
|
// The Trezor devs had the foresight to add the string version as a new message
|
||||||
|
// code instead of replacing the binary one. This means that the proto file can
|
||||||
|
// actually define both the old and the new versions as optional. Please ensure
|
||||||
|
// that you add back the old addresses everywhere (to avoid name clash. use the
|
||||||
|
// addressBin and addressHex names).
|
||||||
|
//
|
||||||
|
// If in doubt, reach out to @karalabe.
|
||||||
|
|
||||||
// Package trezor contains the wire protocol wrapper in Go.
|
// To regenerate the protocol files in this package:
|
||||||
|
// - Download the latest protoc https://github.com/protocolbuffers/protobuf/releases
|
||||||
|
// - Build with the usual `./configure && make` and ensure it's on your $PATH
|
||||||
|
// - Delete all the .proto and .pb.go files, pull in fresh ones from Trezor
|
||||||
|
// - Grab the latest Go plugin `go get -u github.com/golang/protobuf/protoc-gen-go`
|
||||||
|
// - Vendor in the latest Go plugin `govendor fetch github.com/golang/protobuf/...`
|
||||||
|
|
||||||
|
//go:generate protoc -I/usr/local/include:. --go_out=import_path=trezor:. messages.proto messages-common.proto messages-management.proto messages-ethereum.proto
|
||||||
|
|
||||||
|
// Package trezor contains the wire protocol.
|
||||||
package trezor
|
package trezor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,278 +0,0 @@
|
||||||
// This file originates from the SatoshiLabs Trezor `common` repository at:
|
|
||||||
// https://github.com/trezor/trezor-common/blob/master/protob/types.proto
|
|
||||||
// dated 28.07.2017, commit dd8ec3231fb5f7992360aff9bdfe30bb58130f4b.
|
|
||||||
|
|
||||||
syntax = "proto2";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Types for TREZOR communication
|
|
||||||
*
|
|
||||||
* @author Marek Palatinus <slush@satoshilabs.com>
|
|
||||||
* @version 1.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Sugar for easier handling in Java
|
|
||||||
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
|
||||||
option java_outer_classname = "TrezorType";
|
|
||||||
|
|
||||||
import "google/protobuf/descriptor.proto";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options for specifying message direction and type of wire (normal/debug)
|
|
||||||
*/
|
|
||||||
extend google.protobuf.EnumValueOptions {
|
|
||||||
optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR
|
|
||||||
optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC
|
|
||||||
optional bool wire_debug_in = 50004; // message can be transmitted via debug wire from PC to TREZOR
|
|
||||||
optional bool wire_debug_out = 50005; // message can be transmitted via debug wire from TREZOR to PC
|
|
||||||
optional bool wire_tiny = 50006; // message is handled by TREZOR when the USB stack is in tiny mode
|
|
||||||
optional bool wire_bootloader = 50007; // message is only handled by TREZOR Bootloader
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of failures returned by Failure message
|
|
||||||
* @used_in Failure
|
|
||||||
*/
|
|
||||||
enum FailureType {
|
|
||||||
Failure_UnexpectedMessage = 1;
|
|
||||||
Failure_ButtonExpected = 2;
|
|
||||||
Failure_DataError = 3;
|
|
||||||
Failure_ActionCancelled = 4;
|
|
||||||
Failure_PinExpected = 5;
|
|
||||||
Failure_PinCancelled = 6;
|
|
||||||
Failure_PinInvalid = 7;
|
|
||||||
Failure_InvalidSignature = 8;
|
|
||||||
Failure_ProcessError = 9;
|
|
||||||
Failure_NotEnoughFunds = 10;
|
|
||||||
Failure_NotInitialized = 11;
|
|
||||||
Failure_FirmwareError = 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of script which will be used for transaction output
|
|
||||||
* @used_in TxOutputType
|
|
||||||
*/
|
|
||||||
enum OutputScriptType {
|
|
||||||
PAYTOADDRESS = 0; // used for all addresses (bitcoin, p2sh, witness)
|
|
||||||
PAYTOSCRIPTHASH = 1; // p2sh address (deprecated; use PAYTOADDRESS)
|
|
||||||
PAYTOMULTISIG = 2; // only for change output
|
|
||||||
PAYTOOPRETURN = 3; // op_return
|
|
||||||
PAYTOWITNESS = 4; // only for change output
|
|
||||||
PAYTOP2SHWITNESS = 5; // only for change output
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of script which will be used for transaction output
|
|
||||||
* @used_in TxInputType
|
|
||||||
*/
|
|
||||||
enum InputScriptType {
|
|
||||||
SPENDADDRESS = 0; // standard p2pkh address
|
|
||||||
SPENDMULTISIG = 1; // p2sh multisig address
|
|
||||||
EXTERNAL = 2; // reserved for external inputs (coinjoin)
|
|
||||||
SPENDWITNESS = 3; // native segwit
|
|
||||||
SPENDP2SHWITNESS = 4; // segwit over p2sh (backward compatible)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of information required by transaction signing process
|
|
||||||
* @used_in TxRequest
|
|
||||||
*/
|
|
||||||
enum RequestType {
|
|
||||||
TXINPUT = 0;
|
|
||||||
TXOUTPUT = 1;
|
|
||||||
TXMETA = 2;
|
|
||||||
TXFINISHED = 3;
|
|
||||||
TXEXTRADATA = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of button request
|
|
||||||
* @used_in ButtonRequest
|
|
||||||
*/
|
|
||||||
enum ButtonRequestType {
|
|
||||||
ButtonRequest_Other = 1;
|
|
||||||
ButtonRequest_FeeOverThreshold = 2;
|
|
||||||
ButtonRequest_ConfirmOutput = 3;
|
|
||||||
ButtonRequest_ResetDevice = 4;
|
|
||||||
ButtonRequest_ConfirmWord = 5;
|
|
||||||
ButtonRequest_WipeDevice = 6;
|
|
||||||
ButtonRequest_ProtectCall = 7;
|
|
||||||
ButtonRequest_SignTx = 8;
|
|
||||||
ButtonRequest_FirmwareCheck = 9;
|
|
||||||
ButtonRequest_Address = 10;
|
|
||||||
ButtonRequest_PublicKey = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of PIN request
|
|
||||||
* @used_in PinMatrixRequest
|
|
||||||
*/
|
|
||||||
enum PinMatrixRequestType {
|
|
||||||
PinMatrixRequestType_Current = 1;
|
|
||||||
PinMatrixRequestType_NewFirst = 2;
|
|
||||||
PinMatrixRequestType_NewSecond = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of recovery procedure. These should be used as bitmask, e.g.,
|
|
||||||
* `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
|
|
||||||
* listing every method supported by the host computer.
|
|
||||||
*
|
|
||||||
* Note that ScrambledWords must be supported by every implementation
|
|
||||||
* for backward compatibility; there is no way to not support it.
|
|
||||||
*
|
|
||||||
* @used_in RecoveryDevice
|
|
||||||
*/
|
|
||||||
enum RecoveryDeviceType {
|
|
||||||
// use powers of two when extending this field
|
|
||||||
RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order
|
|
||||||
RecoveryDeviceType_Matrix = 1; // matrix recovery type
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of Recovery Word request
|
|
||||||
* @used_in WordRequest
|
|
||||||
*/
|
|
||||||
enum WordRequestType {
|
|
||||||
WordRequestType_Plain = 0;
|
|
||||||
WordRequestType_Matrix9 = 1;
|
|
||||||
WordRequestType_Matrix6 = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing BIP32 (hierarchical deterministic) node
|
|
||||||
* Used for imports of private key into the device and exporting public key out of device
|
|
||||||
* @used_in PublicKey
|
|
||||||
* @used_in LoadDevice
|
|
||||||
* @used_in DebugLinkState
|
|
||||||
* @used_in Storage
|
|
||||||
*/
|
|
||||||
message HDNodeType {
|
|
||||||
required uint32 depth = 1;
|
|
||||||
required uint32 fingerprint = 2;
|
|
||||||
required uint32 child_num = 3;
|
|
||||||
required bytes chain_code = 4;
|
|
||||||
optional bytes private_key = 5;
|
|
||||||
optional bytes public_key = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message HDNodePathType {
|
|
||||||
required HDNodeType node = 1; // BIP-32 node in deserialized form
|
|
||||||
repeated uint32 address_n = 2; // BIP-32 path to derive the key from node
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing Coin
|
|
||||||
* @used_in Features
|
|
||||||
*/
|
|
||||||
message CoinType {
|
|
||||||
optional string coin_name = 1;
|
|
||||||
optional string coin_shortcut = 2;
|
|
||||||
optional uint32 address_type = 3 [default=0];
|
|
||||||
optional uint64 maxfee_kb = 4;
|
|
||||||
optional uint32 address_type_p2sh = 5 [default=5];
|
|
||||||
optional string signed_message_header = 8;
|
|
||||||
optional uint32 xpub_magic = 9 [default=76067358]; // default=0x0488b21e
|
|
||||||
optional uint32 xprv_magic = 10 [default=76066276]; // default=0x0488ade4
|
|
||||||
optional bool segwit = 11;
|
|
||||||
optional uint32 forkid = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of redeem script used in input
|
|
||||||
* @used_in TxInputType
|
|
||||||
*/
|
|
||||||
message MultisigRedeemScriptType {
|
|
||||||
repeated HDNodePathType pubkeys = 1; // pubkeys from multisig address (sorted lexicographically)
|
|
||||||
repeated bytes signatures = 2; // existing signatures for partially signed input
|
|
||||||
optional uint32 m = 3; // "m" from n, how many valid signatures is necessary for spending
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing transaction input
|
|
||||||
* @used_in SimpleSignTx
|
|
||||||
* @used_in TransactionType
|
|
||||||
*/
|
|
||||||
message TxInputType {
|
|
||||||
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
||||||
required bytes prev_hash = 2; // hash of previous transaction output to spend by this input
|
|
||||||
required uint32 prev_index = 3; // index of previous output to spend
|
|
||||||
optional bytes script_sig = 4; // script signature, unset for tx to sign
|
|
||||||
optional uint32 sequence = 5 [default=4294967295]; // sequence (default=0xffffffff)
|
|
||||||
optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script
|
|
||||||
optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx
|
|
||||||
optional uint64 amount = 8; // amount of previous transaction output (for segwit only)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing transaction output
|
|
||||||
* @used_in SimpleSignTx
|
|
||||||
* @used_in TransactionType
|
|
||||||
*/
|
|
||||||
message TxOutputType {
|
|
||||||
optional string address = 1; // target coin address in Base58 encoding
|
|
||||||
repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address"
|
|
||||||
required uint64 amount = 3; // amount to spend in satoshis
|
|
||||||
required OutputScriptType script_type = 4; // output script type
|
|
||||||
optional MultisigRedeemScriptType multisig = 5; // defines multisig address; script_type must be PAYTOMULTISIG
|
|
||||||
optional bytes op_return_data = 6; // defines op_return data; script_type must be PAYTOOPRETURN, amount must be 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing compiled transaction output
|
|
||||||
* @used_in TransactionType
|
|
||||||
*/
|
|
||||||
message TxOutputBinType {
|
|
||||||
required uint64 amount = 1;
|
|
||||||
required bytes script_pubkey = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing transaction
|
|
||||||
* @used_in SimpleSignTx
|
|
||||||
*/
|
|
||||||
message TransactionType {
|
|
||||||
optional uint32 version = 1;
|
|
||||||
repeated TxInputType inputs = 2;
|
|
||||||
repeated TxOutputBinType bin_outputs = 3;
|
|
||||||
repeated TxOutputType outputs = 5;
|
|
||||||
optional uint32 lock_time = 4;
|
|
||||||
optional uint32 inputs_cnt = 6;
|
|
||||||
optional uint32 outputs_cnt = 7;
|
|
||||||
optional bytes extra_data = 8;
|
|
||||||
optional uint32 extra_data_len = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing request details
|
|
||||||
* @used_in TxRequest
|
|
||||||
*/
|
|
||||||
message TxRequestDetailsType {
|
|
||||||
optional uint32 request_index = 1; // device expects TxAck message from the computer
|
|
||||||
optional bytes tx_hash = 2; // tx_hash of requested transaction
|
|
||||||
optional uint32 extra_data_len = 3; // length of requested extra data
|
|
||||||
optional uint32 extra_data_offset = 4; // offset of requested extra data
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing serialized data
|
|
||||||
* @used_in TxRequest
|
|
||||||
*/
|
|
||||||
message TxRequestSerializedType {
|
|
||||||
optional uint32 signature_index = 1; // 'signature' field contains signed input of this index
|
|
||||||
optional bytes signature = 2; // signature of the signature_index input
|
|
||||||
optional bytes serialized_tx = 3; // part of serialized and signed transaction
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure representing identity data
|
|
||||||
* @used_in IdentityType
|
|
||||||
*/
|
|
||||||
message IdentityType {
|
|
||||||
optional string proto = 1; // proto part of URI
|
|
||||||
optional string user = 2; // user part of URI
|
|
||||||
optional string host = 3; // host part of URI
|
|
||||||
optional string port = 4; // port part of URI
|
|
||||||
optional string path = 5; // path part of URI
|
|
||||||
optional uint32 index = 6 [default=0]; // identity index
|
|
||||||
}
|
|
||||||
|
|
@ -31,7 +31,7 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||||
"github.com/XinFinOrg/XDPoSChain/crypto"
|
"github.com/XinFinOrg/XDPoSChain/crypto"
|
||||||
"github.com/XinFinOrg/XDPoSChain/log"
|
"github.com/XinFinOrg/XDPoSChain/log"
|
||||||
"github.com/karalabe/hid"
|
"github.com/karalabe/usb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Maximum time between wallet health checks to detect USB unplugs.
|
// Maximum time between wallet health checks to detect USB unplugs.
|
||||||
|
|
@ -77,8 +77,8 @@ type wallet struct {
|
||||||
driver driver // Hardware implementation of the low level device operations
|
driver driver // Hardware implementation of the low level device operations
|
||||||
url *accounts.URL // Textual URL uniquely identifying this wallet
|
url *accounts.URL // Textual URL uniquely identifying this wallet
|
||||||
|
|
||||||
info hid.DeviceInfo // Known USB device infos about the wallet
|
info usb.DeviceInfo // Known USB device infos about the wallet
|
||||||
device *hid.Device // USB device advertising itself as a hardware wallet
|
device usb.Device // USB device advertising itself as a hardware wallet
|
||||||
|
|
||||||
accounts []accounts.Account // List of derive accounts pinned on the hardware wallet
|
accounts []accounts.Account // List of derive accounts pinned on the hardware wallet
|
||||||
paths map[common.Address]accounts.DerivationPath // Known derivation paths for signing operations
|
paths map[common.Address]accounts.DerivationPath // Known derivation paths for signing operations
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -20,7 +20,6 @@ require (
|
||||||
github.com/huin/goupnp v1.3.0
|
github.com/huin/goupnp v1.3.0
|
||||||
github.com/jackpal/go-nat-pmp v1.0.2
|
github.com/jackpal/go-nat-pmp v1.0.2
|
||||||
github.com/julienschmidt/httprouter v1.3.0
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/karalabe/hid v1.0.0
|
|
||||||
github.com/mattn/go-colorable v0.1.13
|
github.com/mattn/go-colorable v0.1.13
|
||||||
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
|
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
|
|
@ -54,6 +53,7 @@ require (
|
||||||
github.com/go-yaml/yaml v2.1.0+incompatible
|
github.com/go-yaml/yaml v2.1.0+incompatible
|
||||||
github.com/influxdata/influxdb-client-go/v2 v2.4.0
|
github.com/influxdata/influxdb-client-go/v2 v2.4.0
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
|
github.com/karalabe/usb v0.0.2
|
||||||
github.com/kevinburke/go-bindata v3.23.0+incompatible
|
github.com/kevinburke/go-bindata v3.23.0+incompatible
|
||||||
github.com/kylelemons/godebug v1.1.0
|
github.com/kylelemons/godebug v1.1.0
|
||||||
github.com/mattn/go-isatty v0.0.17
|
github.com/mattn/go-isatty v0.0.17
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -111,8 +111,8 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd
|
||||||
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
||||||
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||||
github.com/karalabe/hid v1.0.0 h1:+/CIMNXhSU/zIJgnIvBD2nKHxS/bnRHhhs9xBryLpPo=
|
github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4=
|
||||||
github.com/karalabe/hid v1.0.0/go.mod h1:Vr51f8rUOLYrfrWDFlV12GGQgM5AT8sVh+2fY4MPeu8=
|
github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
||||||
github.com/kevinburke/go-bindata v3.23.0+incompatible h1:rqNOXZlqrYhMVVAsQx8wuc+LaA73YcfbQ407wAykyS8=
|
github.com/kevinburke/go-bindata v3.23.0+incompatible h1:rqNOXZlqrYhMVVAsQx8wuc+LaA73YcfbQ407wAykyS8=
|
||||||
github.com/kevinburke/go-bindata v3.23.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
|
github.com/kevinburke/go-bindata v3.23.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
|
||||||
github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4=
|
github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4=
|
||||||
|
|
|
||||||
|
|
@ -443,9 +443,15 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
|
||||||
} else {
|
} else {
|
||||||
backends = append(backends, ledgerhub)
|
backends = append(backends, ledgerhub)
|
||||||
}
|
}
|
||||||
// Start a USB hub for Trezor hardware wallets
|
// Start a USB hub for Trezor hardware wallets (HID version)
|
||||||
if trezorhub, err := usbwallet.NewTrezorHub(); err != nil {
|
if trezorhub, err := usbwallet.NewTrezorHubWithHID(); err != nil {
|
||||||
log.Warn(fmt.Sprintf("Failed to start Trezor hub, disabling: %v", err))
|
log.Warn(fmt.Sprintf("Failed to start HID Trezor hub, disabling: %v", err))
|
||||||
|
} else {
|
||||||
|
backends = append(backends, trezorhub)
|
||||||
|
}
|
||||||
|
// Start a USB hub for Trezor hardware wallets (WebUSB version)
|
||||||
|
if trezorhub, err := usbwallet.NewTrezorHubWithWebUSB(); err != nil {
|
||||||
|
log.Warn(fmt.Sprintf("Failed to start WebUSB Trezor hub, disabling: %v", err))
|
||||||
} else {
|
} else {
|
||||||
backends = append(backends, trezorhub)
|
backends = append(backends, trezorhub)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue