github.com/ethereum/go-ethereum@v1.16.1/accounts/usbwallet/trezor/messages-management.proto (about) 1 // This file originates from the SatoshiLabs Trezor `common` repository at: 2 // https://github.com/trezor/trezor-common/blob/master/protob/messages-management.proto 3 // dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9. 4 5 syntax = "proto2"; 6 package hw.trezor.messages.management; 7 8 option go_package = "github.com/ethereum/go-ethereum/accounts/usbwallet/trezor"; 9 10 // Sugar for easier handling in Java 11 option java_package = "com.satoshilabs.trezor.lib.protobuf"; 12 option java_outer_classname = "TrezorMessageManagement"; 13 14 import "messages-common.proto"; 15 16 /** 17 * Request: Reset device to default state and ask for device details 18 * @start 19 * @next Features 20 */ 21 message Initialize { 22 optional bytes state = 1; // assumed device state, clear session if set and different 23 optional bool skip_passphrase = 2; // this session should always assume empty passphrase 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? 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 } 67 68 /** 69 * Request: clear session (removes cached PIN, passphrase, etc). 70 * @start 71 * @next Success 72 */ 73 message ClearSession { 74 } 75 76 /** 77 * Request: change language and/or label of the device 78 * @start 79 * @next Success 80 * @next Failure 81 */ 82 message ApplySettings { 83 optional string language = 1; 84 optional string label = 2; 85 optional bool use_passphrase = 3; 86 optional bytes homescreen = 4; 87 optional PassphraseSourceType passphrase_source = 5; 88 optional uint32 auto_lock_delay_ms = 6; 89 optional uint32 display_rotation = 7; // in degrees from North 90 /** 91 * Structure representing passphrase source 92 */ 93 enum PassphraseSourceType { 94 ASK = 0; 95 DEVICE = 1; 96 HOST = 2; 97 } 98 } 99 100 /** 101 * Request: set flags of the device 102 * @start 103 * @next Success 104 * @next Failure 105 */ 106 message ApplyFlags { 107 optional uint32 flags = 1; // bitmask, can only set bits, not unset 108 } 109 110 /** 111 * Request: Starts workflow for setting/changing/removing the PIN 112 * @start 113 * @next Success 114 * @next Failure 115 */ 116 message ChangePin { 117 optional bool remove = 1; // is PIN removal requested? 118 } 119 120 /** 121 * Request: Test if the device is alive, device sends back the message in Success response 122 * @start 123 * @next Success 124 */ 125 message Ping { 126 optional string message = 1; // message to send back in Success message 127 optional bool button_protection = 2; // ask for button press 128 optional bool pin_protection = 3; // ask for PIN if set in device 129 optional bool passphrase_protection = 4; // ask for passphrase if set in device 130 } 131 132 /** 133 * Request: Abort last operation that required user interaction 134 * @start 135 * @next Failure 136 */ 137 message Cancel { 138 } 139 140 /** 141 * Request: Request a sample of random data generated by hardware RNG. May be used for testing. 142 * @start 143 * @next Entropy 144 * @next Failure 145 */ 146 message GetEntropy { 147 required uint32 size = 1; // size of requested entropy 148 } 149 150 /** 151 * Response: Reply with random data generated by internal RNG 152 * @end 153 */ 154 message Entropy { 155 required bytes entropy = 1; // chunk of random generated bytes 156 } 157 158 /** 159 * Request: Request device to wipe all sensitive data and settings 160 * @start 161 * @next Success 162 * @next Failure 163 */ 164 message WipeDevice { 165 } 166 167 /** 168 * Request: Load seed and related internal settings from the computer 169 * @start 170 * @next Success 171 * @next Failure 172 */ 173 message LoadDevice { 174 optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words) 175 optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 node 176 optional string pin = 3; // set PIN protection 177 optional bool passphrase_protection = 4; // enable master node encryption using passphrase 178 optional string language = 5 [default='english']; // device language 179 optional string label = 6; // device label 180 optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum 181 optional uint32 u2f_counter = 8; // U2F counter 182 } 183 184 /** 185 * Request: Ask device to do initialization involving user interaction 186 * @start 187 * @next EntropyRequest 188 * @next Failure 189 */ 190 message ResetDevice { 191 optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy 192 optional uint32 strength = 2 [default=256]; // strength of seed in bits 193 optional bool passphrase_protection = 3; // enable master node encryption using passphrase 194 optional bool pin_protection = 4; // enable PIN protection 195 optional string language = 5 [default='english']; // device language 196 optional string label = 6; // device label 197 optional uint32 u2f_counter = 7; // U2F counter 198 optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow 199 optional bool no_backup = 9; // indicate that no backup is going to be made 200 } 201 202 /** 203 * Request: Perform backup of the device seed if not backed up using ResetDevice 204 * @start 205 * @next Success 206 */ 207 message BackupDevice { 208 } 209 210 /** 211 * Response: Ask for additional entropy from host computer 212 * @next EntropyAck 213 */ 214 message EntropyRequest { 215 } 216 217 /** 218 * Request: Provide additional entropy for seed generation function 219 * @next Success 220 */ 221 message EntropyAck { 222 optional bytes entropy = 1; // 256 bits (32 bytes) of random data 223 } 224 225 /** 226 * Request: Start recovery workflow asking user for specific words of mnemonic 227 * Used to recovery device safely even on untrusted computer. 228 * @start 229 * @next WordRequest 230 */ 231 message RecoveryDevice { 232 optional uint32 word_count = 1; // number of words in BIP-39 mnemonic 233 optional bool passphrase_protection = 2; // enable master node encryption using passphrase 234 optional bool pin_protection = 3; // enable PIN protection 235 optional string language = 4 [default='english']; // device language 236 optional string label = 5; // device label 237 optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process 238 // 7 reserved for unused recovery method 239 optional RecoveryDeviceType type = 8; // supported recovery type 240 optional uint32 u2f_counter = 9; // U2F counter 241 optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation) 242 /** 243 * Type of recovery procedure. These should be used as bitmask, e.g., 244 * `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix` 245 * listing every method supported by the host computer. 246 * 247 * Note that ScrambledWords must be supported by every implementation 248 * for backward compatibility; there is no way to not support it. 249 */ 250 enum RecoveryDeviceType { 251 // use powers of two when extending this field 252 RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order 253 RecoveryDeviceType_Matrix = 1; // matrix recovery type 254 } 255 } 256 257 /** 258 * Response: Device is waiting for user to enter word of the mnemonic 259 * Its position is shown only on device's internal display. 260 * @next WordAck 261 */ 262 message WordRequest { 263 optional WordRequestType type = 1; 264 /** 265 * Type of Recovery Word request 266 */ 267 enum WordRequestType { 268 WordRequestType_Plain = 0; 269 WordRequestType_Matrix9 = 1; 270 WordRequestType_Matrix6 = 2; 271 } 272 } 273 274 /** 275 * Request: Computer replies with word from the mnemonic 276 * @next WordRequest 277 * @next Success 278 * @next Failure 279 */ 280 message WordAck { 281 required string word = 1; // one word of mnemonic on asked position 282 } 283 284 /** 285 * Request: Set U2F counter 286 * @start 287 * @next Success 288 */ 289 message SetU2FCounter { 290 optional uint32 u2f_counter = 1; // counter 291 }