1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

use string again where appropriate

This commit is contained in:
Pavol Rusnak 2014-03-01 11:17:06 +01:00
parent 6a5ef6b823
commit 4ba03a6c70
3 changed files with 62 additions and 66 deletions

View File

@ -77,24 +77,24 @@ message Initialize {
// Response object for Initialize. // Response object for Initialize.
message Features { message Features {
optional bytes vendor = 1; // Name of the manufacturer, e.g. "bitcointrezor.com" optional string vendor = 1; // Name of the manufacturer, e.g. "bitcointrezor.com"
optional uint32 major_version = 2; // Major version of the device, e.g. 1 optional uint32 major_version = 2; // Major version of the device, e.g. 1
optional uint32 minor_version = 3; // Minor version of the device, e.g. 0 optional uint32 minor_version = 3; // Minor version of the device, e.g. 0
optional uint32 bugfix_version = 4; optional uint32 bugfix_version = 4;
optional bool bootloader_mode = 5; optional bool bootloader_mode = 5;
optional bytes device_id = 6 [(binary) = true]; // Device's unique identifier optional string device_id = 6; // Device's unique identifier
optional bool pin_protection = 7; // True if Trezor is covered by PIN optional bool pin_protection = 7; // True if Trezor is covered by PIN
optional bool passphrase_protection = 8; // True if node/mnemonic is covered by passphrase optional bool passphrase_protection = 8; // True if node/mnemonic is covered by passphrase
optional bytes language = 9; optional string language = 9;
optional bytes label = 10 [(binary) = true]; optional string label = 10;
repeated CoinType coins = 11; repeated CoinType coins = 11;
optional bool initialized = 12; // True if device cointains seed optional bool initialized = 12; // True if device cointains seed
} }
// Overwrites only filled fields of the structure // Overwrites only filled fields of the structure
message ApplySettings { message ApplySettings {
optional bytes language = 1; optional string language = 1;
optional bytes label = 2 [(binary) = true]; optional string label = 2;
} }
// Starts workflow for setting/changing the PIN // Starts workflow for setting/changing the PIN
@ -107,7 +107,7 @@ message ChangePin {
// //
// Response: None or Success // Response: None or Success
message Ping { message Ping {
optional bytes message = 1; // Message will be sent back in Success message optional string message = 1; // Message will be sent back in Success message
optional bool button_protection = 2; // Ask for button press optional bool button_protection = 2; // Ask for button press
optional bool pin_protection = 3; // Ask for PIN if set optional bool pin_protection = 3; // Ask for PIN if set
optional bool passphrase_protection = 4; // Ask for passphrase if set optional bool passphrase_protection = 4; // Ask for passphrase if set
@ -115,13 +115,13 @@ message Ping {
// Response object defining success of the previous request // Response object defining success of the previous request
message Success { message Success {
optional bytes message = 1; // May contain human readable description of the action or request-specific payload optional string message = 1; // May contain human readable description of the action or request-specific payload
} }
// Response object defining failure of the previous request // Response object defining failure of the previous request
message Failure { message Failure {
optional FailureType code = 1; // May contain computer-readable definition of the error state optional FailureType code = 1; // May contain computer-readable definition of the error state
optional bytes message = 2; // May contain human-readable message of the error state optional string message = 2; // May contain human-readable message of the error state
} }
// Message can be sent by the *device* as a resopnse to any request. // Message can be sent by the *device* as a resopnse to any request.
@ -130,7 +130,7 @@ message Failure {
// the original request. // the original request.
message ButtonRequest { message ButtonRequest {
optional ButtonRequestType code = 1; optional ButtonRequestType code = 1;
optional bytes data = 2 [(binary) = true]; optional string data = 2;
} }
// Computer agrees to wait for HW button press. // Computer agrees to wait for HW button press.
@ -142,12 +142,12 @@ message ButtonAck {
// //
// Response: PinMatrixAck, Cancel // Response: PinMatrixAck, Cancel
message PinMatrixRequest { message PinMatrixRequest {
optional bytes message = 1; // Human readable message optional string message = 1; // Human readable message
} }
// Message is sent by the computer as a response to PinMatrixRequest previously sent by the device. // Message is sent by the computer as a response to PinMatrixRequest previously sent by the device.
message PinMatrixAck { message PinMatrixAck {
required bytes pin = 1; // User must write down the password for accessing the device. required string pin = 1; // User must write down the password for accessing the device.
} }
// Message is sent as a cancel response to ButtonRequest, PinMatrixRequest and PassphraseRequest // Message is sent as a cancel response to ButtonRequest, PinMatrixRequest and PassphraseRequest
@ -160,7 +160,7 @@ message PassphraseRequest {
// Computer sends passphrase to device. // Computer sends passphrase to device.
message PassphraseAck { message PassphraseAck {
required bytes passphrase = 1 [(binary) = true]; required string passphrase = 1;
} }
// Request a sample of random data generated by hardware RNG. May be used // Request a sample of random data generated by hardware RNG. May be used
@ -173,7 +173,7 @@ message GetEntropy {
// Response to GetEntropy request contains random data generated by internal HRNG. // Response to GetEntropy request contains random data generated by internal HRNG.
message Entropy { message Entropy {
required bytes entropy = 1 [(binary) = true]; // Stream of generated bytes required bytes entropy = 1; // Stream of generated bytes
} }
// Ask device for public key corresponding of address_n path. This may be used for generating // Ask device for public key corresponding of address_n path. This may be used for generating
@ -191,11 +191,11 @@ message PublicKey {
message GetAddress { message GetAddress {
repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node
optional bytes coin_name = 2 [default='Bitcoin']; optional string coin_name = 2 [default='Bitcoin'];
} }
message Address { message Address {
required bytes address = 1; // Bitcoin address in base58 encoding corresponding to GetAddress(n) call required string address = 1; // Bitcoin address in base58 encoding corresponding to GetAddress(n) call
} }
// Request device to wipe all sensitive data and settings. // Request device to wipe all sensitive data and settings.
@ -209,12 +209,12 @@ message WipeDevice {
// //
// Response: Success, ButtonRequest, PinMatrixRequest, Failure // Response: Success, ButtonRequest, PinMatrixRequest, Failure
message LoadDevice { message LoadDevice {
optional bytes mnemonic = 1; // Seed encoded as a mnemonic (12 english words) optional string mnemonic = 1; // Seed encoded as a mnemonic (12 english words)
optional HDNodeType node = 2; optional HDNodeType node = 2;
optional bytes pin = 3; // Set PIN protection for important actions optional string pin = 3; // Set PIN protection for important actions
optional bool passphrase_protection = 4; optional bool passphrase_protection = 4;
optional bytes language = 5 [default='english']; optional string language = 5 [default='english'];
optional bytes label = 6 [(binary) = true]; optional string label = 6;
optional bool skip_checksum = 7; // Do not test mnemonic for valid BIP39 checksum optional bool skip_checksum = 7; // Do not test mnemonic for valid BIP39 checksum
} }
@ -233,8 +233,8 @@ message ResetDevice {
optional uint32 strength = 2 [default=128]; // Strength of seed in bits optional uint32 strength = 2 [default=128]; // Strength of seed in bits
optional bool passphrase_protection = 3; optional bool passphrase_protection = 3;
optional bool pin_protection = 4; optional bool pin_protection = 4;
optional bytes language = 5 [default='english']; optional string language = 5 [default='english'];
optional bytes label = 6 [(binary) = true]; optional string label = 6;
} }
// Asks for additional Entropy from host computer // Asks for additional Entropy from host computer
@ -243,7 +243,7 @@ message EntropyRequest {
// Provide additional entropy for seed generation function. // Provide additional entropy for seed generation function.
message EntropyAck { message EntropyAck {
optional bytes entropy = 1 [(binary) = true]; // Recommended to provide 256 bits (32 bytes) of random data. optional bytes entropy = 1; // Recommended to provide 256 bits (32 bytes) of random data.
} }
// Starts workflow of asking user for specific words of his mnemonic. // Starts workflow of asking user for specific words of his mnemonic.
@ -253,8 +253,8 @@ message RecoveryDevice {
optional uint32 word_count = 1; // How many words is in mnemonic sentence? optional uint32 word_count = 1; // How many words is in mnemonic sentence?
optional bool passphrase_protection = 2; optional bool passphrase_protection = 2;
optional bool pin_protection = 3; optional bool pin_protection = 3;
optional bytes language = 4 [default='english']; optional string language = 4 [default='english'];
optional bytes label = 5 [(binary) = true]; optional string label = 5;
optional bool enforce_wordlist = 6; // Trezor enforces BIP39 wordlist optional bool enforce_wordlist = 6; // Trezor enforces BIP39 wordlist
} }
@ -264,7 +264,7 @@ message WordRequest {
} }
message WordAck { message WordAck {
required bytes word = 1 [(binary)=true]; // One word of mnemonic on asked position required string word = 1; // One word of mnemonic on asked position
} }
// **************************************************************************** // ****************************************************************************
@ -274,19 +274,19 @@ message WordAck {
message SignMessage { message SignMessage {
repeated uint32 address_n = 1; repeated uint32 address_n = 1;
required bytes message = 2 [(binary) = true]; required bytes message = 2;
optional bytes coin_name = 3 [default='Bitcoin']; optional string coin_name = 3 [default='Bitcoin'];
} }
message VerifyMessage { message VerifyMessage {
optional bytes address = 1; optional string address = 1;
optional bytes signature = 2 [(binary) = true]; optional bytes signature = 2;
optional bytes message = 3 [(binary) = true]; optional bytes message = 3;
} }
message MessageSignature { message MessageSignature {
optional bytes address = 1; optional string address = 1;
optional bytes signature = 2 [(binary) = true]; optional bytes signature = 2;
} }
// Estimate size of the transaction // Estimate size of the transaction
@ -300,7 +300,7 @@ message MessageSignature {
message EstimateTxSize { message EstimateTxSize {
required uint32 outputs_count = 1; // Count of outputs of the transaction required uint32 outputs_count = 1; // Count of outputs of the transaction
required uint32 inputs_count = 2; // Count of inputs of the transaction required uint32 inputs_count = 2; // Count of inputs of the transaction
optional bytes coin_name = 3 [default='Bitcoin']; optional string coin_name = 3 [default='Bitcoin'];
} }
// Result of EstimateTxSize // Result of EstimateTxSize
@ -314,7 +314,7 @@ message TxSize {
message SignTx { message SignTx {
required uint32 outputs_count = 1; // Count of outputs of the transaction required uint32 outputs_count = 1; // Count of outputs of the transaction
required uint32 inputs_count = 2; // Count of inputs of the transaction required uint32 inputs_count = 2; // Count of inputs of the transaction
optional bytes coin_name = 3 [default='Bitcoin']; optional string coin_name = 3 [default='Bitcoin'];
} }
// Request a simplified workflow of signing. // Request a simplified workflow of signing.
@ -333,7 +333,7 @@ message SimpleSignTx {
repeated TxInputType inputs = 1; repeated TxInputType inputs = 1;
repeated TxOutputType outputs = 2; repeated TxOutputType outputs = 2;
repeated TransactionType transactions = 3; repeated TransactionType transactions = 3;
optional bytes coin_name = 4 [default='Bitcoin']; optional string coin_name = 4 [default='Bitcoin'];
} }
// Sent by the device as a response for SignTx. Device asks for information for signing transaction. // Sent by the device as a response for SignTx. Device asks for information for signing transaction.
@ -344,8 +344,8 @@ message TxRequest {
optional int32 request_index = 1; // If >=0, device expects TxInput/TxOutput message from the computer optional int32 request_index = 1; // If >=0, device expects TxInput/TxOutput message from the computer
optional RequestType request_type = 2; // Ask for TxInput or TxOutput? optional RequestType request_type = 2; // Ask for TxInput or TxOutput?
optional int32 signed_index = 3; // If >=0, 'signature' contains signed input of this input optional int32 signed_index = 3; // If >=0, 'signature' contains signed input of this input
optional bytes signature = 4 [(binary) = true]; // If signed_index>=0, represent signature of the signed_index input optional bytes signature = 4; // If signed_index>=0, represent signature of the signed_index input
optional bytes serialized_tx = 5 [(binary) = true]; // Part of serialized and signed transaction optional bytes serialized_tx = 5; // Part of serialized and signed transaction
} }
// Transaction onput for SignTx workflow. It is response to TxRequest message sent by device. // Transaction onput for SignTx workflow. It is response to TxRequest message sent by device.
@ -370,7 +370,7 @@ message FirmwareErase {
} }
message FirmwareUpload { message FirmwareUpload {
required bytes payload = 1 [(binary) = true]; // Firmware to flash into device required bytes payload = 1; // Firmware to flash into device
} }
// **************************************************************************** // ****************************************************************************
@ -394,13 +394,13 @@ message DebugLinkGetState {
// Response object reflecting device's current state. It can be received only over debug link connection. // Response object reflecting device's current state. It can be received only over debug link connection.
message DebugLinkState { message DebugLinkState {
optional bytes layout = 1 [(binary) = true]; // Raw buffer of display optional bytes layout = 1; // Raw buffer of display
optional bytes pin = 2; // Current PIN, blank if PIN is not set/enabled optional string pin = 2; // Current PIN, blank if PIN is not set/enabled
optional bytes matrix = 3; // Current PIN matrix optional string matrix = 3; // Current PIN matrix
optional bytes mnemonic = 4; // current mnemonic format optional string mnemonic = 4; // current mnemonic format
optional HDNodeType node = 5; // current node (BIP32 format) optional HDNodeType node = 5; // current node (BIP32 format)
optional bool passphrase_protection = 6; optional bool passphrase_protection = 6;
optional bytes word = 7; // What word is on display in RecoveryDevice/ResetDevice workflow optional string word = 7; // What word is on display in RecoveryDevice/ResetDevice workflow
optional int32 word_pos = 8; // Which word of mnemonic do the device expect optional int32 word_pos = 8; // Which word of mnemonic do the device expect
optional bytes entropy = 9; // Return current entropy of ResetDevice workflow optional bytes entropy = 9; // Return current entropy of ResetDevice workflow
} }
@ -411,6 +411,6 @@ message DebugLinkStop {
message DebugLinkLog { message DebugLinkLog {
optional uint32 level = 1; optional uint32 level = 1;
optional bytes bucket = 2; optional string bucket = 2;
optional bytes text = 3; optional string text = 3;
} }

View File

@ -15,10 +15,10 @@ import "types.proto";
message Storage { message Storage {
required uint32 version = 1; required uint32 version = 1;
optional HDNodeType node = 2; optional HDNodeType node = 2;
optional bytes mnemonic = 3 [(binary) = true]; optional string mnemonic = 3;
optional bool passphrase_protection = 4; // whether node_serialized or mnemonic are encrypted (protected by passphrase) optional bool passphrase_protection = 4; // whether node_serialized or mnemonic are encrypted (protected by passphrase)
optional uint32 pin_failed_attempts = 5; optional uint32 pin_failed_attempts = 5;
optional bytes pin = 6; optional string pin = 6;
optional bytes language = 7; optional string language = 7;
optional bytes label = 8 [(binary) = true]; optional string label = 8;
} }

View File

@ -12,10 +12,6 @@ option java_outer_classname = "TrezorType";
import "google/protobuf/descriptor.proto"; import "google/protobuf/descriptor.proto";
extend google.protobuf.FieldOptions {
optional bool binary = 50001; // message field has binary payload
}
extend google.protobuf.EnumValueOptions { extend google.protobuf.EnumValueOptions {
optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR
optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC
@ -66,32 +62,32 @@ message HDNodeType {
required uint32 depth = 1; required uint32 depth = 1;
required uint32 fingerprint = 2; required uint32 fingerprint = 2;
required uint32 child_num = 3; required uint32 child_num = 3;
required bytes chain_code = 4 [(binary) = true]; required bytes chain_code = 4;
optional bytes private_key = 5 [(binary) = true]; optional bytes private_key = 5;
optional bytes public_key = 6 [(binary) = true]; optional bytes public_key = 6;
} }
message CoinType { message CoinType {
optional bytes coin_name = 1; optional string coin_name = 1;
optional bytes coin_shortcut = 2; optional string coin_shortcut = 2;
optional uint32 address_type = 3; optional uint32 address_type = 3;
optional uint64 maxfee_kb = 4; optional uint64 maxfee_kb = 4;
} }
message TxInputType { message TxInputType {
repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node
required bytes prev_hash = 2 [(binary) = true]; // Hash of previous transaction output to spend by this input required bytes prev_hash = 2; // Hash of previous transaction output to spend by this input
required uint32 prev_index = 3; // Index of previous output to spend required uint32 prev_index = 3; // Index of previous output to spend
optional bytes script_sig = 4 [(binary) = true]; // Script signature optional bytes script_sig = 4; // Script signature
optional uint32 sequence = 5 [default=0xffffffff]; optional uint32 sequence = 5 [default=0xffffffff];
} }
message TxOutputType { message TxOutputType {
optional bytes address = 1; // Target bitcoin address in base58 encoding optional string address = 1; // Target bitcoin address in base58 encoding
repeated uint32 address_n = 2; // Has higher priority than "address". repeated uint32 address_n = 2; // Has higher priority than "address".
required uint64 amount = 3; // Amount to send in satoshis required uint64 amount = 3; // Amount to send in satoshis
required ScriptType script_type = 4; // Select output script type required ScriptType script_type = 4; // Select output script type
repeated bytes script_args = 5 [(binary) = true]; // Provide additional parameters for the script (its script-depended) repeated bytes script_args = 5; // Provide additional parameters for the script (its script-depended)
} }
// Transaction output with script pubkey in binary form. // Transaction output with script pubkey in binary form.
@ -99,7 +95,7 @@ message TxOutputType {
// and for compiling TxOutput for signing. // and for compiling TxOutput for signing.
message TxOutputBinType { message TxOutputBinType {
required uint64 amount = 1; required uint64 amount = 1;
required bytes script_pubkey = 2 [(binary) = true]; required bytes script_pubkey = 2;
} }
message TransactionType { message TransactionType {