1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-20 19:42:02 +00:00

fix(all): make more protobuf fields required

[no changelog]
This commit is contained in:
matejcik 2025-01-03 11:57:42 +01:00 committed by matejcik
parent c7231e5de9
commit 8b6d8e7572
7 changed files with 40 additions and 29 deletions

View File

@ -651,7 +651,7 @@ message UnlockPath {
* @next GetAddress
*/
message UnlockedPathRequest {
optional bytes mac = 1; // authentication code for future UnlockPath calls
required bytes mac = 1; // authentication code for future UnlockPath calls
}
/**

View File

@ -98,7 +98,7 @@ message MoneroGetAddress {
* @end
*/
message MoneroAddress {
optional bytes address = 1;
required bytes address = 1;
}
/**
@ -117,8 +117,8 @@ message MoneroGetWatchKey {
* @end
*/
message MoneroWatchKey {
optional bytes watch_key = 1;
optional bytes address = 2;
required bytes watch_key = 1;
required bytes address = 2;
}
/**

View File

@ -2785,12 +2785,12 @@ if TYPE_CHECKING:
return isinstance(msg, cls)
class UnlockedPathRequest(protobuf.MessageType):
mac: "bytes | None"
mac: "bytes"
def __init__(
self,
*,
mac: "bytes | None" = None,
mac: "bytes",
) -> None:
pass
@ -4141,12 +4141,12 @@ if TYPE_CHECKING:
return isinstance(msg, cls)
class MoneroAddress(protobuf.MessageType):
address: "bytes | None"
address: "bytes"
def __init__(
self,
*,
address: "bytes | None" = None,
address: "bytes",
) -> None:
pass
@ -4171,14 +4171,14 @@ if TYPE_CHECKING:
return isinstance(msg, cls)
class MoneroWatchKey(protobuf.MessageType):
watch_key: "bytes | None"
address: "bytes | None"
watch_key: "bytes"
address: "bytes"
def __init__(
self,
*,
watch_key: "bytes | None" = None,
address: "bytes | None" = None,
watch_key: "bytes",
address: "bytes",
) -> None:
pass

View File

@ -862,7 +862,6 @@ void fsm_msgUnlockPath(const UnlockPath *msg) {
unlock_path = msg->address_n[0];
resp->mac.size = SHA256_DIGEST_LENGTH;
resp->has_mac = true;
msg_write(MessageType_MessageType_UnlockedPathRequest, resp);
layoutHome();
}

View File

@ -4000,13 +4000,13 @@ class UnlockPath(protobuf.MessageType):
class UnlockedPathRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 94
FIELDS = {
1: protobuf.Field("mac", "bytes", repeated=False, required=False, default=None),
1: protobuf.Field("mac", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
mac: Optional["bytes"] = None,
mac: "bytes",
) -> None:
self.mac = mac
@ -5568,13 +5568,13 @@ class MoneroGetAddress(protobuf.MessageType):
class MoneroAddress(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 541
FIELDS = {
1: protobuf.Field("address", "bytes", repeated=False, required=False, default=None),
1: protobuf.Field("address", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
address: Optional["bytes"] = None,
address: "bytes",
) -> None:
self.address = address
@ -5599,15 +5599,15 @@ class MoneroGetWatchKey(protobuf.MessageType):
class MoneroWatchKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 543
FIELDS = {
1: protobuf.Field("watch_key", "bytes", repeated=False, required=False, default=None),
2: protobuf.Field("address", "bytes", repeated=False, required=False, default=None),
1: protobuf.Field("watch_key", "bytes", repeated=False, required=True),
2: protobuf.Field("address", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
watch_key: Optional["bytes"] = None,
address: Optional["bytes"] = None,
watch_key: "bytes",
address: "bytes",
) -> None:
self.watch_key = watch_key
self.address = address

View File

@ -10709,7 +10709,7 @@ impl UnlockedPathRequest {
::std::default::Default::default()
}
// optional bytes mac = 1;
// required bytes mac = 1;
pub fn mac(&self) -> &[u8] {
match self.mac.as_ref() {
@ -10765,6 +10765,9 @@ impl ::protobuf::Message for UnlockedPathRequest {
const NAME: &'static str = "UnlockedPathRequest";
fn is_initialized(&self) -> bool {
if self.mac.is_none() {
return false;
}
true
}
@ -11724,7 +11727,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x05Nonce\x12\x14\n\x05nonce\x18\x01\x20\x02(\x0cR\x05nonce:\x04\x88\
\xb2\x19\x01\";\n\nUnlockPath\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\
\x08addressN\x12\x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"'\n\x13Unloc\
kedPathRequest\x12\x10\n\x03mac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12\
kedPathRequest\x12\x10\n\x03mac\x18\x01\x20\x02(\x0cR\x03mac\"\x14\n\x12\
ShowDeviceTutorial\"\x12\n\x10UnlockBootloader\"%\n\rSetBrightness\x12\
\x14\n\x05value\x18\x01\x20\x01(\rR\x05value*\x99\x01\n\nBackupType\x12\
\t\n\x05Bip39\x10\0\x12\x10\n\x0cSlip39_Basic\x10\x01\x12\x13\n\x0fSlip3\

View File

@ -2451,7 +2451,7 @@ impl MoneroAddress {
::std::default::Default::default()
}
// optional bytes address = 1;
// required bytes address = 1;
pub fn address(&self) -> &[u8] {
match self.address.as_ref() {
@ -2507,6 +2507,9 @@ impl ::protobuf::Message for MoneroAddress {
const NAME: &'static str = "MoneroAddress";
fn is_initialized(&self) -> bool {
if self.address.is_none() {
return false;
}
true
}
@ -2776,7 +2779,7 @@ impl MoneroWatchKey {
::std::default::Default::default()
}
// optional bytes watch_key = 1;
// required bytes watch_key = 1;
pub fn watch_key(&self) -> &[u8] {
match self.watch_key.as_ref() {
@ -2812,7 +2815,7 @@ impl MoneroWatchKey {
self.watch_key.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
// optional bytes address = 2;
// required bytes address = 2;
pub fn address(&self) -> &[u8] {
match self.address.as_ref() {
@ -2873,6 +2876,12 @@ impl ::protobuf::Message for MoneroWatchKey {
const NAME: &'static str = "MoneroWatchKey";
fn is_initialized(&self) -> bool {
if self.watch_key.is_none() {
return false;
}
if self.address.is_none() {
return false;
}
true
}
@ -11845,11 +11854,11 @@ static file_descriptor_proto_data: &'static [u8] = b"\
unt\x12\x14\n\x05minor\x18\x05\x20\x01(\rR\x05minor\x12\x1d\n\npayment_i\
d\x18\x06\x20\x01(\x0cR\tpaymentId\x12\x1a\n\x08chunkify\x18\x07\x20\x01\
(\x08R\x08chunkify\")\n\rMoneroAddress\x12\x18\n\x07address\x18\x01\x20\
\x01(\x0cR\x07address\"\x8a\x01\n\x11MoneroGetWatchKey\x12\x1b\n\taddres\
\x02(\x0cR\x07address\"\x8a\x01\n\x11MoneroGetWatchKey\x12\x1b\n\taddres\
s_n\x18\x01\x20\x03(\rR\x08addressN\x12X\n\x0cnetwork_type\x18\x02\x20\
\x01(\x0e2,.hw.trezor.messages.monero.MoneroNetworkType:\x07MAINNETR\x0b\
networkType\"G\n\x0eMoneroWatchKey\x12\x1b\n\twatch_key\x18\x01\x20\x01(\
\x0cR\x08watchKey\x12\x18\n\x07address\x18\x02\x20\x01(\x0cR\x07address\
networkType\"G\n\x0eMoneroWatchKey\x12\x1b\n\twatch_key\x18\x01\x20\x02(\
\x0cR\x08watchKey\x12\x18\n\x07address\x18\x02\x20\x02(\x0cR\x07address\
\"\xd1\x07\n\x1cMoneroTransactionInitRequest\x12\x18\n\x07version\x18\
\x01\x20\x01(\rR\x07version\x12\x1b\n\taddress_n\x18\x02\x20\x03(\rR\x08\
addressN\x12X\n\x0cnetwork_type\x18\x03\x20\x01(\x0e2,.hw.trezor.message\