1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +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
*/
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
*/
message BinancePublicKey {
optional bytes public_key = 1;
required bytes public_key = 1;
}
/**
@ -141,7 +141,7 @@ message BinanceCancelMsg {
* @end
*/
message BinanceSignedTx {
optional bytes signature = 1;
optional bytes public_key = 2;
required bytes signature = 1;
required bytes public_key = 2;
}

View File

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

View File

@ -10,7 +10,7 @@ option java_outer_classname = "TrezorMessageCommon";
* @end
*/
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
*/
message CosiSignature {
optional bytes signature = 1; // Signature
required bytes signature = 1; // Signature
}

View File

@ -21,8 +21,8 @@ message EosGetPublicKey {
* @end
*/
message EosPublicKey {
optional string wif_public_key = 1; // EOS pub key in Base58 encoding
optional bytes raw_public_key = 2; // Raw public key
required string wif_public_key = 1; // EOS pub key in Base58 encoding
required bytes raw_public_key = 2; // Raw public key
}
/**
@ -101,10 +101,10 @@ message EosTxActionAck {
* Structure representing auth key
*/
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
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.
*/
message EosActionUnknown {
optional uint32 data_size = 1;
required uint32 data_size = 1;
optional bytes data_chunk = 2;
}
}
@ -277,5 +277,5 @@ message EosTxActionAck {
* @end
*/
message EosSignedTx {
optional string signature = 1; // Computed signature
required string signature = 1; // Computed signature
}

View File

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

View File

@ -21,7 +21,7 @@ message LiskGetAddress {
* @end
*/
message LiskAddress {
optional string address = 1; // Lisk address
required string address = 1; // Lisk address
}
/**
@ -39,7 +39,7 @@ message LiskGetPublicKey {
* @end
*/
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 {
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
*/
@ -115,7 +115,7 @@ message LiskSignTx {
* @end
*/
message LiskSignedTx {
optional bytes signature = 1;
required bytes signature = 1;
}
/**
@ -126,7 +126,7 @@ message LiskSignedTx {
*/
message LiskSignMessage {
repeated uint32 address_n = 1;
optional bytes message = 2;
required bytes message = 2;
}
/**
@ -134,8 +134,8 @@ message LiskSignMessage {
* @end
*/
message LiskMessageSignature {
optional bytes public_key = 1;
optional bytes signature = 2;
required bytes public_key = 1;
required bytes signature = 2;
}
/**
@ -145,7 +145,7 @@ message LiskMessageSignature {
* @next Failure
*/
message LiskVerifyMessage {
optional bytes public_key = 1;
optional bytes signature = 2;
optional bytes message = 3;
required bytes public_key = 1;
required bytes signature = 2;
required bytes message = 3;
}

View File

@ -46,9 +46,9 @@ message GetFeatures {
*/
message Features {
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
optional 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 major_version = 2; // major version of the firmware/bootloader, e.g. 1
required uint32 minor_version = 3; // minor 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 string device_id = 6; // device's unique identifier
optional bool pin_protection = 7; // is device protected by PIN?
@ -196,7 +196,7 @@ message SdProtect {
* @next Success
*/
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
}

View File

@ -172,8 +172,8 @@ message NEMSignTx {
* @end
*/
message NEMSignedTx {
optional bytes data = 1; // Transaction data
optional bytes signature = 2; // Signature for the transaction
required bytes data = 1; // Transaction data
required bytes signature = 2; // Signature for the transaction
}
/**
@ -194,5 +194,5 @@ message NEMDecryptMessage {
* @end
*/
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
*/
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
*/
message RipplePayment {
optional uint64 amount = 1; // only XRP is supported at the moment so this an integer
optional string destination = 2; // destination account address
required uint64 amount = 1; // only XRP is supported at the moment so this an integer
required string destination = 2; // destination account address
optional uint32 destination_tag = 3; // destination tag to identify payments
}
}
@ -54,6 +54,6 @@ message RippleSignTx {
* @end
*/
message RippleSignedTx {
optional bytes signature = 1;
optional bytes serialized_tx = 2;
required bytes signature = 1;
required bytes serialized_tx = 2;
}

View File

@ -10,7 +10,7 @@ option java_outer_classname = "TrezorMessageStellar";
* @embed
*/
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 issuer = 3; // issuing address
}
@ -30,7 +30,7 @@ message StellarGetAddress {
* @end
*/
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
*/
message StellarSignedTx {
optional 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 public_key = 1; // public key for the private key used to sign data
required bytes signature = 2; // signature suitable for sending to the Stellar network
}

View File

@ -21,7 +21,7 @@ message TezosGetAddress {
* @end
*/
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
*/
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 {
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 TezosTransactionOp transaction = 4; // Tezos transaction operation
@ -61,8 +61,8 @@ message TezosSignTx {
* Tezos contract ID
*/
message TezosContractID {
optional TezosContractType tag = 1;
optional bytes hash = 2; // Implicit = 21B, originated = 20B + 1B padding
required TezosContractType tag = 1;
required bytes hash = 2; // Implicit = 21B, originated = 20B + 1B padding
/*
* Type of Tezos Contract type
*/
@ -75,24 +75,24 @@ message TezosSignTx {
* Structure representing information for reveal
*/
message TezosRevealOp {
optional bytes source = 7;
optional uint64 fee = 2;
optional uint64 counter = 3;
optional uint64 gas_limit = 4;
optional uint64 storage_limit = 5;
optional bytes public_key = 6;
required bytes source = 7;
required uint64 fee = 2;
required uint64 counter = 3;
required uint64 gas_limit = 4;
required uint64 storage_limit = 5;
required bytes public_key = 6;
}
/**
* Structure representing information for transaction
*/
message TezosTransactionOp {
optional bytes source = 9;
optional uint64 fee = 2;
optional uint64 counter = 3;
optional uint64 gas_limit = 4;
optional uint64 storage_limit = 5;
optional uint64 amount = 6;
optional TezosContractID destination = 7;
required bytes source = 9;
required uint64 fee = 2;
required uint64 counter = 3;
required uint64 gas_limit = 4;
required uint64 storage_limit = 5;
required uint64 amount = 6;
required TezosContractID destination = 7;
optional bytes parameters = 8;
optional TezosParametersManager parameters_manager = 10;
@ -111,28 +111,28 @@ message TezosSignTx {
* Structure representing information for origination
*/
message TezosOriginationOp {
optional bytes source = 12;
optional uint64 fee = 2;
optional uint64 counter = 3;
optional uint64 gas_limit = 4;
optional uint64 storage_limit = 5;
required bytes source = 12;
required uint64 fee = 2;
required uint64 counter = 3;
required uint64 gas_limit = 4;
required uint64 storage_limit = 5;
optional bytes manager_pubkey = 6;
optional uint64 balance = 7;
required uint64 balance = 7;
optional bool spendable = 8;
optional bool delegatable = 9;
optional bytes delegate = 10;
optional bytes script = 11;
required bytes script = 11;
}
/**
* Structure representing information for delegation
*/
message TezosDelegationOp {
optional bytes source = 7;
optional uint64 fee = 2;
optional uint64 counter = 3;
optional uint64 gas_limit = 4;
optional uint64 storage_limit = 5;
optional bytes delegate = 6;
required bytes source = 7;
required uint64 fee = 2;
required uint64 counter = 3;
required uint64 gas_limit = 4;
required uint64 storage_limit = 5;
required bytes delegate = 6;
}
/**
* Structure representing information for proposal
@ -164,7 +164,7 @@ message TezosSignTx {
* @end
*/
message TezosSignedTx {
optional string signature = 1; // Tezos b58 encoded transaction signature with prefix
optional bytes sig_op_contents = 2; // operation_bytes + signed operation_bytes
optional string operation_hash = 3; // b58 encoded hashed operation contents with prefix
required string signature = 1; // Tezos b58 encoded transaction signature with prefix
required bytes sig_op_contents = 2; // operation_bytes + signed operation_bytes
required string operation_hash = 3; // b58 encoded hashed operation contents with prefix
}