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

feat(common): Add no_script_type option to SignMessage.

This commit is contained in:
Andrew Kozlik 2021-11-05 15:39:02 +01:00 committed by Andrew Kozlik
parent 0870befe58
commit c2f1850abb
4 changed files with 7 additions and 0 deletions

View File

@ -152,6 +152,7 @@ message SignMessage {
required bytes message = 2; // message to be signed required bytes message = 2; // message to be signed
optional string coin_name = 3 [default='Bitcoin']; // coin to use for signing optional string coin_name = 3 [default='Bitcoin']; // coin to use for signing
optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.) optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional bool no_script_type = 5; // don't include script type information in the recovery byte of the signature, same as in Bitcoin Core
} }
/** /**

View File

@ -526,6 +526,7 @@ if TYPE_CHECKING:
message: "bytes" message: "bytes"
coin_name: "str" coin_name: "str"
script_type: "InputScriptType" script_type: "InputScriptType"
no_script_type: "bool | None"
def __init__( def __init__(
self, self,
@ -534,6 +535,7 @@ if TYPE_CHECKING:
address_n: "list[int] | None" = None, address_n: "list[int] | None" = None,
coin_name: "str | None" = None, coin_name: "str | None" = None,
script_type: "InputScriptType | None" = None, script_type: "InputScriptType | None" = None,
no_script_type: "bool | None" = None,
) -> None: ) -> None:
pass pass

View File

@ -0,0 +1 @@
Support no_script_type option in SignMessage.

View File

@ -1067,6 +1067,7 @@ class SignMessage(protobuf.MessageType):
2: protobuf.Field("message", "bytes", repeated=False, required=True), 2: protobuf.Field("message", "bytes", repeated=False, required=True),
3: protobuf.Field("coin_name", "string", repeated=False, required=False), 3: protobuf.Field("coin_name", "string", repeated=False, required=False),
4: protobuf.Field("script_type", "InputScriptType", repeated=False, required=False), 4: protobuf.Field("script_type", "InputScriptType", repeated=False, required=False),
5: protobuf.Field("no_script_type", "bool", repeated=False, required=False),
} }
def __init__( def __init__(
@ -1076,11 +1077,13 @@ class SignMessage(protobuf.MessageType):
address_n: Optional[List["int"]] = None, address_n: Optional[List["int"]] = None,
coin_name: Optional["str"] = 'Bitcoin', coin_name: Optional["str"] = 'Bitcoin',
script_type: Optional["InputScriptType"] = InputScriptType.SPENDADDRESS, script_type: Optional["InputScriptType"] = InputScriptType.SPENDADDRESS,
no_script_type: Optional["bool"] = None,
) -> None: ) -> None:
self.address_n = address_n if address_n is not None else [] self.address_n = address_n if address_n is not None else []
self.message = message self.message = message
self.coin_name = coin_name self.coin_name = coin_name
self.script_type = script_type self.script_type = script_type
self.no_script_type = no_script_type
class MessageSignature(protobuf.MessageType): class MessageSignature(protobuf.MessageType):