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

feat(common): set more fields as required (#1406)

This commit is contained in:
matejcik 2021-01-14 12:05:03 +01:00 committed by matejcik
parent bf562cfd4b
commit 576d431058
12 changed files with 80 additions and 80 deletions

View File

@ -21,7 +21,7 @@ message BinanceGetAddress {
* @end * @end
*/ */
message BinanceAddress { message BinanceAddress {
optional string address = 1; // prefixed bech32 Binance address required string address = 1; // prefixed bech32 Binance address
} }
/** /**
@ -39,7 +39,7 @@ message BinanceGetPublicKey {
* @end * @end
*/ */
message BinancePublicKey { message BinancePublicKey {
optional bytes public_key = 1; required bytes public_key = 1;
} }
/** /**
@ -141,7 +141,7 @@ message BinanceCancelMsg {
* @end * @end
*/ */
message BinanceSignedTx { message BinanceSignedTx {
optional bytes signature = 1; required bytes signature = 1;
optional bytes public_key = 2; required bytes public_key = 2;
} }

View File

@ -80,8 +80,8 @@ message GetPublicKey {
* @end * @end
*/ */
message PublicKey { message PublicKey {
optional common.HDNodeType node = 1; // BIP32 public node required common.HDNodeType node = 1; // BIP32 public node
optional string xpub = 2; // serialized form of public node required string xpub = 2; // serialized form of public node
optional uint32 root_fingerprint = 3; // master root node fingerprint optional uint32 root_fingerprint = 3; // master root node fingerprint
} }
@ -147,8 +147,8 @@ message SignMessage {
* @end * @end
*/ */
message MessageSignature { message MessageSignature {
optional string address = 1; // address used to sign the message required string address = 1; // address used to sign the message
optional bytes signature = 2; // signature of the message required bytes signature = 2; // signature of the message
} }
/** /**

View File

@ -10,7 +10,7 @@ option java_outer_classname = "TrezorMessageCommon";
* @end * @end
*/ */
message Success { message Success {
optional string message = 1; // human readable description of action or request-specific payload optional string message = 1 [default=""]; // human readable description of action or request-specific payload
} }
/** /**

View File

@ -123,5 +123,5 @@ message CosiSign {
* @end * @end
*/ */
message CosiSignature { message CosiSignature {
optional bytes signature = 1; // Signature required bytes signature = 1; // Signature
} }

View File

@ -21,8 +21,8 @@ message EosGetPublicKey {
* @end * @end
*/ */
message EosPublicKey { message EosPublicKey {
optional string wif_public_key = 1; // EOS pub key in Base58 encoding required string wif_public_key = 1; // EOS pub key in Base58 encoding
optional bytes raw_public_key = 2; // Raw public key required bytes raw_public_key = 2; // Raw public key
} }
/** /**
@ -101,10 +101,10 @@ message EosTxActionAck {
* Structure representing auth key * Structure representing auth key
*/ */
message EosAuthorizationKey { message EosAuthorizationKey {
optional uint32 type = 1; required uint32 type = 1;
optional bytes key = 2; // Explicit public key bytes; when present, address_n must be empty optional bytes key = 2; // Explicit public key bytes; when present, address_n must be empty
repeated uint32 address_n = 3; // BIP-32 path to derive key; when filled out, key must not be present repeated uint32 address_n = 3; // BIP-32 path to derive key; when filled out, key must not be present
optional uint32 weight = 4; required uint32 weight = 4;
} }
/** /**
@ -266,7 +266,7 @@ message EosTxActionAck {
* Structure representing actions not implemented above. * Structure representing actions not implemented above.
*/ */
message EosActionUnknown { message EosActionUnknown {
optional uint32 data_size = 1; required uint32 data_size = 1;
optional bytes data_chunk = 2; optional bytes data_chunk = 2;
} }
} }
@ -277,5 +277,5 @@ message EosTxActionAck {
* @end * @end
*/ */
message EosSignedTx { message EosSignedTx {
optional string signature = 1; // Computed signature required string signature = 1; // Computed signature
} }

View File

@ -24,8 +24,8 @@ message EthereumGetPublicKey {
* @end * @end
*/ */
message EthereumPublicKey { message EthereumPublicKey {
optional hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node required hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node
optional string xpub = 2; // serialized form of public node required string xpub = 2; // serialized form of public node
} }
/** /**
@ -107,8 +107,8 @@ message EthereumSignMessage {
* @end * @end
*/ */
message EthereumMessageSignature { message EthereumMessageSignature {
optional bytes signature = 2; // signature of the message required bytes signature = 2; // signature of the message
optional string address = 3; // address used to sign the message required string address = 3; // address used to sign the message
} }
/** /**

View File

@ -21,7 +21,7 @@ message LiskGetAddress {
* @end * @end
*/ */
message LiskAddress { message LiskAddress {
optional string address = 1; // Lisk address required string address = 1; // Lisk address
} }
/** /**
@ -39,7 +39,7 @@ message LiskGetPublicKey {
* @end * @end
*/ */
message LiskPublicKey { message LiskPublicKey {
optional bytes public_key = 1; // Lisk public key required bytes public_key = 1; // Lisk public key
} }
/** /**
@ -50,7 +50,7 @@ message LiskPublicKey {
*/ */
message LiskSignTx { message LiskSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional LiskTransactionCommon transaction = 2; // Lisk transaction structure required LiskTransactionCommon transaction = 2; // Lisk transaction structure
/** /**
* Structure representing the common part for Lisk transactions * Structure representing the common part for Lisk transactions
*/ */
@ -115,7 +115,7 @@ message LiskSignTx {
* @end * @end
*/ */
message LiskSignedTx { message LiskSignedTx {
optional bytes signature = 1; required bytes signature = 1;
} }
/** /**
@ -126,7 +126,7 @@ message LiskSignedTx {
*/ */
message LiskSignMessage { message LiskSignMessage {
repeated uint32 address_n = 1; repeated uint32 address_n = 1;
optional bytes message = 2; required bytes message = 2;
} }
/** /**
@ -134,8 +134,8 @@ message LiskSignMessage {
* @end * @end
*/ */
message LiskMessageSignature { message LiskMessageSignature {
optional bytes public_key = 1; required bytes public_key = 1;
optional bytes signature = 2; required bytes signature = 2;
} }
/** /**
@ -145,7 +145,7 @@ message LiskMessageSignature {
* @next Failure * @next Failure
*/ */
message LiskVerifyMessage { message LiskVerifyMessage {
optional bytes public_key = 1; required bytes public_key = 1;
optional bytes signature = 2; required bytes signature = 2;
optional bytes message = 3; required bytes message = 3;
} }

View File

@ -46,9 +46,9 @@ message GetFeatures {
*/ */
message Features { message Features {
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io" optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
optional uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1 required uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
optional uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0 required uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
optional uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0 required uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
optional bool bootloader_mode = 5; // is device in bootloader mode? optional bool bootloader_mode = 5; // is device in bootloader mode?
optional string device_id = 6; // device's unique identifier optional string device_id = 6; // device's unique identifier
optional bool pin_protection = 7; // is device protected by PIN? optional bool pin_protection = 7; // is device protected by PIN?
@ -196,7 +196,7 @@ message SdProtect {
* @next Success * @next Success
*/ */
message Ping { message Ping {
optional string message = 1; // message to send back in Success message optional string message = 1 [default=""]; // message to send back in Success message
optional bool button_protection = 2; // ask for button press optional bool button_protection = 2; // ask for button press
} }

View File

@ -172,8 +172,8 @@ message NEMSignTx {
* @end * @end
*/ */
message NEMSignedTx { message NEMSignedTx {
optional bytes data = 1; // Transaction data required bytes data = 1; // Transaction data
optional bytes signature = 2; // Signature for the transaction required bytes signature = 2; // Signature for the transaction
} }
/** /**
@ -194,5 +194,5 @@ message NEMDecryptMessage {
* @end * @end
*/ */
message NEMDecryptedMessage { message NEMDecryptedMessage {
optional bytes payload = 1; // Actual message data (unencrypted) required bytes payload = 1; // Actual message data (unencrypted)
} }

View File

@ -20,7 +20,7 @@ message RippleGetAddress {
* @end * @end
*/ */
message RippleAddress { message RippleAddress {
optional string address = 1; // Address in Ripple format (base58 of a pubkey with checksum) required string address = 1; // Address in Ripple format (base58 of a pubkey with checksum)
} }
/** /**
@ -43,8 +43,8 @@ message RippleSignTx {
* - see https://developers.ripple.com/payment.html * - see https://developers.ripple.com/payment.html
*/ */
message RipplePayment { message RipplePayment {
optional uint64 amount = 1; // only XRP is supported at the moment so this an integer required uint64 amount = 1; // only XRP is supported at the moment so this an integer
optional string destination = 2; // destination account address required string destination = 2; // destination account address
optional uint32 destination_tag = 3; // destination tag to identify payments optional uint32 destination_tag = 3; // destination tag to identify payments
} }
} }
@ -54,6 +54,6 @@ message RippleSignTx {
* @end * @end
*/ */
message RippleSignedTx { message RippleSignedTx {
optional bytes signature = 1; required bytes signature = 1;
optional bytes serialized_tx = 2; required bytes serialized_tx = 2;
} }

View File

@ -10,7 +10,7 @@ option java_outer_classname = "TrezorMessageStellar";
* @embed * @embed
*/ */
message StellarAssetType { message StellarAssetType {
optional uint32 type = 1; // 0 = native asset (XLM), 1 = alphanum 4, 2 = alphanum 12 required uint32 type = 1; // 0 = native asset (XLM), 1 = alphanum 4, 2 = alphanum 12
optional string code = 2; // for non-native assets, string describing the code optional string code = 2; // for non-native assets, string describing the code
optional string issuer = 3; // issuing address optional string issuer = 3; // issuing address
} }
@ -30,7 +30,7 @@ message StellarGetAddress {
* @end * @end
*/ */
message StellarAddress { message StellarAddress {
optional string address = 1; // Address in Stellar format (base32 of a pubkey with checksum) required string address = 1; // Address in Stellar format (base32 of a pubkey with checksum)
} }
/** /**
@ -217,6 +217,6 @@ message StellarBumpSequenceOp {
* @end * @end
*/ */
message StellarSignedTx { message StellarSignedTx {
optional bytes public_key = 1; // public key for the private key used to sign data required bytes public_key = 1; // public key for the private key used to sign data
optional bytes signature = 2; // signature suitable for sending to the Stellar network required bytes signature = 2; // signature suitable for sending to the Stellar network
} }

View File

@ -21,7 +21,7 @@ message TezosGetAddress {
* @end * @end
*/ */
message TezosAddress { message TezosAddress {
optional string address = 1; // Coin address in Base58 encoding required string address = 1; // Coin address in Base58 encoding
} }
/** /**
@ -39,7 +39,7 @@ message TezosGetPublicKey {
* @end * @end
*/ */
message TezosPublicKey { message TezosPublicKey {
optional string public_key = 1; // b58 encoded Tezos public key with prefix required string public_key = 1; // b58 encoded Tezos public key with prefix
} }
/** /**
@ -49,7 +49,7 @@ message TezosPublicKey {
*/ */
message TezosSignTx { message TezosSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bytes branch = 2; required bytes branch = 2;
optional TezosRevealOp reveal = 3; // Tezos reveal operation (may be bundled with other op) optional TezosRevealOp reveal = 3; // Tezos reveal operation (may be bundled with other op)
optional TezosTransactionOp transaction = 4; // Tezos transaction operation optional TezosTransactionOp transaction = 4; // Tezos transaction operation
@ -61,8 +61,8 @@ message TezosSignTx {
* Tezos contract ID * Tezos contract ID
*/ */
message TezosContractID { message TezosContractID {
optional TezosContractType tag = 1; required TezosContractType tag = 1;
optional bytes hash = 2; // Implicit = 21B, originated = 20B + 1B padding required bytes hash = 2; // Implicit = 21B, originated = 20B + 1B padding
/* /*
* Type of Tezos Contract type * Type of Tezos Contract type
*/ */
@ -75,24 +75,24 @@ message TezosSignTx {
* Structure representing information for reveal * Structure representing information for reveal
*/ */
message TezosRevealOp { message TezosRevealOp {
optional bytes source = 7; required bytes source = 7;
optional uint64 fee = 2; required uint64 fee = 2;
optional uint64 counter = 3; required uint64 counter = 3;
optional uint64 gas_limit = 4; required uint64 gas_limit = 4;
optional uint64 storage_limit = 5; required uint64 storage_limit = 5;
optional bytes public_key = 6; required bytes public_key = 6;
} }
/** /**
* Structure representing information for transaction * Structure representing information for transaction
*/ */
message TezosTransactionOp { message TezosTransactionOp {
optional bytes source = 9; required bytes source = 9;
optional uint64 fee = 2; required uint64 fee = 2;
optional uint64 counter = 3; required uint64 counter = 3;
optional uint64 gas_limit = 4; required uint64 gas_limit = 4;
optional uint64 storage_limit = 5; required uint64 storage_limit = 5;
optional uint64 amount = 6; required uint64 amount = 6;
optional TezosContractID destination = 7; required TezosContractID destination = 7;
optional bytes parameters = 8; optional bytes parameters = 8;
optional TezosParametersManager parameters_manager = 10; optional TezosParametersManager parameters_manager = 10;
@ -111,28 +111,28 @@ message TezosSignTx {
* Structure representing information for origination * Structure representing information for origination
*/ */
message TezosOriginationOp { message TezosOriginationOp {
optional bytes source = 12; required bytes source = 12;
optional uint64 fee = 2; required uint64 fee = 2;
optional uint64 counter = 3; required uint64 counter = 3;
optional uint64 gas_limit = 4; required uint64 gas_limit = 4;
optional uint64 storage_limit = 5; required uint64 storage_limit = 5;
optional bytes manager_pubkey = 6; optional bytes manager_pubkey = 6;
optional uint64 balance = 7; required uint64 balance = 7;
optional bool spendable = 8; optional bool spendable = 8;
optional bool delegatable = 9; optional bool delegatable = 9;
optional bytes delegate = 10; optional bytes delegate = 10;
optional bytes script = 11; required bytes script = 11;
} }
/** /**
* Structure representing information for delegation * Structure representing information for delegation
*/ */
message TezosDelegationOp { message TezosDelegationOp {
optional bytes source = 7; required bytes source = 7;
optional uint64 fee = 2; required uint64 fee = 2;
optional uint64 counter = 3; required uint64 counter = 3;
optional uint64 gas_limit = 4; required uint64 gas_limit = 4;
optional uint64 storage_limit = 5; required uint64 storage_limit = 5;
optional bytes delegate = 6; required bytes delegate = 6;
} }
/** /**
* Structure representing information for proposal * Structure representing information for proposal
@ -164,7 +164,7 @@ message TezosSignTx {
* @end * @end
*/ */
message TezosSignedTx { message TezosSignedTx {
optional string signature = 1; // Tezos b58 encoded transaction signature with prefix required string signature = 1; // Tezos b58 encoded transaction signature with prefix
optional bytes sig_op_contents = 2; // operation_bytes + signed operation_bytes required bytes sig_op_contents = 2; // operation_bytes + signed operation_bytes
optional string operation_hash = 3; // b58 encoded hashed operation contents with prefix required string operation_hash = 3; // b58 encoded hashed operation contents with prefix
} }