From bbfefb677c5fc267edd55013631581d6d74aca2e Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 26 Nov 2013 16:10:55 +0100 Subject: [PATCH] rework storage, session, features --- protob/.gitignore | 1 + protob/Makefile | 7 +++++++ protob/messages.proto | 12 +++++++----- protob/storage.proto | 14 +++++++++----- protob/types.proto | 6 ------ 5 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 protob/.gitignore create mode 100644 protob/Makefile diff --git a/protob/.gitignore b/protob/.gitignore new file mode 100644 index 0000000000..0a5bea8f2b --- /dev/null +++ b/protob/.gitignore @@ -0,0 +1 @@ +*.pb diff --git a/protob/Makefile b/protob/Makefile new file mode 100644 index 0000000000..a0d53c0c6b --- /dev/null +++ b/protob/Makefile @@ -0,0 +1,7 @@ +all: messages.pb storage.pb types.pb + +%.pb: %.proto + protoc -I/usr/include -I. $< -o $@ + +clean: + rm -f *.pb diff --git a/protob/messages.proto b/protob/messages.proto index b55707847a..a90300ad54 100644 --- a/protob/messages.proto +++ b/protob/messages.proto @@ -72,17 +72,19 @@ message Features { optional uint32 minor_version = 3; // Minor version of the device, e.g. 0 optional uint32 bugfix_version = 4; optional bool bootloader_mode = 5; - optional SettingsType settings = 6; // User-level settings of the device - optional bytes device_id = 7 [(binary) = true]; // Device's unique identifier - optional bool pin_protection = 8; // True if Trezor is covered by PIN - optional bool passphrase_protection = 9; // True if Trezor seed is covered by passphrase + optional bytes device_id = 6 [(binary) = true]; // Device's unique identifier + optional bool pin_protection = 7; // True if Trezor is covered by PIN + optional bool passphrase_protection = 8; // True if Trezor seed is covered by passphrase + optional bytes language = 9; + optional bytes label = 10 [(binary) = true]; + repeated CoinType coins = 11; } // Overwrites only filled fields of the structure message ApplySettings { optional bytes language = 1; optional bytes coin_shortcut = 2; - optional bytes label = 3; + optional bytes label = 3 [(binary) = true]; } // Starts workflow for setting/changing the PIN diff --git a/protob/storage.proto b/protob/storage.proto index ea5c511336..f23cb9561e 100644 --- a/protob/storage.proto +++ b/protob/storage.proto @@ -10,13 +10,17 @@ import "types.proto"; message Storage { required uint32 version = 1; - optional HDNodeType seed = 2; - optional bool seed_encrypted = 3; - optional uint32 pin_failed_attempts = 4; - optional bytes pin = 5; - optional SettingsType settings = 6; + optional bytes node_serialized = 2 [(binary) = true]; + optional bytes mnemonic = 3 [(binary) = true]; + optional bool encrypted = 4; // whether node_serialized or mnemonic are encrypted (protected by passphrase) + optional uint32 pin_failed_attempts = 5; + optional bytes pin = 6; + optional bytes language = 7; + optional bytes label = 8 [(binary) = true]; } message Session { optional bytes passphrase = 1 [(binary) = true]; + optional CoinType coin = 2; + optional HDNodeType node = 3; } diff --git a/protob/types.proto b/protob/types.proto index 259437b749..0f869ccd66 100644 --- a/protob/types.proto +++ b/protob/types.proto @@ -63,12 +63,6 @@ message CoinType { optional uint64 maxfee_kb = 4; } -message SettingsType { - optional bytes language = 1; // Trezor uses 'english' as default - optional CoinType coin = 2; - optional bytes label = 3; // Human readable wallet name -} - message TxInputType { // required uint32 index = 1; // Position of input in proposed transaction // required uint64 amount = 3; // Amount to spend in satoshis. The rest will be used for transaction fees