Willy-JL 2 سال پیش
والد
کامیت
f2a2e82ee8

+ 4 - 4
esubghz_chat/esubghz_chat.c

@@ -758,12 +758,12 @@ int32_t esubghz_chat(const char* args) {
     crypto_ctx_free(state->crypto_ctx);
 
 err_alloc_crypto:
-    // free(state->nfc_dev_data);
+    //     free(state->nfc_dev_data);
 
-err_alloc_ndevdata:
-    // nfc_worker_free(state->nfc_worker);
+    // err_alloc_ndevdata:
+    //     nfc_worker_free(state->nfc_worker);
 
-err_alloc_nworker:
+    // err_alloc_nworker:
     subghz_tx_rx_worker_free(state->subghz_worker);
 
 err_alloc_worker:

+ 10 - 10
esubghz_chat/scenes/esubghz_chat_key_menu.c

@@ -52,10 +52,10 @@ static void key_menu_cb(void* context, uint32_t index) {
         view_dispatcher_send_custom_event(state->view_dispatcher, ESubGhzChatEvent_KeyMenuGenKey);
         break;
 
-    // case ESubGhzChatKeyMenuItems_ReadKeyFromNfc:
-    //     view_dispatcher_send_custom_event(
-    //         state->view_dispatcher, ESubGhzChatEvent_KeyMenuReadKeyFromNfc);
-    //     break;
+        // case ESubGhzChatKeyMenuItems_ReadKeyFromNfc:
+        //     view_dispatcher_send_custom_event(
+        //         state->view_dispatcher, ESubGhzChatEvent_KeyMenuReadKeyFromNfc);
+        //     break;
 
     default:
         break;
@@ -140,12 +140,12 @@ bool scene_on_event_key_menu(void* context, SceneManagerEvent event) {
             consumed = true;
             break;
 
-        /* switch to hex key read scene */
-        // case ESubGhzChatEvent_KeyMenuReadKeyFromNfc:
-        //     scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
-        //     consumed = true;
-        //     break;
-        // }
+            /* switch to hex key read scene */
+            // case ESubGhzChatEvent_KeyMenuReadKeyFromNfc:
+            //     scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
+            //     consumed = true;
+            //     break;
+        }
 
         break;
 

+ 273 - 273
esubghz_chat/scenes/esubghz_chat_key_read_popup.c

@@ -1,273 +1,273 @@
-#include "../esubghz_chat_i.h"
-#include "../helpers/nfc_helpers.h"
-
-typedef enum {
-    KeyReadPopupState_Idle,
-    KeyReadPopupState_Detecting,
-    KeyReadPopupState_Reading,
-    KeyReadPopupState_Fail,
-    KeyReadPopupState_Success,
-} KeyReadPopupState;
-
-static bool read_worker_cb(NfcWorkerEvent event, void* context) {
-    furi_assert(context);
-    ESubGhzChatState* state = context;
-
-    view_dispatcher_send_custom_event(state->view_dispatcher, event);
-
-    return true;
-}
-
-static void key_read_popup_timeout_cb(void* context) {
-    furi_assert(context);
-    ESubGhzChatState* state = context;
-
-    uint32_t cur_state =
-        scene_manager_get_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
-
-    /* done displaying our failure */
-    if(cur_state == KeyReadPopupState_Fail) {
-        view_dispatcher_send_custom_event(
-            state->view_dispatcher, ESubGhzChatEvent_KeyReadPopupFailed);
-        /* done displaying our success */
-    } else if(cur_state == KeyReadPopupState_Success) {
-        view_dispatcher_send_custom_event(
-            state->view_dispatcher, ESubGhzChatEvent_KeyReadPopupSucceeded);
-    }
-}
-
-struct ReplayDictNfcReaderContext {
-    uint8_t* cur;
-    uint8_t* max;
-};
-
-static bool replay_dict_nfc_reader(uint64_t* run_id, uint32_t* counter, void* context) {
-    struct ReplayDictNfcReaderContext* ctx = (struct ReplayDictNfcReaderContext*)context;
-
-    if(ctx->cur + sizeof(struct ReplayDictNfcEntry) > ctx->max) {
-        return false;
-    }
-
-    struct ReplayDictNfcEntry* entry = (struct ReplayDictNfcEntry*)ctx->cur;
-    *run_id = entry->run_id;
-    *counter = __ntohl(entry->counter);
-
-    ctx->cur += sizeof(struct ReplayDictNfcEntry);
-
-    return true;
-}
-
-static bool key_read_popup_handle_key_read(ESubGhzChatState* state) {
-    NfcDeviceData* dev_data = state->nfc_dev_data;
-
-    /* check for config pages */
-    if(dev_data->mf_ul_data.data_read < NFC_CONFIG_PAGES * 4) {
-        return false;
-    }
-
-    size_t data_read = dev_data->mf_ul_data.data_read - (NFC_CONFIG_PAGES * 4);
-
-    /* check if key was transmitted */
-    if(data_read < KEY_BITS / 8) {
-        return false;
-    }
-
-    /* initiate the crypto context */
-    bool ret = crypto_ctx_set_key(
-        state->crypto_ctx, dev_data->mf_ul_data.data, state->name_prefix, furi_get_tick());
-
-    /* cleanup */
-    crypto_explicit_bzero(dev_data->mf_ul_data.data, KEY_BITS / 8);
-
-    if(!ret) {
-        crypto_ctx_clear(state->crypto_ctx);
-        return false;
-    }
-
-    /* read the frequency */
-    if(data_read >= (KEY_BITS / 8) + sizeof(struct FreqNfcEntry)) {
-        struct FreqNfcEntry* freq_entry =
-            (struct FreqNfcEntry*)(dev_data->mf_ul_data.data + (KEY_BITS / 8));
-        state->frequency = __ntohl(freq_entry->frequency);
-    }
-
-    /* read the replay dict */
-    struct ReplayDictNfcReaderContext rd_ctx = {
-        .cur = dev_data->mf_ul_data.data + (KEY_BITS / 8) + sizeof(struct FreqNfcEntry),
-        .max =
-            dev_data->mf_ul_data.data + (data_read < NFC_MAX_BYTES ? data_read : NFC_MAX_BYTES)};
-
-    crypto_ctx_read_replay_dict(state->crypto_ctx, replay_dict_nfc_reader, &rd_ctx);
-
-    /* set encrypted flag */
-    state->encrypted = true;
-
-    return true;
-}
-
-static void key_read_popup_set_state(ESubGhzChatState* state, KeyReadPopupState new_state) {
-    uint32_t cur_state =
-        scene_manager_get_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
-    if(cur_state == new_state) {
-        return;
-    }
-
-    if(new_state == KeyReadPopupState_Detecting) {
-        popup_reset(state->nfc_popup);
-        popup_disable_timeout(state->nfc_popup);
-        popup_set_text(state->nfc_popup, "Tap Flipper\n to sender", 97, 24, AlignCenter, AlignTop);
-        popup_set_icon(state->nfc_popup, 0, 8, &I_NFC_manual_60x50);
-        notification_message(state->notification, &sequence_blink_start_cyan);
-    } else if(new_state == KeyReadPopupState_Reading) {
-        popup_reset(state->nfc_popup);
-        popup_disable_timeout(state->nfc_popup);
-        popup_set_header(
-            state->nfc_popup,
-            "Reading key\nDon't "
-            "move...",
-            85,
-            24,
-            AlignCenter,
-            AlignTop);
-        popup_set_icon(state->nfc_popup, 12, 23, &I_Loading_24);
-        notification_message(state->notification, &sequence_blink_start_yellow);
-    } else if(new_state == KeyReadPopupState_Fail) {
-        nfc_worker_stop(state->nfc_worker);
-
-        popup_reset(state->nfc_popup);
-        popup_set_header(state->nfc_popup, "Failure!", 64, 2, AlignCenter, AlignTop);
-        popup_set_text(state->nfc_popup, "Failed\nto read\nkey.", 78, 16, AlignLeft, AlignTop);
-        popup_set_icon(state->nfc_popup, 21, 13, &I_Cry_dolph_55x52);
-
-        popup_set_timeout(state->nfc_popup, KEY_READ_POPUP_MS);
-        popup_set_context(state->nfc_popup, state);
-        popup_set_callback(state->nfc_popup, key_read_popup_timeout_cb);
-        popup_enable_timeout(state->nfc_popup);
-
-        notification_message(state->notification, &sequence_blink_stop);
-    } else if(new_state == KeyReadPopupState_Success) {
-        nfc_worker_stop(state->nfc_worker);
-
-        popup_reset(state->nfc_popup);
-        popup_set_header(state->nfc_popup, "Key\nread!", 13, 22, AlignLeft, AlignBottom);
-        popup_set_icon(state->nfc_popup, 32, 5, &I_DolphinNice_96x59);
-
-        popup_set_timeout(state->nfc_popup, KEY_READ_POPUP_MS);
-        popup_set_context(state->nfc_popup, state);
-        popup_set_callback(state->nfc_popup, key_read_popup_timeout_cb);
-        popup_enable_timeout(state->nfc_popup);
-
-        notification_message(state->notification, &sequence_success);
-        notification_message(state->notification, &sequence_blink_stop);
-    }
-
-    scene_manager_set_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup, new_state);
-
-    view_dispatcher_switch_to_view(state->view_dispatcher, ESubGhzChatView_NfcPopup);
-}
-
-/* Prepares the key share read scene. */
-void scene_on_enter_key_read_popup(void* context) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_enter_key_read_popup");
-
-    furi_assert(context);
-    ESubGhzChatState* state = context;
-
-    key_read_popup_set_state(state, KeyReadPopupState_Detecting);
-
-    state->nfc_dev_data->parsed_data = furi_string_alloc();
-    if(state->nfc_dev_data->parsed_data == NULL) {
-        /* can't do anything here, crash */
-        furi_check(0);
-    }
-
-    nfc_worker_start(
-        state->nfc_worker, NfcWorkerStateRead, state->nfc_dev_data, read_worker_cb, state);
-}
-
-/* Handles scene manager events for the key read popup scene. */
-bool scene_on_event_key_read_popup(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_event_key_read_popup");
-
-    furi_assert(context);
-    ESubGhzChatState* state = context;
-
-    bool consumed = false;
-
-    switch(event.type) {
-    case SceneManagerEventTypeCustom:
-        switch(event.event) {
-        /* card detected */
-        case NfcWorkerEventCardDetected:
-            key_read_popup_set_state(state, KeyReadPopupState_Reading);
-            consumed = true;
-            break;
-
-        /* no card detected */
-        case NfcWorkerEventNoCardDetected:
-            key_read_popup_set_state(state, KeyReadPopupState_Detecting);
-            consumed = true;
-            break;
-
-        /* key probably read */
-        case NfcWorkerEventReadMfUltralight:
-            if(key_read_popup_handle_key_read(state)) {
-                key_read_popup_set_state(state, KeyReadPopupState_Success);
-            } else {
-                key_read_popup_set_state(state, KeyReadPopupState_Fail);
-            }
-            consumed = true;
-            break;
-
-        /* close the popup and go back */
-        case ESubGhzChatEvent_KeyReadPopupFailed:
-            if(!scene_manager_previous_scene(state->scene_manager)) {
-                view_dispatcher_stop(state->view_dispatcher);
-            }
-            consumed = true;
-            break;
-
-        /* success, go to frequency input */
-        case ESubGhzChatEvent_KeyReadPopupSucceeded:
-            scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_FreqInput);
-            consumed = true;
-            break;
-
-        /* something else happend, treat as failure */
-        default:
-            key_read_popup_set_state(state, KeyReadPopupState_Fail);
-            consumed = true;
-            break;
-        }
-
-        break;
-
-    default:
-        consumed = false;
-        break;
-    }
-
-    return consumed;
-}
-
-/* Cleans up the key read popup scene. */
-void scene_on_exit_key_read_popup(void* context) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_exit_key_read_popup");
-
-    furi_assert(context);
-    ESubGhzChatState* state = context;
-
-    popup_reset(state->nfc_popup);
-    scene_manager_set_scene_state(
-        state->scene_manager, ESubGhzChatScene_KeyReadPopup, KeyReadPopupState_Idle);
-
-    notification_message(state->notification, &sequence_blink_stop);
-
-    nfc_worker_stop(state->nfc_worker);
-
-    crypto_explicit_bzero(state->nfc_dev_data->mf_ul_data.data, KEY_BITS / 8);
-    if(state->nfc_dev_data->parsed_data != NULL) {
-        furi_string_free(state->nfc_dev_data->parsed_data);
-    }
-    memset(state->nfc_dev_data, 0, sizeof(NfcDeviceData));
-}
+// #include "../esubghz_chat_i.h"
+// #include "../helpers/nfc_helpers.h"
+
+// typedef enum {
+//     KeyReadPopupState_Idle,
+//     KeyReadPopupState_Detecting,
+//     KeyReadPopupState_Reading,
+//     KeyReadPopupState_Fail,
+//     KeyReadPopupState_Success,
+// } KeyReadPopupState;
+
+// static bool read_worker_cb(NfcWorkerEvent event, void* context) {
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
+
+//     view_dispatcher_send_custom_event(state->view_dispatcher, event);
+
+//     return true;
+// }
+
+// static void key_read_popup_timeout_cb(void* context) {
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
+
+//     uint32_t cur_state =
+//         scene_manager_get_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
+
+//     /* done displaying our failure */
+//     if(cur_state == KeyReadPopupState_Fail) {
+//         view_dispatcher_send_custom_event(
+//             state->view_dispatcher, ESubGhzChatEvent_KeyReadPopupFailed);
+//         /* done displaying our success */
+//     } else if(cur_state == KeyReadPopupState_Success) {
+//         view_dispatcher_send_custom_event(
+//             state->view_dispatcher, ESubGhzChatEvent_KeyReadPopupSucceeded);
+//     }
+// }
+
+// struct ReplayDictNfcReaderContext {
+//     uint8_t* cur;
+//     uint8_t* max;
+// };
+
+// static bool replay_dict_nfc_reader(uint64_t* run_id, uint32_t* counter, void* context) {
+//     struct ReplayDictNfcReaderContext* ctx = (struct ReplayDictNfcReaderContext*)context;
+
+//     if(ctx->cur + sizeof(struct ReplayDictNfcEntry) > ctx->max) {
+//         return false;
+//     }
+
+//     struct ReplayDictNfcEntry* entry = (struct ReplayDictNfcEntry*)ctx->cur;
+//     *run_id = entry->run_id;
+//     *counter = __ntohl(entry->counter);
+
+//     ctx->cur += sizeof(struct ReplayDictNfcEntry);
+
+//     return true;
+// }
+
+// static bool key_read_popup_handle_key_read(ESubGhzChatState* state) {
+//     NfcDeviceData* dev_data = state->nfc_dev_data;
+
+//     /* check for config pages */
+//     if(dev_data->mf_ul_data.data_read < NFC_CONFIG_PAGES * 4) {
+//         return false;
+//     }
+
+//     size_t data_read = dev_data->mf_ul_data.data_read - (NFC_CONFIG_PAGES * 4);
+
+//     /* check if key was transmitted */
+//     if(data_read < KEY_BITS / 8) {
+//         return false;
+//     }
+
+//     /* initiate the crypto context */
+//     bool ret = crypto_ctx_set_key(
+//         state->crypto_ctx, dev_data->mf_ul_data.data, state->name_prefix, furi_get_tick());
+
+//     /* cleanup */
+//     crypto_explicit_bzero(dev_data->mf_ul_data.data, KEY_BITS / 8);
+
+//     if(!ret) {
+//         crypto_ctx_clear(state->crypto_ctx);
+//         return false;
+//     }
+
+//     /* read the frequency */
+//     if(data_read >= (KEY_BITS / 8) + sizeof(struct FreqNfcEntry)) {
+//         struct FreqNfcEntry* freq_entry =
+//             (struct FreqNfcEntry*)(dev_data->mf_ul_data.data + (KEY_BITS / 8));
+//         state->frequency = __ntohl(freq_entry->frequency);
+//     }
+
+//     /* read the replay dict */
+//     struct ReplayDictNfcReaderContext rd_ctx = {
+//         .cur = dev_data->mf_ul_data.data + (KEY_BITS / 8) + sizeof(struct FreqNfcEntry),
+//         .max =
+//             dev_data->mf_ul_data.data + (data_read < NFC_MAX_BYTES ? data_read : NFC_MAX_BYTES)};
+
+//     crypto_ctx_read_replay_dict(state->crypto_ctx, replay_dict_nfc_reader, &rd_ctx);
+
+//     /* set encrypted flag */
+//     state->encrypted = true;
+
+//     return true;
+// }
+
+// static void key_read_popup_set_state(ESubGhzChatState* state, KeyReadPopupState new_state) {
+//     uint32_t cur_state =
+//         scene_manager_get_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup);
+//     if(cur_state == new_state) {
+//         return;
+//     }
+
+//     if(new_state == KeyReadPopupState_Detecting) {
+//         popup_reset(state->nfc_popup);
+//         popup_disable_timeout(state->nfc_popup);
+//         popup_set_text(state->nfc_popup, "Tap Flipper\n to sender", 97, 24, AlignCenter, AlignTop);
+//         popup_set_icon(state->nfc_popup, 0, 8, &I_NFC_manual_60x50);
+//         notification_message(state->notification, &sequence_blink_start_cyan);
+//     } else if(new_state == KeyReadPopupState_Reading) {
+//         popup_reset(state->nfc_popup);
+//         popup_disable_timeout(state->nfc_popup);
+//         popup_set_header(
+//             state->nfc_popup,
+//             "Reading key\nDon't "
+//             "move...",
+//             85,
+//             24,
+//             AlignCenter,
+//             AlignTop);
+//         popup_set_icon(state->nfc_popup, 12, 23, &I_Loading_24);
+//         notification_message(state->notification, &sequence_blink_start_yellow);
+//     } else if(new_state == KeyReadPopupState_Fail) {
+//         nfc_worker_stop(state->nfc_worker);
+
+//         popup_reset(state->nfc_popup);
+//         popup_set_header(state->nfc_popup, "Failure!", 64, 2, AlignCenter, AlignTop);
+//         popup_set_text(state->nfc_popup, "Failed\nto read\nkey.", 78, 16, AlignLeft, AlignTop);
+//         popup_set_icon(state->nfc_popup, 21, 13, &I_Cry_dolph_55x52);
+
+//         popup_set_timeout(state->nfc_popup, KEY_READ_POPUP_MS);
+//         popup_set_context(state->nfc_popup, state);
+//         popup_set_callback(state->nfc_popup, key_read_popup_timeout_cb);
+//         popup_enable_timeout(state->nfc_popup);
+
+//         notification_message(state->notification, &sequence_blink_stop);
+//     } else if(new_state == KeyReadPopupState_Success) {
+//         nfc_worker_stop(state->nfc_worker);
+
+//         popup_reset(state->nfc_popup);
+//         popup_set_header(state->nfc_popup, "Key\nread!", 13, 22, AlignLeft, AlignBottom);
+//         popup_set_icon(state->nfc_popup, 32, 5, &I_DolphinNice_96x59);
+
+//         popup_set_timeout(state->nfc_popup, KEY_READ_POPUP_MS);
+//         popup_set_context(state->nfc_popup, state);
+//         popup_set_callback(state->nfc_popup, key_read_popup_timeout_cb);
+//         popup_enable_timeout(state->nfc_popup);
+
+//         notification_message(state->notification, &sequence_success);
+//         notification_message(state->notification, &sequence_blink_stop);
+//     }
+
+//     scene_manager_set_scene_state(state->scene_manager, ESubGhzChatScene_KeyReadPopup, new_state);
+
+//     view_dispatcher_switch_to_view(state->view_dispatcher, ESubGhzChatView_NfcPopup);
+// }
+
+// /* Prepares the key share read scene. */
+// void scene_on_enter_key_read_popup(void* context) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_enter_key_read_popup");
+
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
+
+//     key_read_popup_set_state(state, KeyReadPopupState_Detecting);
+
+//     state->nfc_dev_data->parsed_data = furi_string_alloc();
+//     if(state->nfc_dev_data->parsed_data == NULL) {
+//         /* can't do anything here, crash */
+//         furi_check(0);
+//     }
+
+//     nfc_worker_start(
+//         state->nfc_worker, NfcWorkerStateRead, state->nfc_dev_data, read_worker_cb, state);
+// }
+
+// /* Handles scene manager events for the key read popup scene. */
+// bool scene_on_event_key_read_popup(void* context, SceneManagerEvent event) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_event_key_read_popup");
+
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
+
+//     bool consumed = false;
+
+//     switch(event.type) {
+//     case SceneManagerEventTypeCustom:
+//         switch(event.event) {
+//         /* card detected */
+//         case NfcWorkerEventCardDetected:
+//             key_read_popup_set_state(state, KeyReadPopupState_Reading);
+//             consumed = true;
+//             break;
+
+//         /* no card detected */
+//         case NfcWorkerEventNoCardDetected:
+//             key_read_popup_set_state(state, KeyReadPopupState_Detecting);
+//             consumed = true;
+//             break;
+
+//         /* key probably read */
+//         case NfcWorkerEventReadMfUltralight:
+//             if(key_read_popup_handle_key_read(state)) {
+//                 key_read_popup_set_state(state, KeyReadPopupState_Success);
+//             } else {
+//                 key_read_popup_set_state(state, KeyReadPopupState_Fail);
+//             }
+//             consumed = true;
+//             break;
+
+//         /* close the popup and go back */
+//         case ESubGhzChatEvent_KeyReadPopupFailed:
+//             if(!scene_manager_previous_scene(state->scene_manager)) {
+//                 view_dispatcher_stop(state->view_dispatcher);
+//             }
+//             consumed = true;
+//             break;
+
+//         /* success, go to frequency input */
+//         case ESubGhzChatEvent_KeyReadPopupSucceeded:
+//             scene_manager_next_scene(state->scene_manager, ESubGhzChatScene_FreqInput);
+//             consumed = true;
+//             break;
+
+//         /* something else happend, treat as failure */
+//         default:
+//             key_read_popup_set_state(state, KeyReadPopupState_Fail);
+//             consumed = true;
+//             break;
+//         }
+
+//         break;
+
+//     default:
+//         consumed = false;
+//         break;
+//     }
+
+//     return consumed;
+// }
+
+// /* Cleans up the key read popup scene. */
+// void scene_on_exit_key_read_popup(void* context) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_exit_key_read_popup");
+
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
+
+//     popup_reset(state->nfc_popup);
+//     scene_manager_set_scene_state(
+//         state->scene_manager, ESubGhzChatScene_KeyReadPopup, KeyReadPopupState_Idle);
+
+//     notification_message(state->notification, &sequence_blink_stop);
+
+//     nfc_worker_stop(state->nfc_worker);
+
+//     crypto_explicit_bzero(state->nfc_dev_data->mf_ul_data.data, KEY_BITS / 8);
+//     if(state->nfc_dev_data->parsed_data != NULL) {
+//         furi_string_free(state->nfc_dev_data->parsed_data);
+//     }
+//     memset(state->nfc_dev_data, 0, sizeof(NfcDeviceData));
+// }

+ 91 - 91
esubghz_chat/scenes/esubghz_chat_key_share_popup.c

@@ -1,124 +1,124 @@
-#include "../esubghz_chat_i.h"
-#include "../helpers/nfc_helpers.h"
+// #include "../esubghz_chat_i.h"
+// #include "../helpers/nfc_helpers.h"
 
-struct ReplayDictNfcWriterContext {
-    uint8_t* cur;
-    uint8_t* max;
-};
+// struct ReplayDictNfcWriterContext {
+//     uint8_t* cur;
+//     uint8_t* max;
+// };
 
-static bool replay_dict_nfc_writer(uint64_t run_id, uint32_t counter, void* context) {
-    struct ReplayDictNfcWriterContext* ctx = (struct ReplayDictNfcWriterContext*)context;
+// static bool replay_dict_nfc_writer(uint64_t run_id, uint32_t counter, void* context) {
+//     struct ReplayDictNfcWriterContext* ctx = (struct ReplayDictNfcWriterContext*)context;
 
-    struct ReplayDictNfcEntry entry = {.run_id = run_id, .counter = __htonl(counter), .unused = 0};
+//     struct ReplayDictNfcEntry entry = {.run_id = run_id, .counter = __htonl(counter), .unused = 0};
 
-    if(ctx->cur + sizeof(entry) > ctx->max) {
-        return false;
-    }
+//     if(ctx->cur + sizeof(entry) > ctx->max) {
+//         return false;
+//     }
 
-    memcpy(ctx->cur, &entry, sizeof(entry));
-    ctx->cur += sizeof(entry);
+//     memcpy(ctx->cur, &entry, sizeof(entry));
+//     ctx->cur += sizeof(entry);
 
-    return true;
-}
+//     return true;
+// }
 
-static void prepare_nfc_dev_data(ESubGhzChatState* state) {
-    NfcDeviceData* dev_data = state->nfc_dev_data;
+// static void prepare_nfc_dev_data(ESubGhzChatState* state) {
+//     NfcDeviceData* dev_data = state->nfc_dev_data;
 
-    dev_data->protocol = NfcDeviceProtocolMifareUl;
-    furi_hal_random_fill_buf(dev_data->nfc_data.uid, 7);
-    dev_data->nfc_data.uid_len = 7;
-    dev_data->nfc_data.atqa[0] = 0x44;
-    dev_data->nfc_data.atqa[1] = 0x00;
-    dev_data->nfc_data.sak = 0x00;
+//     dev_data->protocol = NfcDeviceProtocolMifareUl;
+//     furi_hal_random_fill_buf(dev_data->nfc_data.uid, 7);
+//     dev_data->nfc_data.uid_len = 7;
+//     dev_data->nfc_data.atqa[0] = 0x44;
+//     dev_data->nfc_data.atqa[1] = 0x00;
+//     dev_data->nfc_data.sak = 0x00;
 
-    dev_data->mf_ul_data.type = MfUltralightTypeNTAG215;
-    dev_data->mf_ul_data.version.header = 0x00;
-    dev_data->mf_ul_data.version.vendor_id = 0x04;
-    dev_data->mf_ul_data.version.prod_type = 0x04;
-    dev_data->mf_ul_data.version.prod_subtype = 0x02;
-    dev_data->mf_ul_data.version.prod_ver_major = 0x01;
-    dev_data->mf_ul_data.version.prod_ver_minor = 0x00;
-    dev_data->mf_ul_data.version.storage_size = 0x11;
-    dev_data->mf_ul_data.version.protocol_type = 0x03;
+//     dev_data->mf_ul_data.type = MfUltralightTypeNTAG215;
+//     dev_data->mf_ul_data.version.header = 0x00;
+//     dev_data->mf_ul_data.version.vendor_id = 0x04;
+//     dev_data->mf_ul_data.version.prod_type = 0x04;
+//     dev_data->mf_ul_data.version.prod_subtype = 0x02;
+//     dev_data->mf_ul_data.version.prod_ver_major = 0x01;
+//     dev_data->mf_ul_data.version.prod_ver_minor = 0x00;
+//     dev_data->mf_ul_data.version.storage_size = 0x11;
+//     dev_data->mf_ul_data.version.protocol_type = 0x03;
 
-    size_t data_written = 0;
+//     size_t data_written = 0;
 
-    /* write key */
-    crypto_ctx_get_key(state->crypto_ctx, dev_data->mf_ul_data.data);
-    data_written += (KEY_BITS / 8);
+//     /* write key */
+//     crypto_ctx_get_key(state->crypto_ctx, dev_data->mf_ul_data.data);
+//     data_written += (KEY_BITS / 8);
 
-    /* write frequency */
-    struct FreqNfcEntry* freq_entry =
-        (struct FreqNfcEntry*)(dev_data->mf_ul_data.data + data_written);
-    freq_entry->frequency = __htonl(state->frequency);
-    freq_entry->unused1 = 0;
-    freq_entry->unused2 = 0;
-    freq_entry->unused3 = 0;
-    data_written += sizeof(struct FreqNfcEntry);
+//     /* write frequency */
+//     struct FreqNfcEntry* freq_entry =
+//         (struct FreqNfcEntry*)(dev_data->mf_ul_data.data + data_written);
+//     freq_entry->frequency = __htonl(state->frequency);
+//     freq_entry->unused1 = 0;
+//     freq_entry->unused2 = 0;
+//     freq_entry->unused3 = 0;
+//     data_written += sizeof(struct FreqNfcEntry);
 
-    /* write the replay dict */
-    struct ReplayDictNfcWriterContext wr_ctx = {
-        .cur = dev_data->mf_ul_data.data + data_written,
-        .max = dev_data->mf_ul_data.data + NFC_MAX_BYTES};
+//     /* write the replay dict */
+//     struct ReplayDictNfcWriterContext wr_ctx = {
+//         .cur = dev_data->mf_ul_data.data + data_written,
+//         .max = dev_data->mf_ul_data.data + NFC_MAX_BYTES};
 
-    size_t n_entries =
-        crypto_ctx_dump_replay_dict(state->crypto_ctx, replay_dict_nfc_writer, &wr_ctx);
-    data_written += n_entries * sizeof(struct ReplayDictNfcEntry);
+//     size_t n_entries =
+//         crypto_ctx_dump_replay_dict(state->crypto_ctx, replay_dict_nfc_writer, &wr_ctx);
+//     data_written += n_entries * sizeof(struct ReplayDictNfcEntry);
 
-    /* calculate size of data, add 16 for config pages */
-    dev_data->mf_ul_data.data_size = data_written + (NFC_CONFIG_PAGES * 4);
-}
+//     /* calculate size of data, add 16 for config pages */
+//     dev_data->mf_ul_data.data_size = data_written + (NFC_CONFIG_PAGES * 4);
+// }
 
-/* Prepares the key share popup scene. */
-void scene_on_enter_key_share_popup(void* context) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_enter_key_share_popup");
+// /* Prepares the key share popup scene. */
+// void scene_on_enter_key_share_popup(void* context) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_enter_key_share_popup");
 
-    furi_assert(context);
-    ESubGhzChatState* state = context;
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
 
-    popup_reset(state->nfc_popup);
+//     popup_reset(state->nfc_popup);
 
-    popup_disable_timeout(state->nfc_popup);
+//     popup_disable_timeout(state->nfc_popup);
 
-    popup_set_header(state->nfc_popup, "Sharing...", 67, 13, AlignLeft, AlignTop);
-    popup_set_icon(state->nfc_popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
-    popup_set_text(state->nfc_popup, "Sharing\nKey via\nNFC", 90, 28, AlignCenter, AlignTop);
+//     popup_set_header(state->nfc_popup, "Sharing...", 67, 13, AlignLeft, AlignTop);
+//     popup_set_icon(state->nfc_popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
+//     popup_set_text(state->nfc_popup, "Sharing\nKey via\nNFC", 90, 28, AlignCenter, AlignTop);
 
-    prepare_nfc_dev_data(state);
-    nfc_worker_start(
-        state->nfc_worker, NfcWorkerStateMfUltralightEmulate, state->nfc_dev_data, NULL, NULL);
+//     prepare_nfc_dev_data(state);
+//     nfc_worker_start(
+//         state->nfc_worker, NfcWorkerStateMfUltralightEmulate, state->nfc_dev_data, NULL, NULL);
 
-    notification_message(state->notification, &sequence_blink_start_magenta);
+//     notification_message(state->notification, &sequence_blink_start_magenta);
 
-    view_dispatcher_switch_to_view(state->view_dispatcher, ESubGhzChatView_NfcPopup);
-}
+//     view_dispatcher_switch_to_view(state->view_dispatcher, ESubGhzChatView_NfcPopup);
+// }
 
-/* Handles scene manager events for the key share popup scene. */
-bool scene_on_event_key_share_popup(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_event_key_share_popup");
+// /* Handles scene manager events for the key share popup scene. */
+// bool scene_on_event_key_share_popup(void* context, SceneManagerEvent event) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_event_key_share_popup");
 
-    furi_assert(context);
-    ESubGhzChatState* state = context;
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
 
-    UNUSED(state);
-    UNUSED(event);
+//     UNUSED(state);
+//     UNUSED(event);
 
-    return false;
-}
+//     return false;
+// }
 
-/* Cleans up the key share popup scene. */
-void scene_on_exit_key_share_popup(void* context) {
-    FURI_LOG_T(APPLICATION_NAME, "scene_on_exit_key_share_popup");
+// /* Cleans up the key share popup scene. */
+// void scene_on_exit_key_share_popup(void* context) {
+//     FURI_LOG_T(APPLICATION_NAME, "scene_on_exit_key_share_popup");
 
-    furi_assert(context);
-    ESubGhzChatState* state = context;
+//     furi_assert(context);
+//     ESubGhzChatState* state = context;
 
-    popup_reset(state->nfc_popup);
+//     popup_reset(state->nfc_popup);
 
-    notification_message(state->notification, &sequence_blink_stop);
+//     notification_message(state->notification, &sequence_blink_stop);
 
-    nfc_worker_stop(state->nfc_worker);
+//     nfc_worker_stop(state->nfc_worker);
 
-    crypto_explicit_bzero(state->nfc_dev_data->mf_ul_data.data, KEY_BITS / 8);
-    memset(state->nfc_dev_data, 0, sizeof(NfcDeviceData));
-}
+//     crypto_explicit_bzero(state->nfc_dev_data->mf_ul_data.data, KEY_BITS / 8);
+//     memset(state->nfc_dev_data, 0, sizeof(NfcDeviceData));
+// }