diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 0a7ec92903..c40eda7fc2 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -401,9 +401,10 @@ message TxOutput { optional bytes orig_hash = 10; // tx_hash of the original transaction where this output was present (used when creating a replacement transaction) optional uint32 orig_index = 11; // index of the output in the original transaction (used when creating a replacement transaction) optional uint32 payment_req_index = 12 [(experimental_field)=true]; // index of the PaymentRequest containing this output - optional string label = 13; - optional bytes label_sig = 14; - optional bytes label_pk = 15; + optional string label = 13; // label stored in Suite + optional bytes label_sig = 14; // sig(label|label_pk) stored in Suite, previously computed by Trezor + optional string label_pk = 15; // pubkey of the contact corresponding to the label + optional bytes address_pk_sig = 16; // signature of the address (signed by the receiver) } /** Data type for metadata about previous transaction which contains the UTXO being spent. diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index cd75c763e8..5d56c24113 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -780,7 +780,8 @@ if TYPE_CHECKING: payment_req_index: "int | None" label: "str | None" label_sig: "bytes | None" - label_pk: "bytes | None" + label_pk: "str | None" + address_pk_sig: "bytes | None" def __init__( self, @@ -796,7 +797,8 @@ if TYPE_CHECKING: payment_req_index: "int | None" = None, label: "str | None" = None, label_sig: "bytes | None" = None, - label_pk: "bytes | None" = None, + label_pk: "str | None" = None, + address_pk_sig: "bytes | None" = None, ) -> None: pass diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index e9377dab59..865c2cbcf4 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -1499,7 +1499,8 @@ class TxOutput(protobuf.MessageType): 12: protobuf.Field("payment_req_index", "uint32", repeated=False, required=False, default=None), 13: protobuf.Field("label", "string", repeated=False, required=False, default=None), 14: protobuf.Field("label_sig", "bytes", repeated=False, required=False, default=None), - 15: protobuf.Field("label_pk", "bytes", repeated=False, required=False, default=None), + 15: protobuf.Field("label_pk", "string", repeated=False, required=False, default=None), + 16: protobuf.Field("address_pk_sig", "bytes", repeated=False, required=False, default=None), } def __init__( @@ -1516,7 +1517,8 @@ class TxOutput(protobuf.MessageType): payment_req_index: Optional["int"] = None, label: Optional["str"] = None, label_sig: Optional["bytes"] = None, - label_pk: Optional["bytes"] = None, + label_pk: Optional["str"] = None, + address_pk_sig: Optional["bytes"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.amount = amount @@ -1530,6 +1532,7 @@ class TxOutput(protobuf.MessageType): self.label = label self.label_sig = label_sig self.label_pk = label_pk + self.address_pk_sig = address_pk_sig class PrevTx(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 f107bb3c58..2e85b92509 100644 --- a/rust/trezor-client/src/protos/generated/messages_bitcoin.rs +++ b/rust/trezor-client/src/protos/generated/messages_bitcoin.rs @@ -7977,7 +7977,9 @@ pub struct TxOutput { // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.label_sig) pub label_sig: ::std::option::Option<::std::vec::Vec>, // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.label_pk) - pub label_pk: ::std::option::Option<::std::vec::Vec>, + pub label_pk: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.bitcoin.TxOutput.address_pk_sig) + pub address_pk_sig: ::std::option::Option<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.bitcoin.TxOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -8253,12 +8255,12 @@ impl TxOutput { self.label_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // optional bytes label_pk = 15; + // optional string label_pk = 15; - pub fn label_pk(&self) -> &[u8] { + pub fn label_pk(&self) -> &str { match self.label_pk.as_ref() { Some(v) => v, - None => &[], + None => "", } } @@ -8271,26 +8273,62 @@ impl TxOutput { } // Param is passed by value, moved - pub fn set_label_pk(&mut self, v: ::std::vec::Vec) { + pub fn set_label_pk(&mut self, v: ::std::string::String) { self.label_pk = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_label_pk(&mut self) -> &mut ::std::vec::Vec { + pub fn mut_label_pk(&mut self) -> &mut ::std::string::String { if self.label_pk.is_none() { - self.label_pk = ::std::option::Option::Some(::std::vec::Vec::new()); + self.label_pk = ::std::option::Option::Some(::std::string::String::new()); } self.label_pk.as_mut().unwrap() } // Take field - pub fn take_label_pk(&mut self) -> ::std::vec::Vec { - self.label_pk.take().unwrap_or_else(|| ::std::vec::Vec::new()) + pub fn take_label_pk(&mut self) -> ::std::string::String { + self.label_pk.take().unwrap_or_else(|| ::std::string::String::new()) + } + + // optional bytes address_pk_sig = 16; + + pub fn address_pk_sig(&self) -> &[u8] { + match self.address_pk_sig.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_address_pk_sig(&mut self) { + self.address_pk_sig = ::std::option::Option::None; + } + + pub fn has_address_pk_sig(&self) -> bool { + self.address_pk_sig.is_some() + } + + // Param is passed by value, moved + pub fn set_address_pk_sig(&mut self, v: ::std::vec::Vec) { + self.address_pk_sig = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address_pk_sig(&mut self) -> &mut ::std::vec::Vec { + if self.address_pk_sig.is_none() { + self.address_pk_sig = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.address_pk_sig.as_mut().unwrap() + } + + // Take field + pub fn take_address_pk_sig(&mut self) -> ::std::vec::Vec { + self.address_pk_sig.take().unwrap_or_else(|| ::std::vec::Vec::new()) } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); + let mut fields = ::std::vec::Vec::with_capacity(13); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "address", @@ -8352,6 +8390,11 @@ impl TxOutput { |m: &TxOutput| { &m.label_pk }, |m: &mut TxOutput| { &mut m.label_pk }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "address_pk_sig", + |m: &TxOutput| { &m.address_pk_sig }, + |m: &mut TxOutput| { &mut m.address_pk_sig }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TxOutput", fields, @@ -8415,7 +8458,10 @@ impl ::protobuf::Message for TxOutput { self.label_sig = ::std::option::Option::Some(is.read_bytes()?); }, 122 => { - self.label_pk = ::std::option::Option::Some(is.read_bytes()?); + self.label_pk = ::std::option::Option::Some(is.read_string()?); + }, + 130 => { + self.address_pk_sig = ::std::option::Option::Some(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; @@ -8464,7 +8510,10 @@ impl ::protobuf::Message for TxOutput { my_size += ::protobuf::rt::bytes_size(14, &v); } if let Some(v) = self.label_pk.as_ref() { - my_size += ::protobuf::rt::bytes_size(15, &v); + my_size += ::protobuf::rt::string_size(15, &v); + } + if let Some(v) = self.address_pk_sig.as_ref() { + my_size += ::protobuf::rt::bytes_size(16, &v); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); @@ -8506,7 +8555,10 @@ impl ::protobuf::Message for TxOutput { os.write_bytes(14, v)?; } if let Some(v) = self.label_pk.as_ref() { - os.write_bytes(15, v)?; + os.write_string(15, v)?; + } + if let Some(v) = self.address_pk_sig.as_ref() { + os.write_bytes(16, v)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) @@ -8537,6 +8589,7 @@ impl ::protobuf::Message for TxOutput { self.label = ::std::option::Option::None; self.label_sig = ::std::option::Option::None; self.label_pk = ::std::option::Option::None; + self.address_pk_sig = ::std::option::Option::None; self.special_fields.clear(); } @@ -8554,6 +8607,7 @@ impl ::protobuf::Message for TxOutput { label: ::std::option::Option::None, label_sig: ::std::option::Option::None, label_pk: ::std::option::Option::None, + address_pk_sig: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -13810,7 +13864,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\ in.DecredStakingSpendTypeR\x12decredStakingSpend\x12#\n\rscript_pubkey\ \x18\x13\x20\x01(\x0cR\x0cscriptPubkey\x12(\n\x0ecoinjoin_flags\x18\x14\ \x20\x01(\r:\x010R\rcoinjoinFlagsJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\ - \x0cJ\x04\x08\x0c\x10\r\"\xfc\x03\n\x08TxOutput\x12\x18\n\x07address\x18\ + \x0cJ\x04\x08\x0c\x10\r\"\xa2\x04\n\x08TxOutput\x12\x18\n\x07address\x18\ \x01\x20\x01(\tR\x07address\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08\ addressN\x12\x16\n\x06amount\x18\x03\x20\x02(\x04R\x06amount\x12[\n\x0bs\ cript_type\x18\x04\x20\x01(\x0e2,.hw.trezor.messages.bitcoin.OutputScrip\ @@ -13821,44 +13875,45 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x0b\x20\x01(\rR\torigIndex\x120\n\x11payment_req_index\x18\x0c\x20\x01(\ \rR\x0fpaymentReqIndexB\x04\xc8\xf0\x19\x01\x12\x14\n\x05label\x18\r\x20\ \x01(\tR\x05label\x12\x1b\n\tlabel_sig\x18\x0e\x20\x01(\x0cR\x08labelSig\ - \x12\x19\n\x08label_pk\x18\x0f\x20\x01(\x0cR\x07labelPkJ\x04\x08\x07\x10\ - \x08J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xcb\x02\n\x06PrevTx\x12\x18\n\ - \x07version\x18\x01\x20\x02(\rR\x07version\x12\x1b\n\tlock_time\x18\x04\ - \x20\x02(\rR\x08lockTime\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\x0bi\ - nputsCount\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCount\x12\ - '\n\x0eextra_data_len\x18\t\x20\x01(\r:\x010R\x0cextraDataLen\x12\x16\n\ - \x06expiry\x18\n\x20\x01(\rR\x06expiry\x12(\n\x10version_group_id\x18\ - \x0c\x20\x01(\rR\x0eversionGroupId\x12\x1c\n\ttimestamp\x18\r\x20\x01(\r\ - R\ttimestamp\x12\x1b\n\tbranch_id\x18\x0e\x20\x01(\rR\x08branchIdJ\x04\ - \x08\x02\x10\x03J\x04\x08\x03\x10\x04J\x04\x08\x05\x10\x06J\x04\x08\x08\ - \x10\tJ\x04\x08\x0b\x10\x0c\"\xf7\x01\n\tPrevInput\x12\x1b\n\tprev_hash\ - \x18\x02\x20\x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02\ - (\rR\tprevIndex\x12\x1d\n\nscript_sig\x18\x04\x20\x02(\x0cR\tscriptSig\ - \x12\x1a\n\x08sequence\x18\x05\x20\x02(\rR\x08sequence\x12\x1f\n\x0bdecr\ - ed_tree\x18\t\x20\x01(\rR\ndecredTreeJ\x04\x08\x01\x10\x02J\x04\x08\x06\ - \x10\x07J\x04\x08\x07\x10\x08J\x04\x08\x08\x10\tJ\x04\x08\n\x10\x0bJ\x04\ - \x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rJ\x04\x08\r\x10\x0eJ\x04\x08\x0e\x10\ - \x0fJ\x04\x08\x0f\x10\x10J\x04\x08\x10\x10\x11J\x04\x08\x11\x10\x12J\x04\ - \x08\x12\x10\x13J\x04\x08\x13\x10\x14\"}\n\nPrevOutput\x12\x16\n\x06amou\ - nt\x18\x01\x20\x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02\ - (\x0cR\x0cscriptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\ - \rR\x13decredScriptVersion\"\xf2\x05\n\x13TxAckPaymentRequest\x12\x14\n\ - \x05nonce\x18\x01\x20\x01(\x0cR\x05nonce\x12%\n\x0erecipient_name\x18\ - \x02\x20\x02(\tR\rrecipientName\x12X\n\x05memos\x18\x03\x20\x03(\x0b2B.h\ - w.trezor.messages.bitcoin.TxAckPaymentRequest.PaymentRequestMemoR\x05mem\ - os\x12\x16\n\x06amount\x18\x04\x20\x01(\x04R\x06amount\x12\x1c\n\tsignat\ - ure\x18\x05\x20\x02(\x0cR\tsignature\x1a\xb8\x02\n\x12PaymentRequestMemo\ - \x12U\n\ttext_memo\x18\x01\x20\x01(\x0b28.hw.trezor.messages.bitcoin.TxA\ - ckPaymentRequest.TextMemoR\x08textMemo\x12[\n\x0brefund_memo\x18\x02\x20\ - \x01(\x0b2:.hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemoR\n\ - refundMemo\x12n\n\x12coin_purchase_memo\x18\x03\x20\x01(\x0b2@.hw.trezor\ - .messages.bitcoin.TxAckPaymentRequest.CoinPurchaseMemoR\x10coinPurchaseM\ - emo\x1a\x1e\n\x08TextMemo\x12\x12\n\x04text\x18\x01\x20\x02(\tR\x04text\ - \x1a8\n\nRefundMemo\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\ - \x12\x10\n\x03mac\x18\x02\x20\x02(\x0cR\x03mac\x1as\n\x10CoinPurchaseMem\ - o\x12\x1b\n\tcoin_type\x18\x01\x20\x02(\rR\x08coinType\x12\x16\n\x06amou\ - nt\x18\x02\x20\x02(\tR\x06amount\x12\x18\n\x07address\x18\x03\x20\x02(\t\ - R\x07address\x12\x10\n\x03mac\x18\x04\x20\x02(\x0cR\x03mac:\x04\x88\xb2\ + \x12\x19\n\x08label_pk\x18\x0f\x20\x01(\tR\x07labelPk\x12$\n\x0eaddress_\ + pk_sig\x18\x10\x20\x01(\x0cR\x0caddressPkSigJ\x04\x08\x07\x10\x08J\x04\ + \x08\x08\x10\tJ\x04\x08\t\x10\n\"\xcb\x02\n\x06PrevTx\x12\x18\n\x07versi\ + on\x18\x01\x20\x02(\rR\x07version\x12\x1b\n\tlock_time\x18\x04\x20\x02(\ + \rR\x08lockTime\x12!\n\x0cinputs_count\x18\x06\x20\x02(\rR\x0binputsCoun\ + t\x12#\n\routputs_count\x18\x07\x20\x02(\rR\x0coutputsCount\x12'\n\x0eex\ + tra_data_len\x18\t\x20\x01(\r:\x010R\x0cextraDataLen\x12\x16\n\x06expiry\ + \x18\n\x20\x01(\rR\x06expiry\x12(\n\x10version_group_id\x18\x0c\x20\x01(\ + \rR\x0eversionGroupId\x12\x1c\n\ttimestamp\x18\r\x20\x01(\rR\ttimestamp\ + \x12\x1b\n\tbranch_id\x18\x0e\x20\x01(\rR\x08branchIdJ\x04\x08\x02\x10\ + \x03J\x04\x08\x03\x10\x04J\x04\x08\x05\x10\x06J\x04\x08\x08\x10\tJ\x04\ + \x08\x0b\x10\x0c\"\xf7\x01\n\tPrevInput\x12\x1b\n\tprev_hash\x18\x02\x20\ + \x02(\x0cR\x08prevHash\x12\x1d\n\nprev_index\x18\x03\x20\x02(\rR\tprevIn\ + dex\x12\x1d\n\nscript_sig\x18\x04\x20\x02(\x0cR\tscriptSig\x12\x1a\n\x08\ + sequence\x18\x05\x20\x02(\rR\x08sequence\x12\x1f\n\x0bdecred_tree\x18\t\ + \x20\x01(\rR\ndecredTreeJ\x04\x08\x01\x10\x02J\x04\x08\x06\x10\x07J\x04\ + \x08\x07\x10\x08J\x04\x08\x08\x10\tJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\ + \x0cJ\x04\x08\x0c\x10\rJ\x04\x08\r\x10\x0eJ\x04\x08\x0e\x10\x0fJ\x04\x08\ + \x0f\x10\x10J\x04\x08\x10\x10\x11J\x04\x08\x11\x10\x12J\x04\x08\x12\x10\ + \x13J\x04\x08\x13\x10\x14\"}\n\nPrevOutput\x12\x16\n\x06amount\x18\x01\ + \x20\x02(\x04R\x06amount\x12#\n\rscript_pubkey\x18\x02\x20\x02(\x0cR\x0c\ + scriptPubkey\x122\n\x15decred_script_version\x18\x03\x20\x01(\rR\x13decr\ + edScriptVersion\"\xf2\x05\n\x13TxAckPaymentRequest\x12\x14\n\x05nonce\ + \x18\x01\x20\x01(\x0cR\x05nonce\x12%\n\x0erecipient_name\x18\x02\x20\x02\ + (\tR\rrecipientName\x12X\n\x05memos\x18\x03\x20\x03(\x0b2B.hw.trezor.mes\ + sages.bitcoin.TxAckPaymentRequest.PaymentRequestMemoR\x05memos\x12\x16\n\ + \x06amount\x18\x04\x20\x01(\x04R\x06amount\x12\x1c\n\tsignature\x18\x05\ + \x20\x02(\x0cR\tsignature\x1a\xb8\x02\n\x12PaymentRequestMemo\x12U\n\tte\ + xt_memo\x18\x01\x20\x01(\x0b28.hw.trezor.messages.bitcoin.TxAckPaymentRe\ + quest.TextMemoR\x08textMemo\x12[\n\x0brefund_memo\x18\x02\x20\x01(\x0b2:\ + .hw.trezor.messages.bitcoin.TxAckPaymentRequest.RefundMemoR\nrefundMemo\ + \x12n\n\x12coin_purchase_memo\x18\x03\x20\x01(\x0b2@.hw.trezor.messages.\ + bitcoin.TxAckPaymentRequest.CoinPurchaseMemoR\x10coinPurchaseMemo\x1a\ + \x1e\n\x08TextMemo\x12\x12\n\x04text\x18\x01\x20\x02(\tR\x04text\x1a8\n\ + \nRefundMemo\x12\x18\n\x07address\x18\x01\x20\x02(\tR\x07address\x12\x10\ + \n\x03mac\x18\x02\x20\x02(\x0cR\x03mac\x1as\n\x10CoinPurchaseMemo\x12\ + \x1b\n\tcoin_type\x18\x01\x20\x02(\rR\x08coinType\x12\x16\n\x06amount\ + \x18\x02\x20\x02(\tR\x06amount\x12\x18\n\x07address\x18\x03\x20\x02(\tR\ + \x07address\x12\x10\n\x03mac\x18\x04\x20\x02(\x0cR\x03mac:\x04\x88\xb2\ \x19\x01\"\xac\x01\n\nTxAckInput\x12H\n\x02tx\x18\x01\x20\x02(\x0b28.hw.\ trezor.messages.bitcoin.TxAckInput.TxAckInputWrapperR\x02tx\x1aN\n\x11Tx\ AckInputWrapper\x129\n\x05input\x18\x02\x20\x02(\x0b2#.hw.trezor.message\