|
|
|
@ -68,17 +68,19 @@ static const uint32_t META_MAGIC_V10 = 0xFFFFFFFF;
|
|
|
|
|
#define KEY_LANGUAGE (3 | APP | FLAG_PUBLIC_SHIFTED) // string(17)
|
|
|
|
|
#define KEY_LABEL (4 | APP | FLAG_PUBLIC_SHIFTED) // string(33)
|
|
|
|
|
#define KEY_PASSPHRASE_PROTECTION (5 | APP | FLAG_PUBLIC_SHIFTED) // bool
|
|
|
|
|
#define KEY_HOMESCREEN (6 | APP | FLAG_PUBLIC_SHIFTED) // bytes(1024)
|
|
|
|
|
#define KEY_NEEDS_BACKUP (7 | APP) // bool
|
|
|
|
|
#define KEY_FLAGS (8 | APP) // uint32
|
|
|
|
|
#define KEY_U2F_COUNTER (9 | APP | FLAGS_WRITE_SHIFTED) // uint32
|
|
|
|
|
#define KEY_UNFINISHED_BACKUP (11 | APP) // bool
|
|
|
|
|
#define KEY_AUTO_LOCK_DELAY_MS (12 | APP) // uint32
|
|
|
|
|
#define KEY_NO_BACKUP (13 | APP) // bool
|
|
|
|
|
#define KEY_INITIALIZED (14 | APP | FLAG_PUBLIC_SHIFTED) // uint32
|
|
|
|
|
#define KEY_NODE (15 | APP) // node
|
|
|
|
|
#define KEY_IMPORTED (16 | APP) // bool
|
|
|
|
|
#define KEY_U2F_ROOT (17 | APP | FLAG_PUBLIC_SHIFTED) // node
|
|
|
|
|
#define KEY_HOMESCREEN (6 | APP | FLAG_PUBLIC_SHIFTED) // bytes(1024)
|
|
|
|
|
#define KEY_NEEDS_BACKUP (7 | APP) // bool
|
|
|
|
|
#define KEY_FLAGS (8 | APP) // uint32
|
|
|
|
|
#define KEY_U2F_COUNTER (9 | APP | FLAGS_WRITE_SHIFTED) // uint32
|
|
|
|
|
#define KEY_UNFINISHED_BACKUP (11 | APP) // bool
|
|
|
|
|
#define KEY_AUTO_LOCK_DELAY_MS (12 | APP) // uint32
|
|
|
|
|
#define KEY_NO_BACKUP (13 | APP) // bool
|
|
|
|
|
#define KEY_INITIALIZED (14 | APP | FLAG_PUBLIC_SHIFTED) // uint32
|
|
|
|
|
#define KEY_NODE (15 | APP) // node
|
|
|
|
|
#define KEY_IMPORTED (16 | APP) // bool
|
|
|
|
|
#define KEY_U2F_ROOT (17 | APP | FLAG_PUBLIC_SHIFTED) // node
|
|
|
|
|
#define KEY_PASSPHRASE_ALWAYS_ON_DEVICE \
|
|
|
|
|
(18 | APP | FLAG_PUBLIC_SHIFTED) // bool
|
|
|
|
|
#define KEY_DEBUG_LINK_PIN (255 | APP | FLAG_PUBLIC_SHIFTED) // string(10)
|
|
|
|
|
|
|
|
|
|
#define MAX_SESSIONS_COUNT 10
|
|
|
|
@ -561,6 +563,9 @@ void config_setLanguage(const char *lang) {
|
|
|
|
|
|
|
|
|
|
void config_setPassphraseProtection(bool passphrase_protection) {
|
|
|
|
|
config_set_bool(KEY_PASSPHRASE_PROTECTION, passphrase_protection);
|
|
|
|
|
if (passphrase_protection == false) {
|
|
|
|
|
config_setPassphraseAlwaysOnDevice(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool config_getPassphraseProtection(bool *passphrase_protection) {
|
|
|
|
@ -568,6 +573,17 @@ bool config_getPassphraseProtection(bool *passphrase_protection) {
|
|
|
|
|
config_get_bool(KEY_PASSPHRASE_PROTECTION, passphrase_protection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void config_setPassphraseAlwaysOnDevice(bool passphrase_always_on_device) {
|
|
|
|
|
config_set_bool(KEY_PASSPHRASE_ALWAYS_ON_DEVICE, passphrase_always_on_device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool config_getPassphraseAlwaysOnDevice(void) {
|
|
|
|
|
bool passphrase_always_on_device = false;
|
|
|
|
|
config_get_bool(KEY_PASSPHRASE_ALWAYS_ON_DEVICE,
|
|
|
|
|
&passphrase_always_on_device);
|
|
|
|
|
return passphrase_always_on_device;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void config_setHomescreen(const uint8_t *data, uint32_t size) {
|
|
|
|
|
if (data != NULL && size == HOMESCREEN_SIZE) {
|
|
|
|
|
storage_set(KEY_HOMESCREEN, data, size);
|
|
|
|
@ -601,30 +617,6 @@ const uint8_t *config_getSeed(void) {
|
|
|
|
|
memzero(passphrase, sizeof(passphrase));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
// passphrase is used - confirm on the display
|
|
|
|
|
if (passphrase[0] != 0) {
|
|
|
|
|
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
|
|
|
|
_("Access hidden wallet?"), NULL,
|
|
|
|
|
_("Next screen will show"), _("the passphrase!"), NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
|
|
|
|
|
memzero(mnemonic, sizeof(mnemonic));
|
|
|
|
|
memzero(passphrase, sizeof(passphrase));
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ActionCancelled,
|
|
|
|
|
_("Passphrase dismissed"));
|
|
|
|
|
layoutHome();
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
layoutShowPassphrase(passphrase);
|
|
|
|
|
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
|
|
|
|
|
memzero(mnemonic, sizeof(mnemonic));
|
|
|
|
|
memzero(passphrase, sizeof(passphrase));
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ActionCancelled,
|
|
|
|
|
_("Passphrase dismissed"));
|
|
|
|
|
layoutHome();
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if storage was not imported (i.e. it was properly generated or recovered)
|
|
|
|
|
bool imported = false;
|
|
|
|
|
config_get_bool(KEY_IMPORTED, &imported);
|
|
|
|
|