1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

common/protob: Add GetOwnershipId message.

This commit is contained in:
Andrew Kozlik 2020-06-16 17:17:26 +02:00 committed by Andrew Kozlik
parent 534bce3f86
commit 533de50588
11 changed files with 163 additions and 1 deletions

View File

@ -82,6 +82,27 @@ message Address {
required string address = 1; // Coin address in Base58 encoding
}
/**
* Request: Ask device for ownership identifier corresponding to scriptPubKey for address_n path
* @start
* @next OwnershipId
* @next Failure
*/
message GetOwnershipId {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional string coin_name = 2 [default='Bitcoin']; // coin to use
optional MultisigRedeemScriptType multisig = 3; // filled if we are dealing with a multisig scriptPubKey
optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
}
/**
* Response: Contains the ownership identifier for the scriptPubKey and device private seed
* @end
*/
message OwnershipId {
required bytes ownership_id = 1; // ownership identifier
}
/**
* Request: Ask device to sign message
* @start

View File

@ -87,6 +87,8 @@ enum MessageType {
MessageType_SignMessage = 38 [(wire_in) = true];
MessageType_VerifyMessage = 39 [(wire_in) = true];
MessageType_MessageSignature = 40 [(wire_out) = true];
MessageType_GetOwnershipId = 43 [(wire_in) = true];
MessageType_OwnershipId = 44 [(wire_out) = true];
MessageType_GetOwnershipProof = 49 [(wire_in) = true];
MessageType_OwnershipProof = 50 [(wire_out) = true];

View File

@ -0,0 +1,38 @@
# Automatically generated by pb2py
# fmt: off
import protobuf as p
from .MultisigRedeemScriptType import MultisigRedeemScriptType
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeInputScriptType = Literal[0, 1, 2, 3, 4]
except ImportError:
pass
class GetOwnershipId(p.MessageType):
MESSAGE_WIRE_TYPE = 43
def __init__(
self,
address_n: List[int] = None,
coin_name: str = None,
multisig: MultisigRedeemScriptType = None,
script_type: EnumTypeInputScriptType = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.coin_name = coin_name
self.multisig = multisig
self.script_type = script_type
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, 0), # default=Bitcoin
3: ('multisig', MultisigRedeemScriptType, 0),
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
}

View File

@ -55,6 +55,8 @@ Address = 30 # type: Literal[30]
SignMessage = 38 # type: Literal[38]
VerifyMessage = 39 # type: Literal[39]
MessageSignature = 40 # type: Literal[40]
GetOwnershipId = 43 # type: Literal[43]
OwnershipId = 44 # type: Literal[44]
GetOwnershipProof = 49 # type: Literal[49]
OwnershipProof = 50 # type: Literal[50]
CipherKeyValue = 23 # type: Literal[23]

View File

@ -0,0 +1,26 @@
# Automatically generated by pb2py
# fmt: off
import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class OwnershipId(p.MessageType):
MESSAGE_WIRE_TYPE = 44
def __init__(
self,
ownership_id: bytes = None,
) -> None:
self.ownership_id = ownership_id
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('ownership_id', p.BytesType, 0), # required
}

View File

@ -4,7 +4,7 @@ endif
SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \
DebugLinkRecordScreen DebugLinkReseedRandom DebugLinkShowText DebugLinkEraseSdCard DebugLinkWatchLayout \
GetOwnershipProof OwnershipProof
GetOwnershipProof OwnershipProof GetOwnershipId OwnershipId
ifeq ($(BITCOIN_ONLY), 1)
SKIPPED_MESSAGES += Ethereum Lisk NEM Stellar

View File

@ -59,3 +59,8 @@ GetOwnershipProof.commitment_data max_size:32
OwnershipProof.ownership_proof max_size:171
OwnershipProof.signature max_size:65
GetOwnershipId.address_n max_count:8
GetOwnershipId.coin_name max_size:21
OwnershipId.ownership_id max_size:32

View File

@ -0,0 +1,38 @@
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
from .MultisigRedeemScriptType import MultisigRedeemScriptType
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeInputScriptType = Literal[0, 1, 2, 3, 4]
except ImportError:
pass
class GetOwnershipId(p.MessageType):
MESSAGE_WIRE_TYPE = 43
def __init__(
self,
address_n: List[int] = None,
coin_name: str = None,
multisig: MultisigRedeemScriptType = None,
script_type: EnumTypeInputScriptType = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.coin_name = coin_name
self.multisig = multisig
self.script_type = script_type
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('coin_name', p.UnicodeType, 0), # default=Bitcoin
3: ('multisig', MultisigRedeemScriptType, 0),
4: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
}

View File

@ -53,6 +53,8 @@ Address = 30 # type: Literal[30]
SignMessage = 38 # type: Literal[38]
VerifyMessage = 39 # type: Literal[39]
MessageSignature = 40 # type: Literal[40]
GetOwnershipId = 43 # type: Literal[43]
OwnershipId = 44 # type: Literal[44]
GetOwnershipProof = 49 # type: Literal[49]
OwnershipProof = 50 # type: Literal[50]
CipherKeyValue = 23 # type: Literal[23]

View File

@ -0,0 +1,26 @@
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class OwnershipId(p.MessageType):
MESSAGE_WIRE_TYPE = 44
def __init__(
self,
ownership_id: bytes = None,
) -> None:
self.ownership_id = ownership_id
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('ownership_id', p.BytesType, 0), # required
}

View File

@ -111,6 +111,7 @@ from .GetECDHSessionKey import GetECDHSessionKey
from .GetEntropy import GetEntropy
from .GetFeatures import GetFeatures
from .GetNextU2FCounter import GetNextU2FCounter
from .GetOwnershipId import GetOwnershipId
from .GetOwnershipProof import GetOwnershipProof
from .GetPublicKey import GetPublicKey
from .HDNodePathType import HDNodePathType
@ -200,6 +201,7 @@ from .NEMSignedTx import NEMSignedTx
from .NEMTransactionCommon import NEMTransactionCommon
from .NEMTransfer import NEMTransfer
from .NextU2FCounter import NextU2FCounter
from .OwnershipId import OwnershipId
from .OwnershipProof import OwnershipProof
from .PassphraseAck import PassphraseAck
from .PassphraseRequest import PassphraseRequest