From 61af3d5e931ab41f0b81f462fbdc626d6bbec4f4 Mon Sep 17 00:00:00 2001 From: Jochen Hoenicke Date: Wed, 29 Jun 2016 22:34:55 +0200 Subject: [PATCH] Matrix Recovery This adds a new type in the message RecoveryDevice, which can be used by the host to signal which recovery procedures it supports. It is a bitfield containing a bit for every supported procedure. --- protob/messages.proto | 5 ++++- protob/types.proto | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/protob/messages.proto b/protob/messages.proto index 3afdc94f88..2e107e0337 100644 --- a/protob/messages.proto +++ b/protob/messages.proto @@ -390,7 +390,9 @@ message RecoveryDevice { 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 - optional uint32 u2f_counter = 7; // U2F counter + // 7 reserved for unused recovery method + optional uint32 type = 8; // supported recovery type (see RecoveryType) + optional uint32 u2f_counter = 9; // U2F counter } /** @@ -400,6 +402,7 @@ message RecoveryDevice { * @prev WordAck */ message WordRequest { + optional WordRequestType type = 1; } /** diff --git a/protob/types.proto b/protob/types.proto index 43b89886c6..2bb8cf0cf7 100644 --- a/protob/types.proto +++ b/protob/types.proto @@ -105,6 +105,32 @@ enum PinMatrixRequestType { PinMatrixRequestType_NewSecond = 3; } +/** + * Type of recovery procedure. These should be used as bitmask, e.g., + * `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix` + * listing every method supported by the host computer. + * + * Note that ScrambledWords must be supported by every implementation + * for backward compatibility; there is no way to not support it. + * + * @used_in RecoveryDevice + */ +enum RecoveryDeviceType { + // use powers of two when extending this field + RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order + RecoveryDeviceType_Matrix = 1; // matrix recovery type +} + +/** + * Type of Recovery Word request + * @used_in WordRequest + */ +enum WordRequestType { + WordRequestType_Plain = 0; + WordRequestType_Matrix9 = 1; + WordRequestType_Matrix6 = 2; +} + /** * Structure representing BIP32 (hierarchical deterministic) node * Used for imports of private key into the device and exporting public key out of device