| 1 |
syntax = "proto2"; |
| 2 |
package hw.trezor.messages.management; |
| 3 |
|
| 4 |
// Sugar for easier handling in Java |
| 5 |
option java_package = "com.satoshilabs.trezor.lib.protobuf"; |
| 6 |
option java_outer_classname = "TrezorMessageManagement"; |
| 7 |
|
| 8 |
/** |
| 9 |
* Type of the mnemonic backup given/received by the device during reset/recovery. |
| 10 |
*/ |
| 11 |
enum BackupType { |
| 12 |
Bip39 = 0; // also called "Single Backup", see BIP-0039 |
| 13 |
Slip39_Basic = 1; // also called "Shamir Backup", see SLIP-0039 |
| 14 |
Slip39_Advanced = 2; // also called "Super Shamir" or "Shamir with Groups", see SLIP-0039#two-level-scheme |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Request: Reset device to default state and ask for device details |
| 19 |
* @start |
| 20 |
* @next Features |
| 21 |
*/ |
| 22 |
message Initialize { |
| 23 |
optional bytes session_id = 1; // assumed device session id; Trezor clears caches if it is different or empty |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Request: Ask for device details (no device reset) |
| 28 |
* @start |
| 29 |
* @next Features |
| 30 |
*/ |
| 31 |
message GetFeatures { |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Response: Reports various information about the device |
| 36 |
* @end |
| 37 |
*/ |
| 38 |
message Features { |
| 39 |
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io" |
| 40 |
optional uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1 |
| 41 |
optional uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0 |
| 42 |
optional uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0 |
| 43 |
optional bool bootloader_mode = 5; // is device in bootloader mode? |
| 44 |
optional string device_id = 6; // device's unique identifier |
| 45 |
optional bool pin_protection = 7; // is device protected by PIN? |
| 46 |
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase? |
| 47 |
optional string language = 9; // device language |
| 48 |
optional string label = 10; // device description label |
| 49 |
optional bool initialized = 12; // does device contain seed? |
| 50 |
optional bytes revision = 13; // SCM revision of firmware |
| 51 |
optional bytes bootloader_hash = 14; // hash of the bootloader |
| 52 |
optional bool imported = 15; // was storage imported from an external source? |
| 53 |
optional bool pin_cached = 16; // is PIN already cached in session? |
| 54 |
// optional bool passphrase_cached = 17; // is passphrase already cached in session? DEPRECATED |
| 55 |
optional bool firmware_present = 18; // is valid firmware loaded? |
| 56 |
optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup) |
| 57 |
optional uint32 flags = 20; // device flags (equals to Storage.flags) |
| 58 |
optional string model = 21; // device hardware model |
| 59 |
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode |
| 60 |
optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode |
| 61 |
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode |
| 62 |
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode |
| 63 |
optional bytes fw_vendor_keys = 26; // reported firmware vendor keys (their hash) |
| 64 |
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup) |
| 65 |
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup) |
| 66 |
optional bool recovery_mode = 29; // is recovery mode in progress |
| 67 |
repeated Capability capabilities = 30; // list of supported capabilities |
| 68 |
enum Capability { |
| 69 |
Capability_Bitcoin = 1; |
| 70 |
Capability_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code |
| 71 |
Capability_Binance = 3; |
| 72 |
Capability_Cardano = 4; |
| 73 |
Capability_Crypto = 5; // generic crypto operations for GPG, SSH, etc. |
| 74 |
Capability_EOS = 6; |
| 75 |
Capability_Ethereum = 7; |
| 76 |
Capability_Lisk = 8; |
| 77 |
Capability_Monero = 9; |
| 78 |
Capability_NEM = 10; |
| 79 |
Capability_Ripple = 11; |
| 80 |
Capability_Stellar = 12; |
| 81 |
Capability_Tezos = 13; |
| 82 |
Capability_U2F = 14; |
| 83 |
Capability_Shamir = 15; |
| 84 |
Capability_ShamirGroups = 16; |
| 85 |
Capability_PassphraseEntry = 17; // the device is capable of passphrase entry directly on the device |
| 86 |
} |
| 87 |
optional BackupType backup_type = 31; // type of device backup (BIP-39 / SLIP-39 basic / SLIP-39 advanced) |
| 88 |
optional bool sd_card_present = 32; // is SD card present |
| 89 |
optional bool sd_protection = 33; // is SD Protect enabled |
| 90 |
optional bool wipe_code_protection = 34; // is wipe code protection enabled |
| 91 |
optional bytes session_id = 35; |
| 92 |
optional bool passphrase_always_on_device = 36; // device enforces passphrase entry on Trezor |
| 93 |
} |
| 94 |
|
| 95 |
/** |
| 96 |
* Request: clear session (removes cached PIN, passphrase, etc). |
| 97 |
* @start |
| 98 |
* @next Success |
| 99 |
*/ |
| 100 |
message ClearSession { |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Request: change language and/or label of the device |
| 105 |
* @start |
| 106 |
* @next Success |
| 107 |
* @next Failure |
| 108 |
*/ |
| 109 |
message ApplySettings { |
| 110 |
optional string language = 1; |
| 111 |
optional string label = 2; |
| 112 |
optional bool use_passphrase = 3; |
| 113 |
optional bytes homescreen = 4; |
| 114 |
// optional PassphraseSourceType passphrase_source = 5; DEPRECATED |
| 115 |
optional uint32 auto_lock_delay_ms = 6; |
| 116 |
optional uint32 display_rotation = 7; // in degrees from North |
| 117 |
optional bool passphrase_always_on_device = 8; // do not prompt for passphrase, enforce device entry |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* Request: set flags of the device |
| 122 |
* @start |
| 123 |
* @next Success |
| 124 |
* @next Failure |
| 125 |
*/ |
| 126 |
message ApplyFlags { |
| 127 |
optional uint32 flags = 1; // bitmask, can only set bits, not unset |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* Request: Starts workflow for setting/changing/removing the PIN |
| 132 |
* @start |
| 133 |
* @next Success |
| 134 |
* @next Failure |
| 135 |
*/ |
| 136 |
message ChangePin { |
| 137 |
optional bool remove = 1; // is PIN removal requested? |
| 138 |
} |
| 139 |
|
| 140 |
/** |
| 141 |
* Request: Starts workflow for setting/removing the wipe code |
| 142 |
* @start |
| 143 |
* @next Success |
| 144 |
* @next Failure |
| 145 |
*/ |
| 146 |
message ChangeWipeCode { |
| 147 |
optional bool remove = 1; // is wipe code removal requested? |
| 148 |
} |
| 149 |
|
| 150 |
/** |
| 151 |
* Request: Starts workflow for enabling/regenerating/disabling SD card protection |
| 152 |
* @start |
| 153 |
* @next Success |
| 154 |
* @next Failure |
| 155 |
*/ |
| 156 |
message SdProtect { |
| 157 |
optional SdProtectOperationType operation = 1; |
| 158 |
/** |
| 159 |
* Structure representing SD card protection operation |
| 160 |
*/ |
| 161 |
enum SdProtectOperationType { |
| 162 |
DISABLE = 0; |
| 163 |
ENABLE = 1; |
| 164 |
REFRESH = 2; |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
/** |
| 169 |
* Request: Test if the device is alive, device sends back the message in Success response |
| 170 |
* @start |
| 171 |
* @next Success |
| 172 |
*/ |
| 173 |
message Ping { |
| 174 |
optional string message = 1; // message to send back in Success message |
| 175 |
optional bool button_protection = 2; // ask for button press |
| 176 |
} |
| 177 |
|
| 178 |
/** |
| 179 |
* Request: Abort last operation that required user interaction |
| 180 |
* @start |
| 181 |
* @next Failure |
| 182 |
*/ |
| 183 |
message Cancel { |
| 184 |
} |
| 185 |
|
| 186 |
/** |
| 187 |
* Request: Request a sample of random data generated by hardware RNG. May be used for testing. |
| 188 |
* @start |
| 189 |
* @next Entropy |
| 190 |
* @next Failure |
| 191 |
*/ |
| 192 |
message GetEntropy { |
| 193 |
required uint32 size = 1; // size of requested entropy |
| 194 |
} |
| 195 |
|
| 196 |
/** |
| 197 |
* Response: Reply with random data generated by internal RNG |
| 198 |
* @end |
| 199 |
*/ |
| 200 |
message Entropy { |
| 201 |
required bytes entropy = 1; // chunk of random generated bytes |
| 202 |
} |
| 203 |
|
| 204 |
/** |
| 205 |
* Request: Request device to wipe all sensitive data and settings |
| 206 |
* @start |
| 207 |
* @next Success |
| 208 |
* @next Failure |
| 209 |
*/ |
| 210 |
message WipeDevice { |
| 211 |
} |
| 212 |
|
| 213 |
/** |
| 214 |
* Request: Load seed and related internal settings from the computer |
| 215 |
* @start |
| 216 |
* @next Success |
| 217 |
* @next Failure |
| 218 |
*/ |
| 219 |
message LoadDevice { |
| 220 |
repeated string mnemonics = 1; // seed encoded as mnemonic (12, 18 or 24 words for BIP39, 20 or 33 for SLIP39) |
| 221 |
optional string pin = 3; // set PIN protection |
| 222 |
optional bool passphrase_protection = 4; // enable master node encryption using passphrase |
| 223 |
optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag) |
| 224 |
optional string label = 6; // device label |
| 225 |
optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum |
| 226 |
optional uint32 u2f_counter = 8; // U2F counter |
| 227 |
optional bool needs_backup = 9; // set "needs backup" flag |
| 228 |
optional bool no_backup = 10; // indicate that no backup is going to be made |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* Request: Ask device to do initialization involving user interaction |
| 233 |
* @start |
| 234 |
* @next EntropyRequest |
| 235 |
* @next Failure |
| 236 |
*/ |
| 237 |
message ResetDevice { |
| 238 |
optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy |
| 239 |
optional uint32 strength = 2 [default=256]; // strength of seed in bits |
| 240 |
optional bool passphrase_protection = 3; // enable master node encryption using passphrase |
| 241 |
optional bool pin_protection = 4; // enable PIN protection |
| 242 |
optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag) |
| 243 |
optional string label = 6; // device label |
| 244 |
optional uint32 u2f_counter = 7; // U2F counter |
| 245 |
optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow |
| 246 |
optional bool no_backup = 9; // indicate that no backup is going to be made |
| 247 |
optional BackupType backup_type = 10 [default=Bip39]; // type of the mnemonic backup |
| 248 |
} |
| 249 |
|
| 250 |
/** |
| 251 |
* Request: Perform backup of the device seed if not backed up using ResetDevice |
| 252 |
* @start |
| 253 |
* @next Success |
| 254 |
*/ |
| 255 |
message BackupDevice { |
| 256 |
} |
| 257 |
|
| 258 |
/** |
| 259 |
* Response: Ask for additional entropy from host computer |
| 260 |
* @next EntropyAck |
| 261 |
*/ |
| 262 |
message EntropyRequest { |
| 263 |
} |
| 264 |
|
| 265 |
/** |
| 266 |
* Request: Provide additional entropy for seed generation function |
| 267 |
* @next Success |
| 268 |
*/ |
| 269 |
message EntropyAck { |
| 270 |
optional bytes entropy = 1; // 256 bits (32 bytes) of random data |
| 271 |
} |
| 272 |
|
| 273 |
/** |
| 274 |
* Request: Start recovery workflow asking user for specific words of mnemonic |
| 275 |
* Used to recovery device safely even on untrusted computer. |
| 276 |
* @start |
| 277 |
* @next WordRequest |
| 278 |
*/ |
| 279 |
message RecoveryDevice { |
| 280 |
optional uint32 word_count = 1; // number of words in BIP-39 mnemonic |
| 281 |
optional bool passphrase_protection = 2; // enable master node encryption using passphrase |
| 282 |
optional bool pin_protection = 3; // enable PIN protection |
| 283 |
optional string language = 4 [default='en-US']; // device language (IETF BCP 47 language tag) |
| 284 |
optional string label = 5; // device label |
| 285 |
optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process |
| 286 |
// 7 reserved for unused recovery method |
| 287 |
optional RecoveryDeviceType type = 8; // supported recovery type |
| 288 |
optional uint32 u2f_counter = 9; // U2F counter |
| 289 |
optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation) |
| 290 |
/** |
| 291 |
* Type of recovery procedure. These should be used as bitmask, e.g., |
| 292 |
* `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix` |
| 293 |
* listing every method supported by the host computer. |
| 294 |
* |
| 295 |
* Note that ScrambledWords must be supported by every implementation |
| 296 |
* for backward compatibility; there is no way to not support it. |
| 297 |
*/ |
| 298 |
enum RecoveryDeviceType { |
| 299 |
// use powers of two when extending this field |
| 300 |
RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order |
| 301 |
RecoveryDeviceType_Matrix = 1; // matrix recovery type |
| 302 |
} |
| 303 |
} |
| 304 |
|
| 305 |
/** |
| 306 |
* Response: Device is waiting for user to enter word of the mnemonic |
| 307 |
* Its position is shown only on device's internal display. |
| 308 |
* @next WordAck |
| 309 |
*/ |
| 310 |
message WordRequest { |
| 311 |
optional WordRequestType type = 1; |
| 312 |
/** |
| 313 |
* Type of Recovery Word request |
| 314 |
*/ |
| 315 |
enum WordRequestType { |
| 316 |
WordRequestType_Plain = 0; |
| 317 |
WordRequestType_Matrix9 = 1; |
| 318 |
WordRequestType_Matrix6 = 2; |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
/** |
| 323 |
* Request: Computer replies with word from the mnemonic |
| 324 |
* @next WordRequest |
| 325 |
* @next Success |
| 326 |
* @next Failure |
| 327 |
*/ |
| 328 |
message WordAck { |
| 329 |
required string word = 1; // one word of mnemonic on asked position |
| 330 |
} |
| 331 |
|
| 332 |
/** |
| 333 |
* Request: Set U2F counter |
| 334 |
* @start |
| 335 |
* @next Success |
| 336 |
*/ |
| 337 |
message SetU2FCounter { |
| 338 |
optional uint32 u2f_counter = 1; |
| 339 |
} |
| 340 |
|
| 341 |
/** |
| 342 |
* Request: Set U2F counter |
| 343 |
* @start |
| 344 |
* @next NextU2FCounter |
| 345 |
*/ |
| 346 |
message GetNextU2FCounter { |
| 347 |
} |
| 348 |
|
| 349 |
/** |
| 350 |
* Request: Set U2F counter |
| 351 |
* @end |
| 352 |
*/ |
| 353 |
message NextU2FCounter { |
| 354 |
optional uint32 u2f_counter = 1; |
| 355 |
} |