1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

Added structures for multisig and CipherKeyValue

This commit is contained in:
slush0 2014-06-05 21:55:56 +02:00 committed by Pavol Rusnak
parent 4eef0a9866
commit f264f01314
2 changed files with 54 additions and 15 deletions

View File

@ -2,7 +2,7 @@
* Messages for TREZOR communication * Messages for TREZOR communication
* *
* @author Marek Palatinus <slush@satoshilabs.com> * @author Marek Palatinus <slush@satoshilabs.com>
* @version 0.6 * @version 1.2
*/ */
// Sugar for easier handling in Java // Sugar for easier handling in Java
@ -37,6 +37,7 @@ enum MessageType {
MessageType_Cancel = 20 [(wire_in) = true]; MessageType_Cancel = 20 [(wire_in) = true];
MessageType_TxRequest = 21 [(wire_out) = true]; MessageType_TxRequest = 21 [(wire_out) = true];
MessageType_TxAck = 22 [(wire_in) = true]; MessageType_TxAck = 22 [(wire_in) = true];
MessageType_CipherKeyValue = 23 [(wire_in) = true];
MessageType_ApplySettings = 25 [(wire_in) = true]; MessageType_ApplySettings = 25 [(wire_in) = true];
MessageType_ButtonRequest = 26 [(wire_out) = true]; MessageType_ButtonRequest = 26 [(wire_out) = true];
MessageType_ButtonAck = 27 [(wire_in) = true]; MessageType_ButtonAck = 27 [(wire_in) = true];
@ -91,7 +92,7 @@ message Features {
optional bool initialized = 12; // does device contain seed? optional bool initialized = 12; // does device contain seed?
optional bytes revision = 13; // SCM revision of firmware optional bytes revision = 13; // SCM revision of firmware
optional bytes bootloader_hash = 14; // hash of the bootloader optional bytes bootloader_hash = 14; // hash of the bootloader
optional bool imported = 15; // was storage imported from an external source? optional bool imported = 15; // was storage imported from an external source?
} }
/** /**
@ -131,6 +132,7 @@ message Ping {
*/ */
message Success { message Success {
optional string message = 1; // human readable description of action or request-specific payload optional string message = 1; // human readable description of action or request-specific payload
optional bytes payload = 2; // request-specific binary payload
} }
/** /**
@ -378,6 +380,24 @@ message MessageSignature {
optional bytes signature = 2; // signature of the message optional bytes signature = 2; // signature of the message
} }
///////////////////////////
// Encryption/decryption //
///////////////////////////
/**
* Request: Ask device to encrypt or decrypt value of given key
* @next Success
* @next Failure
*/
message CipherKeyValue {
repeated uint32 address_n = 1;
optional string key = 2;
optional bytes value = 3;
optional bool encrypt = 4; // are we encrypting (True) or decrypting (False)?
optional bool ask_on_encrypt = 5; // should we ask on encrypt operation?
optional bool ask_on_decrypt = 6; // should we ask on decrypt operation?
}
////////////////////////////////// //////////////////////////////////
// Transaction signing messages // // Transaction signing messages //
////////////////////////////////// //////////////////////////////////
@ -441,7 +461,7 @@ message SimpleSignTx {
* @prev TxAck * @prev TxAck
*/ */
message TxRequest { message TxRequest {
optional RequestType request_type = 1; // what should be filled in TxAck message? optional RequestType request_type = 1; // what should be filled in TxAck message?
optional TxRequestDetailsType details = 2; // request for tx details optional TxRequestDetailsType details = 2; // request for tx details
optional TxRequestSerializedType serialized = 3; // serialized data and request for next optional TxRequestSerializedType serialized = 3; // serialized data and request for next
} }

View File

@ -2,7 +2,7 @@
* Types for TREZOR communication * Types for TREZOR communication
* *
* @author Marek Palatinus <slush@satoshilabs.com> * @author Marek Palatinus <slush@satoshilabs.com>
* @version 0.6 * @version 1.2
*/ */
// Sugar for easier handling in Java // Sugar for easier handling in Java
@ -44,11 +44,20 @@ enum FailureType {
* Type of script which will be used for transaction output * Type of script which will be used for transaction output
* @used_in TxOutputType * @used_in TxOutputType
*/ */
enum ScriptType { enum OutputScriptType {
PAYTOADDRESS = 0; PAYTOADDRESS = 0;
PAYTOSCRIPTHASH = 1; PAYTOSCRIPTHASH = 1;
} }
/**
* Type of script which will be used for transaction output
* @used_in TxInputType
*/
enum InputScriptType {
SPENDADDRESS = 0;
SPENDMULTISIG = 1;
}
/** /**
* Type of information required by transaction signing process * Type of information required by transaction signing process
* @used_in TxRequest * @used_in TxRequest
@ -113,17 +122,28 @@ message CoinType {
optional uint64 maxfee_kb = 4; optional uint64 maxfee_kb = 4;
} }
/*
* Type of redeem script used in input
* @used_in TxInputType
*/
message MultisigRedeemScriptType {
repeated bytes pubkeys = 1; // pubkeys from multisig address (sorted lexicographically)
repeated bytes signatures = 2; // existing signatures for partially signed input
}
/** /**
* Structure representing transaction input * Structure representing transaction input
* @used_in SimpleSignTx * @used_in SimpleSignTx
* @used_in TransactionType * @used_in TransactionType
*/ */
message TxInputType { message TxInputType {
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
required bytes prev_hash = 2; // 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; // script signature optional bytes script_sig = 4; // script signature, unset for tx to sign
optional uint32 sequence = 5 [default=0xffffffff]; // sequence optional uint32 sequence = 5 [default=0xffffffff]; // sequence
optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script
optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx
} }
/** /**
@ -132,11 +152,10 @@ message TxInputType {
* @used_in TransactionType * @used_in TransactionType
*/ */
message TxOutputType { message TxOutputType {
optional string address = 1; // target coin address in Base58 encoding optional string address = 1; // target coin address in Base58 encoding
repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address" repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address"
required uint64 amount = 3; // amount to spend in satoshis required uint64 amount = 3; // amount to spend in satoshis
required ScriptType script_type = 4; // output script type required OutputScriptType script_type = 4; // output script type
repeated bytes script_args = 5; // additional parameters for the script (script-dependent)
} }
/** /**