diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 9635cc8beb..a5bc87838c 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -85,6 +85,7 @@ message GetPublicKey { optional string coin_name = 4 [default='Bitcoin']; // coin to use for verifying optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.) optional bool ignore_xpub_magic = 6; // ignore SLIP-0132 XPUB magic, use xpub/tpub prefix for all account types + optional bool multisig_xpub_magic = 7; // use Ypub/Zpub prefix for SegWit script types } /** diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 5a5bb25245..c6ca5141d8 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -482,6 +482,7 @@ if TYPE_CHECKING: coin_name: "str" script_type: "InputScriptType" ignore_xpub_magic: "bool | None" + multisig_xpub_magic: "bool | None" def __init__( self, @@ -492,6 +493,7 @@ if TYPE_CHECKING: coin_name: "str | None" = None, script_type: "InputScriptType | None" = None, ignore_xpub_magic: "bool | None" = None, + multisig_xpub_magic: "bool | None" = None, ) -> None: pass diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index d8ca51fc8e..0269713294 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -1108,6 +1108,7 @@ class GetPublicKey(protobuf.MessageType): 4: protobuf.Field("coin_name", "string", repeated=False, required=False, default='Bitcoin'), 5: protobuf.Field("script_type", "InputScriptType", repeated=False, required=False, default=InputScriptType.SPENDADDRESS), 6: protobuf.Field("ignore_xpub_magic", "bool", repeated=False, required=False, default=None), + 7: protobuf.Field("multisig_xpub_magic", "bool", repeated=False, required=False, default=None), } def __init__( @@ -1119,6 +1120,7 @@ class GetPublicKey(protobuf.MessageType): coin_name: Optional["str"] = 'Bitcoin', script_type: Optional["InputScriptType"] = InputScriptType.SPENDADDRESS, ignore_xpub_magic: Optional["bool"] = None, + multisig_xpub_magic: Optional["bool"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.ecdsa_curve_name = ecdsa_curve_name @@ -1126,6 +1128,7 @@ class GetPublicKey(protobuf.MessageType): self.coin_name = coin_name self.script_type = script_type self.ignore_xpub_magic = ignore_xpub_magic + self.multisig_xpub_magic = multisig_xpub_magic class PublicKey(protobuf.MessageType): diff --git a/rust/trezor-client/src/protos/generated/messages_bitcoin.rs b/rust/trezor-client/src/protos/generated/messages_bitcoin.rs index 4cd79fe34f..5edfa6a78b 100644 --- a/rust/trezor-client/src/protos/generated/messages_bitcoin.rs +++ b/rust/trezor-client/src/protos/generated/messages_bitcoin.rs @@ -427,6 +427,8 @@ pub struct GetPublicKey { pub script_type: ::std::option::Option<::protobuf::EnumOrUnknown>, // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.ignore_xpub_magic) pub ignore_xpub_magic: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.GetPublicKey.multisig_xpub_magic) + pub multisig_xpub_magic: ::std::option::Option, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.GetPublicKey.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -575,8 +577,27 @@ impl GetPublicKey { self.ignore_xpub_magic = ::std::option::Option::Some(v); } + // optional bool multisig_xpub_magic = 7; + + pub fn multisig_xpub_magic(&self) -> bool { + self.multisig_xpub_magic.unwrap_or(false) + } + + pub fn clear_multisig_xpub_magic(&mut self) { + self.multisig_xpub_magic = ::std::option::Option::None; + } + + pub fn has_multisig_xpub_magic(&self) -> bool { + self.multisig_xpub_magic.is_some() + } + + // Param is passed by value, moved + pub fn set_multisig_xpub_magic(&mut self, v: bool) { + self.multisig_xpub_magic = ::std::option::Option::Some(v); + } + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(6); + let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "address_n", @@ -608,6 +629,11 @@ impl GetPublicKey { |m: &GetPublicKey| { &m.ignore_xpub_magic }, |m: &mut GetPublicKey| { &mut m.ignore_xpub_magic }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "multisig_xpub_magic", + |m: &GetPublicKey| { &m.multisig_xpub_magic }, + |m: &mut GetPublicKey| { &mut m.multisig_xpub_magic }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "GetPublicKey", fields, @@ -647,6 +673,9 @@ impl ::protobuf::Message for GetPublicKey { 48 => { self.ignore_xpub_magic = ::std::option::Option::Some(is.read_bool()?); }, + 56 => { + self.multisig_xpub_magic = ::std::option::Option::Some(is.read_bool()?); + }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -677,6 +706,9 @@ impl ::protobuf::Message for GetPublicKey { if let Some(v) = self.ignore_xpub_magic { my_size += 1 + 1; } + if let Some(v) = self.multisig_xpub_magic { + my_size += 1 + 1; + } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size @@ -701,6 +733,9 @@ impl ::protobuf::Message for GetPublicKey { if let Some(v) = self.ignore_xpub_magic { os.write_bool(6, v)?; } + if let Some(v) = self.multisig_xpub_magic { + os.write_bool(7, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -724,6 +759,7 @@ impl ::protobuf::Message for GetPublicKey { self.coin_name = ::std::option::Option::None; self.script_type = ::std::option::Option::None; self.ignore_xpub_magic = ::std::option::Option::None; + self.multisig_xpub_magic = ::std::option::Option::None; self.special_fields.clear(); } @@ -735,6 +771,7 @@ impl ::protobuf::Message for GetPublicKey { coin_name: ::std::option::Option::None, script_type: ::std::option::Option::None, ignore_xpub_magic: ::std::option::Option::None, + multisig_xpub_magic: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -13354,13 +13391,14 @@ static file_descriptor_proto_data: &'static [u8] = b"\ HDNodeTypeR\x05nodes\x12\x1b\n\taddress_n\x18\x05\x20\x03(\rR\x08address\ N\x1ah\n\x0eHDNodePathType\x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trez\ or.messages.common.HDNodeTypeR\x04node\x12\x1b\n\taddress_n\x18\x02\x20\ - \x03(\rR\x08addressN\"\xa6\x02\n\x0cGetPublicKey\x12\x1b\n\taddress_n\ + \x03(\rR\x08addressN\"\xd6\x02\n\x0cGetPublicKey\x12\x1b\n\taddress_n\ \x18\x01\x20\x03(\rR\x08addressN\x12(\n\x10ecdsa_curve_name\x18\x02\x20\ \x01(\tR\x0eecdsaCurveName\x12!\n\x0cshow_display\x18\x03\x20\x01(\x08R\ \x0bshowDisplay\x12$\n\tcoin_name\x18\x04\x20\x01(\t:\x07BitcoinR\x08coi\ nName\x12Z\n\x0bscript_type\x18\x05\x20\x01(\x0e2+.hw.trezor.messages.bi\ tcoin.InputScriptType:\x0cSPENDADDRESSR\nscriptType\x12*\n\x11ignore_xpu\ - b_magic\x18\x06\x20\x01(\x08R\x0fignoreXpubMagic\"\xa5\x01\n\tPublicKey\ + b_magic\x18\x06\x20\x01(\x08R\x0fignoreXpubMagic\x12.\n\x13multisig_xpub\ + _magic\x18\x07\x20\x01(\x08R\x11multisigXpubMagic\"\xa5\x01\n\tPublicKey\ \x129\n\x04node\x18\x01\x20\x02(\x0b2%.hw.trezor.messages.common.HDNodeT\ ypeR\x04node\x12\x12\n\x04xpub\x18\x02\x20\x02(\tR\x04xpub\x12)\n\x10roo\ t_fingerprint\x18\x03\x20\x01(\rR\x0frootFingerprint\x12\x1e\n\ndescript\