diff --git a/applications/main/u2f/u2f_app.c b/applications/main/u2f/u2f_app.c index 216481976..60500152a 100644 --- a/applications/main/u2f/u2f_app.c +++ b/applications/main/u2f/u2f_app.c @@ -2,6 +2,7 @@ #include "u2f_data.h" #include #include +#include static bool u2f_app_custom_event_callback(void* context, uint32_t event) { furi_assert(context); @@ -27,6 +28,11 @@ U2fApp* u2f_app_alloc() { app->gui = furi_record_open(RECORD_GUI); app->notifications = furi_record_open(RECORD_NOTIFICATION); + Storage* storage = furi_record_open(RECORD_STORAGE); + storage_common_copy(storage, U2F_CNT_OLD_FILE, U2F_CNT_FILE); + storage_common_copy(storage, U2F_KEY_OLD_FILE, U2F_KEY_FILE); + furi_record_close(RECORD_STORAGE); + app->view_dispatcher = view_dispatcher_alloc(); app->scene_manager = scene_manager_alloc(&u2f_scene_handlers, app); view_dispatcher_enable_queue(app->view_dispatcher); diff --git a/applications/main/u2f/u2f_data.c b/applications/main/u2f/u2f_data.c index 217733c94..34f037aed 100644 --- a/applications/main/u2f/u2f_data.c +++ b/applications/main/u2f/u2f_data.c @@ -7,12 +7,6 @@ #define TAG "U2F" -#define U2F_DATA_FOLDER ANY_PATH("u2f/") -#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der" -#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f" -#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f" -#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f" - #define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_FACTORY 2 #define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE 11 diff --git a/applications/main/u2f/u2f_data.h b/applications/main/u2f/u2f_data.h index 8d3923464..f3c62f89d 100644 --- a/applications/main/u2f/u2f_data.h +++ b/applications/main/u2f/u2f_data.h @@ -6,6 +6,14 @@ extern "C" { #include +#define U2F_DATA_FOLDER EXT_PATH("u2f/") +#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der" +#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f" +#define U2F_KEY_OLD_FILE U2F_DATA_FOLDER "key.u2f" +#define U2F_CNT_OLD_FILE U2F_DATA_FOLDER "cnt.u2f" +#define U2F_KEY_FILE INT_PATH(".key.u2f") +#define U2F_CNT_FILE INT_PATH(".cnt.u2f") + bool u2f_data_check(bool cert_only); bool u2f_data_cert_check();