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

protob: Add messages for Lisk support

This commit is contained in:
Aleksey Popov 2017-12-19 18:48:07 +03:00 committed by Pavol Rusnak
parent 59147463e2
commit 6a7710c026
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 168 additions and 4 deletions

View File

@ -100,16 +100,25 @@ enum MessageType {
MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true]; MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true];
MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true]; MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true];
// Lisk
MessageType_LiskGetAddress = 114 [(wire_in) = true];
MessageType_LiskAddress = 115 [(wire_out) = true];
MessageType_LiskSignTx = 116 [(wire_in) = true];
MessageType_LiskSignedTx = 117 [(wire_out) = true];
MessageType_LiskSignMessage = 118 [(wire_in) = true];
MessageType_LiskMessageSignature = 119 [(wire_out) = true];
MessageType_LiskVerifyMessage = 120 [(wire_in) = true];
MessageType_LiskGetPublicKey = 121 [(wire_in) = true];
MessageType_LiskPublicKey = 122 [(wire_out) = true];
// Stellar // Stellar
MessageType_StellarGetPublicKey = 200 [(wire_in) = true]; MessageType_StellarGetPublicKey = 200 [(wire_in) = true];
MessageType_StellarPublicKey = 201 [(wire_out) = true]; MessageType_StellarPublicKey = 201 [(wire_out) = true];
MessageType_StellarSignTx = 202 [(wire_in) = true]; MessageType_StellarSignTx = 202 [(wire_in) = true];
MessageType_StellarTxOpRequest = 203 [(wire_out) = true]; MessageType_StellarTxOpRequest = 203 [(wire_out) = true];
MessageType_StellarSignMessage = 204 [(wire_in) = true]; MessageType_StellarSignMessage = 204 [(wire_in) = true];
MessageType_StellarMessageSignature = 205 [(wire_out) = true]; MessageType_StellarMessageSignature = 205 [(wire_out) = true];
MessageType_StellarVerifyMessage = 206 [(wire_in) = true]; MessageType_StellarVerifyMessage = 206 [(wire_in) = true];
MessageType_StellarCreateAccountOp = 210 [(wire_in) = true]; MessageType_StellarCreateAccountOp = 210 [(wire_in) = true];
MessageType_StellarPaymentOp = 211 [(wire_in) = true]; MessageType_StellarPaymentOp = 211 [(wire_in) = true];
MessageType_StellarPathPaymentOp = 212 [(wire_in) = true]; MessageType_StellarPathPaymentOp = 212 [(wire_in) = true];
@ -122,7 +131,6 @@ enum MessageType {
// Omitted: inflation is not a supported operation, would be 219 // Omitted: inflation is not a supported operation, would be 219
MessageType_StellarManageDataOp = 220 [(wire_in) = true]; MessageType_StellarManageDataOp = 220 [(wire_in) = true];
MessageType_StellarBumpSequenceOp = 221 [(wire_in) = true]; MessageType_StellarBumpSequenceOp = 221 [(wire_in) = true];
MessageType_StellarSignedTx = 230 [(wire_out) = true]; MessageType_StellarSignedTx = 230 [(wire_out) = true];
} }
@ -1265,6 +1273,93 @@ message StellarSignedTx {
} }
////////////////////
// Lisk messages //
//////////////////
/**
* Request: Ask device for Lisk public key corresponding to address_n path
* @next LiskPublicKey
*/
message LiskGetPublicKey {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bool show_display = 2; // Optionally show on display before sending the result
}
/**
* Response: Contains Lisk public key derived from device private seed
* @prev LiskGetPublicKey
*/
message LiskPublicKey {
optional bytes public_key = 1; // Lisk public key
}
/**
* Request: Ask device for Lisk address corresponding to address_n path
* @next PassphraseRequest
* @next LiskAddress
* @next Failure
*/
message LiskGetAddress {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bool show_display = 2; // Optionally show on display before sending the result
}
/**
* Response: Contains Lisk address derived from device private seed
* @prev LiskGetAddress
*/
message LiskAddress {
optional string address = 1; // Lisk address
}
/**
* Request: Ask device to sign Lisk transaction
* @next LiskSignedTx
*/
message LiskSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional LiskTransactionCommon transaction = 2; // Lisk transaction structure
}
/**
* Response: Contains Lisk transaction signature
* @prev LiskSignTx
*/
message LiskSignedTx {
optional bytes signature = 1;
}
/**
* Request: Ask device to sign message
* @next LiskMessageSignature
* @next Failure
*/
message LiskSignMessage {
repeated uint32 address_n = 1;
optional bytes message = 2;
}
/**
* Response: Signed message
* @prev LiskSignMessage
*/
message LiskMessageSignature {
optional string address = 1;
optional bytes signature = 2;
}
/**
* Request: Ask device to verify message
* @next Success
* @next Failure
*/
message LiskVerifyMessage {
optional bytes signature = 1;
optional bytes public_key = 2;
optional bytes message = 3;
}
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Debug messages (only available if DebugLink is enabled) // // Debug messages (only available if DebugLink is enabled) //
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////

View File

@ -453,4 +453,73 @@ message StellarAssetType {
optional uint32 type = 1; // 0 = native asset (XLM), 1 = alphanum 4, 2 = alphanum 12 optional 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 bytes issuer = 3; // 32-byte issuing address optional bytes issuer = 3; // 32-byte issuing address
} }
/**
* Type of Lisk transaction
* @used_in LiskTransactionCommon
*/
enum LiskTransactionType {
Transfer = 0;
RegisterSecondPassphrase = 1;
RegisterDelegate = 2;
CastVotes = 3;
RegisterMultisignatureAccount = 4;
CreateDapp = 5;
TransferIntoDapp = 6;
TransferOutOfDapp = 7;
}
/**
* Structure representing the common part for Lisk transactions
* @used_in LiskSignTx
*/
message LiskTransactionCommon {
optional LiskTransactionType type = 1;
optional string amount = 2 [default='0'];
optional string fee = 3;
optional string recipient_id = 4;
optional string sender_public_key = 5;
optional string requester_public_key = 6;
optional string signature = 7;
optional uint32 timestamp = 8;
optional LiskTransactionAsset asset = 9;
}
/**
* Structure representing the asset field in the Lisk transaction
* @used_in LiskTransactionCommon
*/
message LiskTransactionAsset {
optional LiskSignatureType signature = 1;
optional LiskDelegateType delegate = 2;
repeated string votes = 3;
optional LiskMultisignatureType multisignature = 4;
optional string data = 5;
}
/**
* Structure representing the signature field in the Lisk transaction asset field
* @used_in LiskTransactionAsset
*/
message LiskSignatureType {
optional bytes public_key = 1;
}
/**
* Structure representing the delegate field in the Lisk transaction asset field
* @used_in LiskTransactionAsset
*/
message LiskDelegateType {
optional string username = 1;
}
/**
* Structure representing the multisignature field in the Lisk transaction asset field
* @used_in LiskTransactionAsset
*/
message LiskMultisignatureType {
optional uint32 min = 1;
optional uint32 life_time = 2;
repeated string keys_group = 3;
}