mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
Add Cardano currency support (#148)
This commit is contained in:
parent
6575418de9
commit
6eb330345e
@ -100,6 +100,21 @@ 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];
|
||||||
|
|
||||||
|
|
||||||
|
// Cardano
|
||||||
|
MessageType_CardanoSignMessage = 300 [(wire_in) = true];
|
||||||
|
MessageType_CardanoMessageSignature = 301 [(wire_out) = true];
|
||||||
|
MessageType_CardanoVerifyMessage = 302 [(wire_in) = true];
|
||||||
|
MessageType_CardanoSignTransaction = 303 [(wire_in) = true];
|
||||||
|
MessageType_CardanoTxRequest = 304 [(wire_out) = true];
|
||||||
|
MessageType_CardanoGetPublicKey = 305 [(wire_in) = true];
|
||||||
|
MessageType_CardanoPublicKey = 306 [(wire_out) = true];
|
||||||
|
MessageType_CardanoGetAddress = 307 [(wire_in) = true];
|
||||||
|
MessageType_CardanoAddress = 308 [(wire_out) = true];
|
||||||
|
MessageType_CardanoTxAck = 309 [(wire_in) = true];
|
||||||
|
MessageType_CardanoSignedTransaction = 310 [(wire_out) = true];
|
||||||
|
|
||||||
|
|
||||||
// Lisk
|
// Lisk
|
||||||
MessageType_LiskGetAddress = 114 [(wire_in) = true];
|
MessageType_LiskGetAddress = 114 [(wire_in) = true];
|
||||||
MessageType_LiskAddress = 115 [(wire_out) = true];
|
MessageType_LiskAddress = 115 [(wire_out) = true];
|
||||||
@ -1437,3 +1452,113 @@ message DebugLinkMemoryWrite {
|
|||||||
message DebugLinkFlashErase {
|
message DebugLinkFlashErase {
|
||||||
optional uint32 sector = 1;
|
optional uint32 sector = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for Cardano address
|
||||||
|
* @next CardanoAddress
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoGetAddress {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node
|
||||||
|
optional bool show_display = 2; // optionally prompt for confirmation on trezor display
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for Cardano address
|
||||||
|
* @next CardanoAddress
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoAddress {
|
||||||
|
optional string address = 1; // Base58 cardano address
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to sign Cardano message
|
||||||
|
* @next CardanoMessageSignature
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoSignMessage {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bytes message = 2; // message to be signed
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for public key corresponding to address_n path
|
||||||
|
* @next CardanoPublicKey
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoGetPublicKey {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Contains public key derived from device private seed
|
||||||
|
* @prev CardanoGetPublicKey
|
||||||
|
*/
|
||||||
|
message CardanoPublicKey {
|
||||||
|
optional string xpub = 1; // Xpub key
|
||||||
|
optional HDNodeType node = 2; // BIP-32 public node
|
||||||
|
optional string root_hd_passphrase = 3; // Hd passphrase for root in hex format
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to verify Cardano message
|
||||||
|
* @next Success
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoVerifyMessage {
|
||||||
|
optional bytes public_key = 1; // Public key which was used to sign message
|
||||||
|
optional bytes signature = 2; // signature to verify
|
||||||
|
optional bytes message = 3; // message to verify
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Signed Cardano message
|
||||||
|
* @prev CardanoSignMessage
|
||||||
|
*/
|
||||||
|
message CardanoMessageSignature {
|
||||||
|
optional bytes public_key = 1; // public key which was used to sign mesage
|
||||||
|
optional bytes signature = 2; // signature of the message
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to sign Cardano transaction
|
||||||
|
* @next CardanoSignedTransaction
|
||||||
|
* @next CardanoTxRequest
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message CardanoSignTransaction {
|
||||||
|
repeated CardanoTxInputType inputs = 1; // inputs to be used in transaction
|
||||||
|
repeated CardanoTxOutputType outputs = 2; // outputs to be used in transaction
|
||||||
|
optional uint32 transactions_count = 3; // transactions count
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Serialised signed cardano transaction if tx_index is not specified.
|
||||||
|
* If tx_index is specified, trezor will wait for transaction
|
||||||
|
* @prev CardanoSignTransaction
|
||||||
|
* @next CardanoTxAck
|
||||||
|
*/
|
||||||
|
message CardanoTxRequest {
|
||||||
|
optional uint32 tx_index = 1; // index of requested transaction
|
||||||
|
optional bytes tx_hash = 2; // hash of the signed transaction
|
||||||
|
optional bytes tx_body = 3; // serialised body of the signed transaction
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Serialised signed cardano transaction
|
||||||
|
* @prev CardanoSignTransaction
|
||||||
|
*/
|
||||||
|
message CardanoSignedTransaction {
|
||||||
|
optional bytes tx_hash = 1; // hash of the signed transaction
|
||||||
|
optional bytes tx_body = 2; // serialised body of the signed transaction
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Reported transaction data
|
||||||
|
* @prev CardanoTxRequest
|
||||||
|
* @next CardanoTxRequest
|
||||||
|
*/
|
||||||
|
message CardanoTxAck {
|
||||||
|
optional bytes transaction = 1;
|
||||||
|
}
|
||||||
|
@ -511,3 +511,24 @@ message LiskMultisignatureType {
|
|||||||
optional uint32 life_time = 2;
|
optional uint32 life_time = 2;
|
||||||
repeated string keys_group = 3;
|
repeated string keys_group = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure representing cardano transaction input
|
||||||
|
* @used_in CardanoSignTransacion
|
||||||
|
*/
|
||||||
|
message CardanoTxInputType {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bytes prev_hash = 2; // hash of previous transaction output to spend by this input
|
||||||
|
optional uint32 prev_index = 3; // index of previous output to spend
|
||||||
|
optional uint32 type = 4; // input type, defaults to 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure representing cardano transaction output
|
||||||
|
* @used_in CardanoSignTransacion
|
||||||
|
*/
|
||||||
|
message CardanoTxOutputType {
|
||||||
|
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"
|
||||||
|
optional uint64 amount = 3; // amount to spend
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user