2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Messages for TREZOR communication
|
|
|
|
*/
|
|
|
|
|
2014-04-07 16:01:11 +00:00
|
|
|
// Sugar for easier handling in Java
|
2017-07-04 12:02:22 +00:00
|
|
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
2014-02-02 10:28:43 +00:00
|
|
|
option java_outer_classname = "TrezorMessage";
|
|
|
|
|
2013-11-26 14:48:17 +00:00
|
|
|
import "types.proto";
|
2013-11-22 16:27:47 +00:00
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Mapping between Trezor wire identifier (uint) and a protobuf message
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
enum MessageType {
|
|
|
|
MessageType_Initialize = 0 [(wire_in) = true];
|
|
|
|
MessageType_Ping = 1 [(wire_in) = true];
|
|
|
|
MessageType_Success = 2 [(wire_out) = true];
|
|
|
|
MessageType_Failure = 3 [(wire_out) = true];
|
|
|
|
MessageType_ChangePin = 4 [(wire_in) = true];
|
|
|
|
MessageType_WipeDevice = 5 [(wire_in) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true];
|
|
|
|
MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true];
|
|
|
|
MessageType_FirmwareRequest = 8 [(wire_out) = true, (wire_bootloader) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_GetEntropy = 9 [(wire_in) = true];
|
|
|
|
MessageType_Entropy = 10 [(wire_out) = true];
|
|
|
|
MessageType_GetPublicKey = 11 [(wire_in) = true];
|
|
|
|
MessageType_PublicKey = 12 [(wire_out) = true];
|
|
|
|
MessageType_LoadDevice = 13 [(wire_in) = true];
|
|
|
|
MessageType_ResetDevice = 14 [(wire_in) = true];
|
|
|
|
MessageType_SignTx = 15 [(wire_in) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_SimpleSignTx = 16 [(wire_in) = true, deprecated = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_Features = 17 [(wire_out) = true];
|
|
|
|
MessageType_PinMatrixRequest = 18 [(wire_out) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_PinMatrixAck = 19 [(wire_in) = true, (wire_tiny) = true];
|
2013-11-26 14:48:17 +00:00
|
|
|
MessageType_Cancel = 20 [(wire_in) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_TxRequest = 21 [(wire_out) = true];
|
2014-03-25 18:20:36 +00:00
|
|
|
MessageType_TxAck = 22 [(wire_in) = true];
|
2014-06-05 19:55:56 +00:00
|
|
|
MessageType_CipherKeyValue = 23 [(wire_in) = true];
|
2014-06-17 11:32:42 +00:00
|
|
|
MessageType_ClearSession = 24 [(wire_in) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_ApplySettings = 25 [(wire_in) = true];
|
|
|
|
MessageType_ButtonRequest = 26 [(wire_out) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_ButtonAck = 27 [(wire_in) = true, (wire_tiny) = true];
|
2017-07-17 13:12:40 +00:00
|
|
|
MessageType_ApplyFlags = 28 [(wire_in) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_GetAddress = 29 [(wire_in) = true];
|
|
|
|
MessageType_Address = 30 [(wire_out) = true];
|
2017-06-29 15:21:26 +00:00
|
|
|
MessageType_SelfTest = 32 [(wire_in) = true, (wire_bootloader) = true];
|
2017-06-23 17:06:24 +00:00
|
|
|
MessageType_BackupDevice = 34 [(wire_in) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_EntropyRequest = 35 [(wire_out) = true];
|
|
|
|
MessageType_EntropyAck = 36 [(wire_in) = true];
|
2013-11-26 03:34:48 +00:00
|
|
|
MessageType_SignMessage = 38 [(wire_in) = true];
|
|
|
|
MessageType_VerifyMessage = 39 [(wire_in) = true];
|
|
|
|
MessageType_MessageSignature = 40 [(wire_out) = true];
|
|
|
|
MessageType_PassphraseRequest = 41 [(wire_out) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_PassphraseAck = 42 [(wire_in) = true, (wire_tiny) = true];
|
2017-06-28 16:44:19 +00:00
|
|
|
MessageType_EstimateTxSize = 43 [(wire_in) = true, deprecated = true];
|
|
|
|
MessageType_TxSize = 44 [(wire_out) = true, deprecated = true];
|
2014-02-02 17:29:37 +00:00
|
|
|
MessageType_RecoveryDevice = 45 [(wire_in) = true];
|
|
|
|
MessageType_WordRequest = 46 [(wire_out) = true];
|
2014-03-25 18:20:36 +00:00
|
|
|
MessageType_WordAck = 47 [(wire_in) = true];
|
2015-02-20 15:45:59 +00:00
|
|
|
MessageType_CipheredKeyValue = 48 [(wire_out) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_EncryptMessage = 49 [(wire_in) = true, deprecated = true];
|
|
|
|
MessageType_EncryptedMessage = 50 [(wire_out) = true, deprecated = true];
|
|
|
|
MessageType_DecryptMessage = 51 [(wire_in) = true, deprecated = true];
|
|
|
|
MessageType_DecryptedMessage = 52 [(wire_out) = true, deprecated = true];
|
2015-02-20 15:45:59 +00:00
|
|
|
MessageType_SignIdentity = 53 [(wire_in) = true];
|
|
|
|
MessageType_SignedIdentity = 54 [(wire_out) = true];
|
2015-03-30 13:38:11 +00:00
|
|
|
MessageType_GetFeatures = 55 [(wire_in) = true];
|
2016-03-20 13:12:05 +00:00
|
|
|
MessageType_EthereumGetAddress = 56 [(wire_in) = true];
|
|
|
|
MessageType_EthereumAddress = 57 [(wire_out) = true];
|
|
|
|
MessageType_EthereumSignTx = 58 [(wire_in) = true];
|
|
|
|
MessageType_EthereumTxRequest = 59 [(wire_out) = true];
|
|
|
|
MessageType_EthereumTxAck = 60 [(wire_in) = true];
|
2016-06-10 17:46:57 +00:00
|
|
|
MessageType_GetECDHSessionKey = 61 [(wire_in) = true];
|
|
|
|
MessageType_ECDHSessionKey = 62 [(wire_out) = true];
|
2016-06-12 21:37:24 +00:00
|
|
|
MessageType_SetU2FCounter = 63 [(wire_in) = true];
|
2017-07-12 15:34:03 +00:00
|
|
|
MessageType_EthereumSignMessage = 64 [(wire_in) = true];
|
|
|
|
MessageType_EthereumVerifyMessage = 65 [(wire_in) = true];
|
|
|
|
MessageType_EthereumMessageSignature = 66 [(wire_out) = true];
|
2017-05-29 13:56:29 +00:00
|
|
|
MessageType_NEMGetAddress = 67 [(wire_in) = true];
|
|
|
|
MessageType_NEMAddress = 68 [(wire_out) = true];
|
2017-09-02 21:43:46 +00:00
|
|
|
MessageType_NEMSignTx = 69 [(wire_in) = true];
|
|
|
|
MessageType_NEMSignedTx = 70 [(wire_out) = true];
|
2017-10-03 06:53:53 +00:00
|
|
|
MessageType_CosiCommit = 71 [(wire_in) = true];
|
|
|
|
MessageType_CosiCommitment = 72 [(wire_out) = true];
|
|
|
|
MessageType_CosiSign = 73 [(wire_in) = true];
|
|
|
|
MessageType_CosiSignature = 74 [(wire_out) = true];
|
2017-05-29 01:05:13 +00:00
|
|
|
MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true, (wire_tiny) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true];
|
|
|
|
MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
|
|
|
|
MessageType_DebugLinkStop = 103 [(wire_debug_in) = true];
|
2014-01-09 13:15:53 +00:00
|
|
|
MessageType_DebugLinkLog = 104 [(wire_debug_out) = true];
|
2016-05-26 18:07:15 +00:00
|
|
|
MessageType_DebugLinkMemoryRead = 110 [(wire_debug_in) = true];
|
|
|
|
MessageType_DebugLinkMemory = 111 [(wire_debug_out) = true];
|
|
|
|
MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true];
|
|
|
|
MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true];
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
////////////////////
|
|
|
|
// Basic messages //
|
|
|
|
////////////////////
|
2013-11-22 16:27:47 +00:00
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Reset device to default state and ask for device details
|
|
|
|
* @next Features
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Initialize {
|
|
|
|
}
|
|
|
|
|
2015-03-30 13:38:11 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask for device details (no device reset)
|
|
|
|
* @next Features
|
|
|
|
*/
|
|
|
|
message GetFeatures {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Reports various information about the device
|
|
|
|
* @prev Initialize
|
2015-03-30 13:38:11 +00:00
|
|
|
* @prev GetFeatures
|
2014-03-25 18:20:36 +00:00
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Features {
|
2014-03-25 18:20:36 +00:00
|
|
|
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 minor_version = 3; // minor version of the device, e.g. 0
|
|
|
|
optional uint32 patch_version = 4; // patch version of the device, 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?
|
|
|
|
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
|
|
|
|
optional string language = 9; // device language
|
|
|
|
optional string label = 10; // device description label
|
|
|
|
repeated CoinType coins = 11; // supported coins
|
|
|
|
optional bool initialized = 12; // does device contain seed?
|
|
|
|
optional bytes revision = 13; // SCM revision of firmware
|
|
|
|
optional bytes bootloader_hash = 14; // hash of the bootloader
|
2014-06-05 19:55:56 +00:00
|
|
|
optional bool imported = 15; // was storage imported from an external source?
|
2015-03-30 13:38:11 +00:00
|
|
|
optional bool pin_cached = 16; // is PIN already cached in session?
|
|
|
|
optional bool passphrase_cached = 17; // is passphrase already cached in session?
|
2016-09-26 10:44:58 +00:00
|
|
|
optional bool firmware_present = 18; // is valid firmware loaded?
|
2017-06-26 17:49:29 +00:00
|
|
|
optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
|
2017-07-17 13:12:40 +00:00
|
|
|
optional uint32 flags = 20; // device flags (equals to Storage.flags)
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
2014-06-17 11:32:42 +00:00
|
|
|
/**
|
|
|
|
* Request: clear session (removes cached PIN, passphrase, etc).
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message ClearSession {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: change language and/or label of the device
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
* @next ButtonRequest
|
|
|
|
* @next PinMatrixRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message ApplySettings {
|
2014-03-01 10:17:06 +00:00
|
|
|
optional string language = 1;
|
|
|
|
optional string label = 2;
|
2014-12-13 15:13:46 +00:00
|
|
|
optional bool use_passphrase = 3;
|
2015-02-04 19:17:10 +00:00
|
|
|
optional bytes homescreen = 4;
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2017-07-17 13:12:40 +00:00
|
|
|
/**
|
|
|
|
* Request: set flags of the device
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message ApplyFlags {
|
|
|
|
optional uint32 flags = 1; // bitmask, can only set bits, not unset
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Starts workflow for setting/changing/removing the PIN
|
|
|
|
* @next ButtonRequest
|
|
|
|
* @next PinMatrixRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message ChangePin {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional bool remove = 1; // is PIN removal requested?
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Test if the device is alive, device sends back the message in Success response
|
|
|
|
* @next Success
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Ping {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional string message = 1; // message to send back in Success message
|
|
|
|
optional bool button_protection = 2; // ask for button press
|
|
|
|
optional bool pin_protection = 3; // ask for PIN if set in device
|
|
|
|
optional bool passphrase_protection = 4; // ask for passphrase if set in device
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Success of the previous request
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Success {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional string message = 1; // human readable description of action or request-specific payload
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Failure of the previous request
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Failure {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional FailureType code = 1; // computer-readable definition of the error state
|
|
|
|
optional string message = 2; // human-readable message of the error state
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Device is waiting for HW button press.
|
|
|
|
* @next ButtonAck
|
|
|
|
* @next Cancel
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message ButtonRequest {
|
2014-02-04 16:47:29 +00:00
|
|
|
optional ButtonRequestType code = 1;
|
2014-03-01 10:17:06 +00:00
|
|
|
optional string data = 2;
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Computer agrees to wait for HW button press
|
|
|
|
* @prev ButtonRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message ButtonAck {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
|
|
|
|
* @next PinMatrixAck
|
|
|
|
* @next Cancel
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message PinMatrixRequest {
|
2014-03-10 17:08:34 +00:00
|
|
|
optional PinMatrixRequestType type = 1;
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Computer responds with encoded PIN
|
|
|
|
* @prev PinMatrixRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message PinMatrixAck {
|
2014-03-25 18:20:36 +00:00
|
|
|
required string pin = 1; // matrix encoded PIN entered by user
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Abort last operation that required user interaction
|
|
|
|
* @prev ButtonRequest
|
|
|
|
* @prev PinMatrixRequest
|
|
|
|
* @prev PassphraseRequest
|
|
|
|
*/
|
2013-11-26 14:48:17 +00:00
|
|
|
message Cancel {
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Device awaits encryption passphrase
|
|
|
|
* @next PassphraseAck
|
|
|
|
* @next Cancel
|
|
|
|
*/
|
2013-11-26 03:34:48 +00:00
|
|
|
message PassphraseRequest {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Send passphrase back
|
|
|
|
* @prev PassphraseRequest
|
|
|
|
*/
|
2013-11-26 03:34:48 +00:00
|
|
|
message PassphraseAck {
|
2014-03-01 10:17:06 +00:00
|
|
|
required string passphrase = 1;
|
2013-11-26 03:34:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Request a sample of random data generated by hardware RNG. May be used for testing.
|
|
|
|
* @next ButtonRequest
|
|
|
|
* @next Entropy
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message GetEntropy {
|
2014-03-25 18:20:36 +00:00
|
|
|
required uint32 size = 1; // size of requested entropy
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Reply with random data generated by internal RNG
|
|
|
|
* @prev GetEntropy
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Entropy {
|
2014-03-25 18:20:36 +00:00
|
|
|
required bytes entropy = 1; // stream of random generated bytes
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device for public key corresponding to address_n path
|
|
|
|
* @next PassphraseRequest
|
|
|
|
* @next PublicKey
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message GetPublicKey {
|
2014-03-25 18:20:36 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
2015-11-19 10:16:46 +00:00
|
|
|
optional string ecdsa_curve_name = 2; // ECDSA curve name to use
|
|
|
|
optional bool show_display = 3; // optionally show on display before sending the result
|
2017-04-21 10:47:23 +00:00
|
|
|
optional string coin_name = 4 [default='Bitcoin'];
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Contains public key derived from device private seed
|
|
|
|
* @prev GetPublicKey
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message PublicKey {
|
2014-03-25 18:20:36 +00:00
|
|
|
required HDNodeType node = 1; // BIP32 public node
|
2014-08-07 19:03:26 +00:00
|
|
|
optional string xpub = 2; // serialized form of public node
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device for address corresponding to address_n path
|
|
|
|
* @next PassphraseRequest
|
|
|
|
* @next Address
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message GetAddress {
|
2017-07-24 14:05:13 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
2014-03-01 10:17:06 +00:00
|
|
|
optional string coin_name = 2 [default='Bitcoin'];
|
2017-07-24 14:05:13 +00:00
|
|
|
optional bool show_display = 3 ; // optionally show on display before sending the result
|
|
|
|
optional MultisigRedeemScriptType multisig = 4; // filled if we are showing a multisig address
|
|
|
|
optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2016-03-20 13:12:05 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device for Ethereum address corresponding to address_n path
|
|
|
|
* @next PassphraseRequest
|
|
|
|
* @next EthereumAddress
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message EthereumGetAddress {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Contains address derived from device private seed
|
|
|
|
* @prev GetAddress
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message Address {
|
2014-03-25 18:20:36 +00:00
|
|
|
required string address = 1; // Coin address in Base58 encoding
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2016-03-20 13:12:05 +00:00
|
|
|
/**
|
|
|
|
* Response: Contains an Ethereum address derived from device private seed
|
|
|
|
* @prev EthereumGetAddress
|
|
|
|
*/
|
|
|
|
message EthereumAddress {
|
|
|
|
required bytes address = 1; // Coin address as an Ethereum 160 bit hash
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Request device to wipe all sensitive data and settings
|
|
|
|
* @next ButtonRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message WipeDevice {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Load seed and related internal settings from the computer
|
|
|
|
* @next ButtonRequest
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message LoadDevice {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words)
|
|
|
|
optional HDNodeType node = 2; // BIP-32 node
|
|
|
|
optional string pin = 3; // set PIN protection
|
|
|
|
optional bool passphrase_protection = 4; // enable master node encryption using passphrase
|
|
|
|
optional string language = 5 [default='english']; // device language
|
|
|
|
optional string label = 6; // device label
|
|
|
|
optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum
|
2016-10-31 15:09:21 +00:00
|
|
|
optional uint32 u2f_counter = 8; // U2F counter
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to do initialization involving user interaction
|
|
|
|
* @next EntropyRequest
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message ResetDevice {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy
|
2015-07-17 12:26:05 +00:00
|
|
|
optional uint32 strength = 2 [default=256]; // strength of seed in bits
|
2014-03-25 18:20:36 +00:00
|
|
|
optional bool passphrase_protection = 3; // enable master node encryption using passphrase
|
|
|
|
optional bool pin_protection = 4; // enable PIN protection
|
|
|
|
optional string language = 5 [default='english']; // device language
|
|
|
|
optional string label = 6; // device label
|
2016-10-31 15:09:21 +00:00
|
|
|
optional uint32 u2f_counter = 7; // U2F counter
|
2017-06-23 17:06:24 +00:00
|
|
|
optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Perform backup of the device seed if not backed up using ResetDevice
|
|
|
|
* @next ButtonRequest
|
|
|
|
*/
|
|
|
|
message BackupDevice {
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Ask for additional entropy from host computer
|
|
|
|
* @prev ResetDevice
|
|
|
|
* @next EntropyAck
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message EntropyRequest {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Provide additional entropy for seed generation function
|
|
|
|
* @prev EntropyRequest
|
|
|
|
* @next ButtonRequest
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message EntropyAck {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional bytes entropy = 1; // 256 bits (32 bytes) of random data
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Start recovery workflow asking user for specific words of mnemonic
|
|
|
|
* Used to recovery device safely even on untrusted computer.
|
|
|
|
* @next WordRequest
|
|
|
|
*/
|
2014-02-02 17:29:37 +00:00
|
|
|
message RecoveryDevice {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional uint32 word_count = 1; // number of words in BIP-39 mnemonic
|
|
|
|
optional bool passphrase_protection = 2; // enable master node encryption using passphrase
|
|
|
|
optional bool pin_protection = 3; // enable PIN protection
|
|
|
|
optional string language = 4 [default='english']; // device language
|
|
|
|
optional string label = 5; // device label
|
|
|
|
optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process
|
2016-06-29 20:34:55 +00:00
|
|
|
// 7 reserved for unused recovery method
|
|
|
|
optional uint32 type = 8; // supported recovery type (see RecoveryType)
|
|
|
|
optional uint32 u2f_counter = 9; // U2F counter
|
2017-06-22 10:38:06 +00:00
|
|
|
optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation)
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device is waiting for user to enter word of the mnemonic
|
|
|
|
* Its position is shown only on device's internal display.
|
|
|
|
* @prev RecoveryDevice
|
|
|
|
* @prev WordAck
|
|
|
|
*/
|
2014-02-02 17:29:37 +00:00
|
|
|
message WordRequest {
|
2016-06-29 20:34:55 +00:00
|
|
|
optional WordRequestType type = 1;
|
2014-02-02 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Computer replies with word from the mnemonic
|
|
|
|
* @prev WordRequest
|
|
|
|
* @next WordRequest
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2014-02-02 17:29:37 +00:00
|
|
|
message WordAck {
|
2014-03-25 18:20:36 +00:00
|
|
|
required string word = 1; // one word of mnemonic on asked position
|
2014-02-02 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
//////////////////////////////
|
|
|
|
// Message signing messages //
|
|
|
|
//////////////////////////////
|
2013-11-22 16:27:47 +00:00
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to sign message
|
|
|
|
* @next MessageSignature
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-26 03:34:48 +00:00
|
|
|
message SignMessage {
|
2017-07-24 14:05:13 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
required bytes message = 2; // message to be signed
|
|
|
|
optional string coin_name = 3 [default='Bitcoin']; // coin to use for signing
|
|
|
|
optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
|
2013-11-26 03:34:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to verify message
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-26 03:34:48 +00:00
|
|
|
message VerifyMessage {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional string address = 1; // address to verify
|
|
|
|
optional bytes signature = 2; // signature to verify
|
|
|
|
optional bytes message = 3; // message to verify
|
2016-05-17 16:06:00 +00:00
|
|
|
optional string coin_name = 4 [default='Bitcoin']; // coin to use for verifying
|
2013-11-26 03:34:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Signed message
|
|
|
|
* @prev SignMessage
|
|
|
|
*/
|
2013-11-26 03:34:48 +00:00
|
|
|
message MessageSignature {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional string address = 1; // address used to sign the message
|
|
|
|
optional bytes signature = 2; // signature of the message
|
|
|
|
}
|
|
|
|
|
2014-06-05 19:55:56 +00:00
|
|
|
///////////////////////////
|
|
|
|
// Encryption/decryption //
|
|
|
|
///////////////////////////
|
|
|
|
|
2014-06-12 14:01:31 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to encrypt message
|
2014-11-03 18:43:11 +00:00
|
|
|
* @next EncryptedMessage
|
2014-06-12 14:01:31 +00:00
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message EncryptMessage {
|
2014-06-13 14:32:20 +00:00
|
|
|
optional bytes pubkey = 1; // public key
|
|
|
|
optional bytes message = 2; // message to encrypt
|
|
|
|
optional bool display_only = 3; // show just on display? (don't send back via wire)
|
2014-10-22 15:39:05 +00:00
|
|
|
repeated uint32 address_n = 4; // BIP-32 path to derive the signing key from master node
|
2014-10-29 23:23:32 +00:00
|
|
|
optional string coin_name = 5 [default='Bitcoin']; // coin to use for signing
|
2014-06-12 14:01:31 +00:00
|
|
|
}
|
|
|
|
|
2014-11-03 18:43:11 +00:00
|
|
|
/**
|
|
|
|
* Response: Encrypted message
|
|
|
|
* @prev EncryptMessage
|
|
|
|
*/
|
|
|
|
message EncryptedMessage {
|
|
|
|
optional bytes nonce = 1; // nonce used during encryption
|
|
|
|
optional bytes message = 2; // encrypted message
|
|
|
|
optional bytes hmac = 3; // message hmac
|
|
|
|
}
|
|
|
|
|
2014-06-12 14:01:31 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to decrypt message
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message DecryptMessage {
|
2014-10-22 15:39:05 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the decryption key from master node
|
2014-11-03 18:43:11 +00:00
|
|
|
optional bytes nonce = 2; // nonce used during encryption
|
|
|
|
optional bytes message = 3; // message to decrypt
|
|
|
|
optional bytes hmac = 4; // message hmac
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Decrypted message
|
|
|
|
* @prev DecryptedMessage
|
|
|
|
*/
|
|
|
|
message DecryptedMessage {
|
|
|
|
optional bytes message = 1; // decrypted message
|
|
|
|
optional string address = 2; // address used to sign the message (if used)
|
2014-06-12 14:01:31 +00:00
|
|
|
}
|
|
|
|
|
2014-06-05 19:55:56 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to encrypt or decrypt value of given key
|
2014-11-03 18:43:11 +00:00
|
|
|
* @next CipheredKeyValue
|
2014-06-05 19:55:56 +00:00
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message CipherKeyValue {
|
2014-06-12 14:01:31 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
optional string key = 2; // key component of key:value
|
|
|
|
optional bytes value = 3; // value component of key:value
|
2014-06-05 19:55:56 +00:00
|
|
|
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?
|
2015-06-17 11:56:51 +00:00
|
|
|
optional bytes iv = 7; // initialization vector (will be computed if not set)
|
2014-06-05 19:55:56 +00:00
|
|
|
}
|
|
|
|
|
2014-11-03 18:43:11 +00:00
|
|
|
/**
|
|
|
|
* Response: Return ciphered/deciphered value
|
|
|
|
* @prev CipherKeyValue
|
|
|
|
*/
|
|
|
|
message CipheredKeyValue {
|
|
|
|
optional bytes value = 1; // ciphered/deciphered value
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
//////////////////////////////////
|
|
|
|
// Transaction signing messages //
|
|
|
|
//////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
2017-04-06 12:48:13 +00:00
|
|
|
* Request: Estimated size of the transaction
|
2014-03-25 18:20:36 +00:00
|
|
|
* This behaves exactly like SignTx, which means that it can ask using TxRequest
|
|
|
|
* This call is non-blocking (except possible PassphraseRequest to unlock the seed)
|
|
|
|
* @next TxSize
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2014-01-18 04:13:47 +00:00
|
|
|
message EstimateTxSize {
|
2014-03-25 18:20:36 +00:00
|
|
|
required uint32 outputs_count = 1; // number of transaction outputs
|
|
|
|
required uint32 inputs_count = 2; // number of transaction inputs
|
|
|
|
optional string coin_name = 3 [default='Bitcoin']; // coin to use
|
2014-01-18 04:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Estimated size of the transaction
|
|
|
|
* @prev EstimateTxSize
|
|
|
|
*/
|
2014-01-18 04:13:47 +00:00
|
|
|
message TxSize {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional uint32 tx_size = 1; // estimated size of transaction in bytes
|
2014-01-18 04:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to sign transaction
|
2014-04-09 17:56:47 +00:00
|
|
|
* @next PassphraseRequest
|
2014-03-25 18:20:36 +00:00
|
|
|
* @next PinMatrixRequest
|
|
|
|
* @next TxRequest
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message SignTx {
|
2014-03-25 18:20:36 +00:00
|
|
|
required uint32 outputs_count = 1; // number of transaction outputs
|
|
|
|
required uint32 inputs_count = 2; // number of transaction inputs
|
|
|
|
optional string coin_name = 3 [default='Bitcoin']; // coin to use
|
2016-04-16 02:38:02 +00:00
|
|
|
optional uint32 version = 4 [default=1]; // transaction version
|
|
|
|
optional uint32 lock_time = 5 [default=0]; // transaction lock_time
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Simplified transaction signing
|
|
|
|
* This method doesn't support streaming, so there are hardware limits in number of inputs and outputs.
|
|
|
|
* In case of success, the result is returned using TxRequest message.
|
2014-04-09 17:56:47 +00:00
|
|
|
* @next PassphraseRequest
|
2014-03-25 18:20:36 +00:00
|
|
|
* @next PinMatrixRequest
|
|
|
|
* @next TxRequest
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message SimpleSignTx {
|
2014-03-25 18:20:36 +00:00
|
|
|
repeated TxInputType inputs = 1; // transaction inputs
|
|
|
|
repeated TxOutputType outputs = 2; // transaction outputs
|
|
|
|
repeated TransactionType transactions = 3; // transactions whose outputs are used to build current inputs
|
|
|
|
optional string coin_name = 4 [default='Bitcoin']; // coin to use
|
2016-04-16 02:42:41 +00:00
|
|
|
optional uint32 version = 5 [default=1]; // transaction version
|
|
|
|
optional uint32 lock_time = 6 [default=0]; // transaction lock_time
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device asks for information for signing transaction or returns the last result
|
|
|
|
* If request_index is set, device awaits TxAck message (with fields filled in according to request_type)
|
|
|
|
* If signature_index is set, 'signature' contains signed input of signature_index's input
|
|
|
|
* @prev SignTx
|
|
|
|
* @prev SimpleSignTx
|
|
|
|
* @prev TxAck
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message TxRequest {
|
2014-06-05 19:55:56 +00:00
|
|
|
optional RequestType request_type = 1; // what should be filled in TxAck message?
|
2014-04-10 12:42:50 +00:00
|
|
|
optional TxRequestDetailsType details = 2; // request for tx details
|
|
|
|
optional TxRequestSerializedType serialized = 3; // serialized data and request for next
|
2014-03-25 18:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Reported transaction data
|
|
|
|
* @prev TxRequest
|
|
|
|
* @next TxRequest
|
|
|
|
*/
|
|
|
|
message TxAck {
|
|
|
|
optional TransactionType tx = 1;
|
|
|
|
}
|
|
|
|
|
2016-03-20 13:12:05 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to sign transaction
|
|
|
|
* All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
2016-05-23 18:36:28 +00:00
|
|
|
* Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
2016-03-20 13:12:05 +00:00
|
|
|
* @next PassphraseRequest
|
|
|
|
* @next PinMatrixRequest
|
|
|
|
* @next EthereumTxRequest
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message EthereumSignTx {
|
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
2016-05-23 18:36:28 +00:00
|
|
|
optional bytes nonce = 2; // <=256 bit unsigned big endian
|
|
|
|
optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
|
|
|
optional bytes gas_limit = 4; // <=256 bit unsigned big endian
|
2016-03-20 13:12:05 +00:00
|
|
|
optional bytes to = 5; // 160 bit address hash
|
2016-05-23 18:36:28 +00:00
|
|
|
optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
|
2016-05-23 18:26:15 +00:00
|
|
|
optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
|
|
|
|
optional uint32 data_length = 8; // Length of transaction payload
|
2017-01-22 11:16:49 +00:00
|
|
|
optional uint32 chain_id = 9; // Chain Id for EIP 155
|
2016-03-20 13:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device asks for more data from transaction payload, or returns the signature.
|
|
|
|
* If data_length is set, device awaits that many more bytes of payload.
|
2016-05-23 18:36:28 +00:00
|
|
|
* Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
2016-03-20 13:12:05 +00:00
|
|
|
* @prev EthereumSignTx
|
|
|
|
* @next EthereumTxAck
|
|
|
|
*/
|
|
|
|
message EthereumTxRequest {
|
2016-05-23 18:36:28 +00:00
|
|
|
optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
|
2016-03-20 13:12:05 +00:00
|
|
|
optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
|
2016-05-23 18:36:28 +00:00
|
|
|
optional bytes signature_r = 3; // Computed signature R component (256 bit)
|
|
|
|
optional bytes signature_s = 4; // Computed signature S component (256 bit)
|
2016-03-20 13:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Transaction payload data.
|
|
|
|
* @prev EthereumTxRequest
|
|
|
|
* @next EthereumTxRequest
|
|
|
|
*/
|
|
|
|
message EthereumTxAck {
|
2016-05-23 18:36:28 +00:00
|
|
|
optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
|
2016-03-20 13:12:05 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 15:34:03 +00:00
|
|
|
////////////////////////////////////////
|
|
|
|
// Ethereum: Message signing messages //
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to sign message
|
|
|
|
* @next EthereumMessageSignature
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message EthereumSignMessage {
|
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
required bytes message = 2; // message to be signed
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to verify message
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message EthereumVerifyMessage {
|
|
|
|
optional bytes address = 1; // address to verify
|
|
|
|
optional bytes signature = 2; // signature to verify
|
|
|
|
optional bytes message = 3; // message to verify
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Signed message
|
|
|
|
* @prev EthereumSignMessage
|
|
|
|
*/
|
|
|
|
message EthereumMessageSignature {
|
|
|
|
optional bytes address = 1; // address used to sign the message
|
|
|
|
optional bytes signature = 2; // signature of the message
|
|
|
|
}
|
|
|
|
|
2015-02-20 15:45:59 +00:00
|
|
|
///////////////////////
|
|
|
|
// Identity messages //
|
|
|
|
///////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to sign identity
|
|
|
|
* @next SignedIdentity
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message SignIdentity {
|
|
|
|
optional IdentityType identity = 1; // identity
|
|
|
|
optional bytes challenge_hidden = 2; // non-visible challenge
|
|
|
|
optional string challenge_visual = 3; // challenge shown on display (e.g. date+time)
|
2015-06-23 11:40:58 +00:00
|
|
|
optional string ecdsa_curve_name = 4; // ECDSA curve name to use
|
2015-02-20 15:45:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device provides signed identity
|
|
|
|
* @prev SignIdentity
|
|
|
|
*/
|
|
|
|
message SignedIdentity {
|
|
|
|
optional string address = 1; // identity address
|
|
|
|
optional bytes public_key = 2; // identity public key
|
|
|
|
optional bytes signature = 3; // signature of the identity data
|
|
|
|
}
|
|
|
|
|
2016-06-10 17:46:57 +00:00
|
|
|
///////////////////
|
|
|
|
// ECDH messages //
|
|
|
|
///////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to generate ECDH session key
|
|
|
|
* @next ECDHSessionKey
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message GetECDHSessionKey {
|
|
|
|
optional IdentityType identity = 1; // identity
|
|
|
|
optional bytes peer_public_key = 2; // peer's public key
|
|
|
|
optional string ecdsa_curve_name = 3; // ECDSA curve name to use
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device provides ECDH session key
|
|
|
|
* @prev GetECDHSessionKey
|
|
|
|
*/
|
|
|
|
message ECDHSessionKey {
|
2017-04-06 12:48:13 +00:00
|
|
|
optional bytes session_key = 1; // ECDH session key
|
2016-06-10 17:46:57 +00:00
|
|
|
}
|
|
|
|
|
2016-06-12 21:37:24 +00:00
|
|
|
///////////////////
|
|
|
|
// U2F messages //
|
|
|
|
///////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Set U2F counter
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message SetU2FCounter {
|
|
|
|
optional uint32 u2f_counter = 1; // counter
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/////////////////////////
|
|
|
|
// Bootloader messages //
|
|
|
|
/////////////////////////
|
|
|
|
|
|
|
|
/**
|
2017-04-06 12:50:28 +00:00
|
|
|
* Request: Ask device to erase its firmware (so it can be replaced via FirmwareUpload)
|
2014-03-25 18:20:36 +00:00
|
|
|
* @next Success
|
2017-04-06 12:50:28 +00:00
|
|
|
* @next FirmwareRequest
|
2014-03-25 18:20:36 +00:00
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message FirmwareErase {
|
2017-06-20 09:26:39 +00:00
|
|
|
optional uint32 length = 1; // length of new firmware
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-06 12:50:28 +00:00
|
|
|
/**
|
|
|
|
* Response: Ask for firmware chunk
|
|
|
|
* @next FirmwareUpload
|
|
|
|
*/
|
|
|
|
message FirmwareRequest {
|
|
|
|
optional uint32 offset = 1; // offset of requested firmware chunk
|
|
|
|
optional uint32 length = 2; // length of requested firmware chunk
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Send firmware in binary form to the device
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message FirmwareUpload {
|
2014-03-25 18:20:36 +00:00
|
|
|
required bytes payload = 1; // firmware to be loaded into device
|
2017-04-06 12:50:28 +00:00
|
|
|
optional bytes hash = 2; // hash of the payload
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2017-06-29 15:21:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Perform a device self-test
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message SelfTest {
|
2017-07-10 15:26:55 +00:00
|
|
|
optional bytes payload = 1; // payload to be used in self-test
|
2017-06-29 15:21:26 +00:00
|
|
|
}
|
|
|
|
|
2017-05-29 13:56:29 +00:00
|
|
|
//////////////////
|
|
|
|
// NEM messages //
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device for NEM address corresponding to address_n path
|
|
|
|
* @next PassphraseRequest
|
|
|
|
* @next NEMAddress
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message NEMGetAddress {
|
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
optional uint32 network = 2; // Network ID (0x68 = Mainnet, 0x98 = Testnet, 0x60 = Mijin)
|
|
|
|
optional bool show_display = 3; // Optionally show on display before sending the result
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Contains NEM address derived from device private seed
|
|
|
|
* @prev NEMGetAddress
|
|
|
|
*/
|
|
|
|
message NEMAddress {
|
|
|
|
required string address = 1; // NEM address in Base32 encoding
|
|
|
|
}
|
|
|
|
|
2017-05-30 08:34:21 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device to sign transaction
|
2017-09-02 21:43:46 +00:00
|
|
|
* @next NEMSignedTx
|
2017-05-30 08:34:21 +00:00
|
|
|
* @next Failure
|
|
|
|
*/
|
2017-09-02 21:43:46 +00:00
|
|
|
message NEMSignTx {
|
2017-05-30 08:34:21 +00:00
|
|
|
optional NEMTransactionCommon transaction = 1; // Common part of transaction
|
|
|
|
optional NEMTransactionCommon multisig = 2; // Common part of inner transaction for multisig transactions
|
|
|
|
optional NEMTransfer transfer = 3; // Transfer transaction part
|
|
|
|
optional bool cosigning = 4; // Whether cosigning or initiating the multisig transaction
|
|
|
|
optional NEMProvisionNamespace provision_namespace = 5; // Provision namespace part
|
|
|
|
optional NEMMosaicCreation mosaic_creation = 6; // Mosaic definition creation part
|
|
|
|
optional NEMMosaicSupplyChange supply_change = 7; // Mosaic supply change part
|
|
|
|
optional NEMAggregateModification aggregate_modification = 8; // Aggregate modification part
|
2017-10-07 20:32:36 +00:00
|
|
|
optional NEMImportanceTransfer importance_transfer = 9; // Importance transfer part
|
2017-05-30 08:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Contains NEM transaction data and signature
|
2017-09-02 21:43:46 +00:00
|
|
|
* @prev NEMSignTx
|
2017-05-30 08:34:21 +00:00
|
|
|
*/
|
2017-09-02 21:43:46 +00:00
|
|
|
message NEMSignedTx {
|
2017-05-30 08:34:21 +00:00
|
|
|
optional bytes data = 1; // Transaction data
|
|
|
|
optional bytes signature = 2; // Signature for the transaction
|
|
|
|
}
|
|
|
|
|
2017-10-03 06:53:53 +00:00
|
|
|
///////////////////
|
|
|
|
// CoSi messages //
|
|
|
|
///////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to commit to CoSi signing
|
|
|
|
* @next CosiCommitment
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message CosiCommit {
|
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
optional bytes data = 2; // Data to be signed
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Contains a CoSi commitment
|
|
|
|
* @prev CosiCommit
|
|
|
|
*/
|
|
|
|
message CosiCommitment {
|
|
|
|
optional bytes commitment = 1; // Commitment
|
|
|
|
optional bytes pubkey = 2; // Public key
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to sign using CoSi
|
|
|
|
* @next CosiSignature
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message CosiSign {
|
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
|
|
optional bytes data = 2; // Data to be signed
|
|
|
|
optional bytes global_commitment = 3; // Aggregated commitment
|
|
|
|
optional bytes global_pubkey = 4; // Aggregated public key
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Contains a CoSi signature
|
|
|
|
* @prev CosiSign
|
|
|
|
*/
|
|
|
|
message CosiSignature {
|
|
|
|
optional bytes signature = 1; // Signature
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
// Debug messages (only available if DebugLink is enabled) //
|
|
|
|
/////////////////////////////////////////////////////////////
|
2013-11-22 16:27:47 +00:00
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: "Press" the button on the device
|
|
|
|
* @next Success
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message DebugLinkDecision {
|
2014-03-25 18:20:36 +00:00
|
|
|
required bool yes_no = 1; // true for "Confirm", false for "Cancel"
|
2013-11-22 16:27:47 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Request: Computer asks for device state
|
|
|
|
* @next DebugLinkState
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message DebugLinkGetState {
|
|
|
|
}
|
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Device current state
|
|
|
|
* @prev DebugLinkGetState
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message DebugLinkState {
|
2014-03-25 18:20:36 +00:00
|
|
|
optional bytes layout = 1; // raw buffer of display
|
|
|
|
optional string pin = 2; // current PIN, blank if PIN is not set/enabled
|
|
|
|
optional string matrix = 3; // current PIN matrix
|
|
|
|
optional string mnemonic = 4; // current BIP-39 mnemonic
|
|
|
|
optional HDNodeType node = 5; // current BIP-32 node
|
|
|
|
optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase?
|
|
|
|
optional string reset_word = 7; // word on device display during ResetDevice workflow
|
|
|
|
optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow
|
|
|
|
optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow
|
|
|
|
optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to restart
|
|
|
|
*/
|
2013-11-22 16:27:47 +00:00
|
|
|
message DebugLinkStop {
|
|
|
|
}
|
2014-01-09 13:15:53 +00:00
|
|
|
|
2014-03-25 18:20:36 +00:00
|
|
|
/**
|
|
|
|
* Response: Device wants host to log event
|
|
|
|
*/
|
2014-01-09 13:15:53 +00:00
|
|
|
message DebugLinkLog {
|
|
|
|
optional uint32 level = 1;
|
2014-03-01 10:17:06 +00:00
|
|
|
optional string bucket = 2;
|
|
|
|
optional string text = 3;
|
2014-01-09 13:15:53 +00:00
|
|
|
}
|
2016-05-26 18:07:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Read memory from device
|
|
|
|
* @next DebugLinkMemory
|
|
|
|
*/
|
|
|
|
message DebugLinkMemoryRead {
|
|
|
|
optional uint32 address = 1;
|
|
|
|
optional uint32 length = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device sends memory back
|
|
|
|
* @prev DebugLinkMemoryRead
|
|
|
|
*/
|
|
|
|
message DebugLinkMemory {
|
|
|
|
optional bytes memory = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-06 12:48:13 +00:00
|
|
|
* Request: Write memory to device.
|
|
|
|
* WARNING: Writing to the wrong location can irreparably break the device.
|
2016-05-26 18:07:15 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkMemoryWrite {
|
|
|
|
optional uint32 address = 1;
|
|
|
|
optional bytes memory = 2;
|
|
|
|
optional bool flash = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-06 12:48:13 +00:00
|
|
|
* Request: Erase block of flash on device
|
|
|
|
* WARNING: Writing to the wrong location can irreparably break the device.
|
2016-05-26 18:07:15 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkFlashErase {
|
|
|
|
optional uint32 sector = 1;
|
|
|
|
}
|