mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-12 17:38:13 +00:00
feat(nostr): extend GetPublicKey with show_display
This commit is contained in:
parent
38936a1e00
commit
cb913addae
@ -15,7 +15,8 @@ option (include_in_bitcoin_only) = true;
|
|||||||
* @next NostrMessageSignature
|
* @next NostrMessageSignature
|
||||||
*/
|
*/
|
||||||
message NostrGetPubkey {
|
message NostrGetPubkey {
|
||||||
repeated uint32 address_n = 1; // used to derive the key
|
repeated uint32 address_n = 1; // used to derive the key
|
||||||
|
optional bool show_display = 2; // optionally show on display before sending the result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
core/src/trezor/messages.py
generated
2
core/src/trezor/messages.py
generated
@ -5194,11 +5194,13 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class NostrGetPubkey(protobuf.MessageType):
|
class NostrGetPubkey(protobuf.MessageType):
|
||||||
address_n: "list[int]"
|
address_n: "list[int]"
|
||||||
|
show_display: "bool | None"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
address_n: "list[int] | None" = None,
|
address_n: "list[int] | None" = None,
|
||||||
|
show_display: "bool | None" = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
3
python/src/trezorlib/messages.py
generated
3
python/src/trezorlib/messages.py
generated
@ -6771,14 +6771,17 @@ class NostrGetPubkey(protobuf.MessageType):
|
|||||||
MESSAGE_WIRE_TYPE = 2001
|
MESSAGE_WIRE_TYPE = 2001
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
|
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
|
||||||
|
2: protobuf.Field("show_display", "bool", repeated=False, required=False, default=None),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
address_n: Optional[Sequence["int"]] = None,
|
address_n: Optional[Sequence["int"]] = None,
|
||||||
|
show_display: Optional["bool"] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.address_n: Sequence["int"] = address_n if address_n is not None else []
|
self.address_n: Sequence["int"] = address_n if address_n is not None else []
|
||||||
|
self.show_display = show_display
|
||||||
|
|
||||||
|
|
||||||
class NostrPubkey(protobuf.MessageType):
|
class NostrPubkey(protobuf.MessageType):
|
||||||
|
@ -31,6 +31,8 @@ pub struct NostrGetPubkey {
|
|||||||
// message fields
|
// message fields
|
||||||
// @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.address_n)
|
// @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.address_n)
|
||||||
pub address_n: ::std::vec::Vec<u32>,
|
pub address_n: ::std::vec::Vec<u32>,
|
||||||
|
// @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.show_display)
|
||||||
|
pub show_display: ::std::option::Option<bool>,
|
||||||
// special fields
|
// special fields
|
||||||
// @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrGetPubkey.special_fields)
|
// @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrGetPubkey.special_fields)
|
||||||
pub special_fields: ::protobuf::SpecialFields,
|
pub special_fields: ::protobuf::SpecialFields,
|
||||||
@ -47,14 +49,38 @@ impl NostrGetPubkey {
|
|||||||
::std::default::Default::default()
|
::std::default::Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// optional bool show_display = 2;
|
||||||
|
|
||||||
|
pub fn show_display(&self) -> bool {
|
||||||
|
self.show_display.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clear_show_display(&mut self) {
|
||||||
|
self.show_display = ::std::option::Option::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn has_show_display(&self) -> bool {
|
||||||
|
self.show_display.is_some()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is passed by value, moved
|
||||||
|
pub fn set_show_display(&mut self, v: bool) {
|
||||||
|
self.show_display = ::std::option::Option::Some(v);
|
||||||
|
}
|
||||||
|
|
||||||
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
|
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
|
||||||
let mut fields = ::std::vec::Vec::with_capacity(1);
|
let mut fields = ::std::vec::Vec::with_capacity(2);
|
||||||
let mut oneofs = ::std::vec::Vec::with_capacity(0);
|
let mut oneofs = ::std::vec::Vec::with_capacity(0);
|
||||||
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
|
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
|
||||||
"address_n",
|
"address_n",
|
||||||
|m: &NostrGetPubkey| { &m.address_n },
|
|m: &NostrGetPubkey| { &m.address_n },
|
||||||
|m: &mut NostrGetPubkey| { &mut m.address_n },
|
|m: &mut NostrGetPubkey| { &mut m.address_n },
|
||||||
));
|
));
|
||||||
|
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
|
||||||
|
"show_display",
|
||||||
|
|m: &NostrGetPubkey| { &m.show_display },
|
||||||
|
|m: &mut NostrGetPubkey| { &mut m.show_display },
|
||||||
|
));
|
||||||
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<NostrGetPubkey>(
|
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<NostrGetPubkey>(
|
||||||
"NostrGetPubkey",
|
"NostrGetPubkey",
|
||||||
fields,
|
fields,
|
||||||
@ -79,6 +105,9 @@ impl ::protobuf::Message for NostrGetPubkey {
|
|||||||
8 => {
|
8 => {
|
||||||
self.address_n.push(is.read_uint32()?);
|
self.address_n.push(is.read_uint32()?);
|
||||||
},
|
},
|
||||||
|
16 => {
|
||||||
|
self.show_display = ::std::option::Option::Some(is.read_bool()?);
|
||||||
|
},
|
||||||
tag => {
|
tag => {
|
||||||
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
|
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
|
||||||
},
|
},
|
||||||
@ -94,6 +123,9 @@ impl ::protobuf::Message for NostrGetPubkey {
|
|||||||
for value in &self.address_n {
|
for value in &self.address_n {
|
||||||
my_size += ::protobuf::rt::uint32_size(1, *value);
|
my_size += ::protobuf::rt::uint32_size(1, *value);
|
||||||
};
|
};
|
||||||
|
if let Some(v) = self.show_display {
|
||||||
|
my_size += 1 + 1;
|
||||||
|
}
|
||||||
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
|
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
|
||||||
self.special_fields.cached_size().set(my_size as u32);
|
self.special_fields.cached_size().set(my_size as u32);
|
||||||
my_size
|
my_size
|
||||||
@ -103,6 +135,9 @@ impl ::protobuf::Message for NostrGetPubkey {
|
|||||||
for v in &self.address_n {
|
for v in &self.address_n {
|
||||||
os.write_uint32(1, *v)?;
|
os.write_uint32(1, *v)?;
|
||||||
};
|
};
|
||||||
|
if let Some(v) = self.show_display {
|
||||||
|
os.write_bool(2, v)?;
|
||||||
|
}
|
||||||
os.write_unknown_fields(self.special_fields.unknown_fields())?;
|
os.write_unknown_fields(self.special_fields.unknown_fields())?;
|
||||||
::std::result::Result::Ok(())
|
::std::result::Result::Ok(())
|
||||||
}
|
}
|
||||||
@ -121,12 +156,14 @@ impl ::protobuf::Message for NostrGetPubkey {
|
|||||||
|
|
||||||
fn clear(&mut self) {
|
fn clear(&mut self) {
|
||||||
self.address_n.clear();
|
self.address_n.clear();
|
||||||
|
self.show_display = ::std::option::Option::None;
|
||||||
self.special_fields.clear();
|
self.special_fields.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_instance() -> &'static NostrGetPubkey {
|
fn default_instance() -> &'static NostrGetPubkey {
|
||||||
static instance: NostrGetPubkey = NostrGetPubkey {
|
static instance: NostrGetPubkey = NostrGetPubkey {
|
||||||
address_n: ::std::vec::Vec::new(),
|
address_n: ::std::vec::Vec::new(),
|
||||||
|
show_display: ::std::option::Option::None,
|
||||||
special_fields: ::protobuf::SpecialFields::new(),
|
special_fields: ::protobuf::SpecialFields::new(),
|
||||||
};
|
};
|
||||||
&instance
|
&instance
|
||||||
@ -859,16 +896,17 @@ impl ::protobuf::reflect::ProtobufValue for NostrEventSignature {
|
|||||||
|
|
||||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
\n\x14messages-nostr.proto\x12\x18hw.trezor.messages.nostr\x1a\roptions.\
|
\n\x14messages-nostr.proto\x12\x18hw.trezor.messages.nostr\x1a\roptions.\
|
||||||
proto\"-\n\x0eNostrGetPubkey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\
|
proto\"P\n\x0eNostrGetPubkey\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\
|
||||||
\x08addressN\"%\n\x0bNostrPubkey\x12\x16\n\x06pubkey\x18\x01\x20\x02(\
|
\x08addressN\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\
|
||||||
\x0cR\x06pubkey\"\x8e\x01\n\x0eNostrSignEvent\x12\x1b\n\taddress_n\x18\
|
\"%\n\x0bNostrPubkey\x12\x16\n\x06pubkey\x18\x01\x20\x02(\x0cR\x06pubkey\
|
||||||
\x01\x20\x03(\rR\x08addressN\x12\x1d\n\ncreated_at\x18\x02\x20\x01(\rR\t\
|
\"\x8e\x01\n\x0eNostrSignEvent\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\
|
||||||
createdAt\x12\x12\n\x04kind\x18\x03\x20\x01(\rR\x04kind\x12\x12\n\x04tag\
|
\x08addressN\x12\x1d\n\ncreated_at\x18\x02\x20\x01(\rR\tcreatedAt\x12\
|
||||||
s\x18\x04\x20\x03(\tR\x04tags\x12\x18\n\x07content\x18\x05\x20\x01(\tR\
|
\x12\n\x04kind\x18\x03\x20\x01(\rR\x04kind\x12\x12\n\x04tags\x18\x04\x20\
|
||||||
\x07content\"[\n\x13NostrEventSignature\x12\x16\n\x06pubkey\x18\x01\x20\
|
\x03(\tR\x04tags\x12\x18\n\x07content\x18\x05\x20\x01(\tR\x07content\"[\
|
||||||
\x02(\x0cR\x06pubkey\x12\x0e\n\x02id\x18\x02\x20\x02(\x0cR\x02id\x12\x1c\
|
\n\x13NostrEventSignature\x12\x16\n\x06pubkey\x18\x01\x20\x02(\x0cR\x06p\
|
||||||
\n\tsignature\x18\x03\x20\x02(\x0cR\tsignatureB=\n#com.satoshilabs.trezo\
|
ubkey\x12\x0e\n\x02id\x18\x02\x20\x02(\x0cR\x02id\x12\x1c\n\tsignature\
|
||||||
r.lib.protobufB\x12TrezorMessageNostr\x80\xa6\x1d\x01\
|
\x18\x03\x20\x02(\x0cR\tsignatureB=\n#com.satoshilabs.trezor.lib.protobu\
|
||||||
|
fB\x12TrezorMessageNostr\x80\xa6\x1d\x01\
|
||||||
";
|
";
|
||||||
|
|
||||||
/// `FileDescriptorProto` object which was a source for this generated file
|
/// `FileDescriptorProto` object which was a source for this generated file
|
||||||
|
Loading…
Reference in New Issue
Block a user