2019-12-20 14:21:23 +00:00
|
|
|
syntax = "proto2";
|
|
|
|
|
2017-06-19 21:59:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mapping between Trezor wire identifier (uint) and a protobuf message
|
|
|
|
*/
|
|
|
|
enum MessageType {
|
2020-07-20 13:31:21 +00:00
|
|
|
MessageType_Initialize = 0;
|
|
|
|
MessageType_Ping = 1;
|
|
|
|
MessageType_Success = 2;
|
|
|
|
MessageType_Failure = 3;
|
2023-07-20 11:20:50 +00:00
|
|
|
MessageType_WipeDevice = 5;
|
2020-07-20 13:31:21 +00:00
|
|
|
MessageType_FirmwareErase = 6;
|
|
|
|
MessageType_FirmwareUpload = 7;
|
|
|
|
MessageType_FirmwareRequest = 8;
|
|
|
|
MessageType_Features = 17;
|
|
|
|
MessageType_ButtonRequest = 26;
|
|
|
|
MessageType_ButtonAck = 27;
|
|
|
|
MessageType_GetFeatures = 55;
|
2023-07-20 11:20:50 +00:00
|
|
|
MessageType_UnlockBootloader = 96;
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Reset device to default state and ask for device details
|
2020-07-20 13:31:21 +00:00
|
|
|
* @start
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next Features
|
|
|
|
*/
|
|
|
|
message Initialize {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask for device details (no device reset)
|
2020-07-20 13:31:21 +00:00
|
|
|
* @start
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next Features
|
|
|
|
*/
|
|
|
|
message GetFeatures {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Reports various information about the device
|
2020-07-20 13:31:21 +00:00
|
|
|
* @end
|
2017-06-19 21:59:13 +00:00
|
|
|
*/
|
|
|
|
message Features {
|
2020-07-20 13:31:21 +00:00
|
|
|
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
|
2021-02-09 15:10:23 +00:00
|
|
|
required uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
|
|
|
|
required uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
|
|
|
|
required uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
|
2020-07-20 13:31:21 +00:00
|
|
|
optional bool bootloader_mode = 5; // is device in bootloader mode?
|
|
|
|
optional string device_id = 6; // device's unique identifier
|
|
|
|
optional string language = 9; // device language
|
|
|
|
optional string label = 10; // device description label
|
|
|
|
optional bool initialized = 12; // does device contain seed?
|
|
|
|
optional bytes revision = 13; // SCM revision of firmware
|
|
|
|
optional bool firmware_present = 18; // is valid firmware loaded?
|
|
|
|
optional string model = 21; // device hardware model
|
|
|
|
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
|
|
|
|
optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode
|
|
|
|
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
|
|
|
|
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
|
2021-12-28 10:30:36 +00:00
|
|
|
// optional bytes fw_vendor_keys = 26; // obsoleted, use fw_vendor
|
2023-06-01 12:21:51 +00:00
|
|
|
optional string internal_model = 44; // internal model name
|
2023-04-14 15:18:03 +00:00
|
|
|
optional uint32 unit_color = 45; // color of the unit/device
|
|
|
|
optional bool unit_btconly = 46; // unit/device is intended as bitcoin only
|
2023-09-13 13:36:06 +00:00
|
|
|
optional bool bootloader_locked = 49; // bootloader is locked
|
2024-04-11 14:35:50 +00:00
|
|
|
optional uint32 unit_packaging = 51; // unit/device packaging version
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Test if the device is alive, device sends back the message in Success response
|
2020-07-20 13:31:21 +00:00
|
|
|
* @start
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message Ping {
|
2021-02-09 15:10:23 +00:00
|
|
|
optional string message = 1 [default=""]; // message to send back in Success message
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Success of the previous request
|
2020-07-20 13:31:21 +00:00
|
|
|
* @end
|
2017-06-19 21:59:13 +00:00
|
|
|
*/
|
|
|
|
message Success {
|
2021-02-09 15:10:23 +00:00
|
|
|
optional string message = 1 [default=""]; // human readable description of action or request-specific payload
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Failure of the previous request
|
2020-07-20 13:31:21 +00:00
|
|
|
* @end
|
2017-06-19 21:59:13 +00:00
|
|
|
*/
|
|
|
|
message Failure {
|
2020-07-20 13:31:21 +00:00
|
|
|
optional FailureType code = 1; // computer-readable definition of the error state
|
|
|
|
optional string message = 2; // human-readable message of the error state
|
|
|
|
enum FailureType {
|
|
|
|
Failure_UnexpectedMessage = 1;
|
|
|
|
Failure_DataError = 3;
|
|
|
|
Failure_ActionCancelled = 4;
|
|
|
|
Failure_ProcessError = 9;
|
|
|
|
}
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device is waiting for HW button press.
|
2020-07-20 13:31:21 +00:00
|
|
|
* @auxstart
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next ButtonAck
|
|
|
|
*/
|
|
|
|
message ButtonRequest {
|
2020-07-20 13:31:21 +00:00
|
|
|
optional ButtonRequestType code = 1;
|
|
|
|
/**
|
|
|
|
* Type of button request
|
|
|
|
*/
|
|
|
|
enum ButtonRequestType {
|
|
|
|
ButtonRequest_Other = 1;
|
|
|
|
}
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Computer agrees to wait for HW button press
|
2020-07-20 13:31:21 +00:00
|
|
|
* @auxend
|
2017-06-19 21:59:13 +00:00
|
|
|
*/
|
|
|
|
message ButtonAck {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to erase its firmware (so it can be replaced via FirmwareUpload)
|
2020-07-20 13:31:21 +00:00
|
|
|
* @start
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next FirmwareRequest
|
|
|
|
*/
|
|
|
|
message FirmwareErase {
|
2020-07-20 13:31:21 +00:00
|
|
|
optional uint32 length = 1; // length of new firmware
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Ask for firmware chunk
|
|
|
|
* @next FirmwareUpload
|
|
|
|
*/
|
|
|
|
message FirmwareRequest {
|
2023-03-31 12:34:20 +00:00
|
|
|
required uint32 offset = 1; // offset of requested firmware chunk
|
|
|
|
required uint32 length = 2; // length of requested firmware chunk
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Send firmware in binary form to the device
|
2020-07-20 13:31:21 +00:00
|
|
|
* @next FirmwareRequest
|
2017-06-19 21:59:13 +00:00
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2021-02-09 15:10:23 +00:00
|
|
|
message FirmwareUpload {
|
2020-07-20 13:31:21 +00:00
|
|
|
required bytes payload = 1; // firmware to be loaded into device
|
|
|
|
optional bytes hash = 2; // hash of the payload
|
2017-06-19 21:59:13 +00:00
|
|
|
}
|
2023-07-20 11:20:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Unlock bootloader, !irreversible!
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message UnlockBootloader {
|
|
|
|
}
|