plugin_state.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #pragma once
  2. #include <notification/notification.h>
  3. #include <gui/gui.h>
  4. #include <dialogs/dialogs.h>
  5. #include "../features_config.h"
  6. #include "../lib/list/list.h"
  7. #include "../ui/totp_scenes_enum.h"
  8. #include "notification_method.h"
  9. #include "automation_method.h"
  10. #ifdef TOTP_BADBT_TYPE_ENABLED
  11. #include "../workers/bt_type_code/bt_type_code.h"
  12. #endif
  13. #define TOTP_IV_SIZE 16
  14. /**
  15. * @brief Application state structure
  16. */
  17. typedef struct {
  18. /**
  19. * @brief Application current scene
  20. */
  21. Scene current_scene;
  22. /**
  23. * @brief Application current scene state
  24. */
  25. void* current_scene_state;
  26. /**
  27. * @brief Reference to the firmware notification subsystem
  28. */
  29. NotificationApp* notification_app;
  30. /**
  31. * @brief Reference to the firmware dialogs subsystem
  32. */
  33. DialogsApp* dialogs_app;
  34. /**
  35. * @brief Reference to the firmware GUI subsystem
  36. */
  37. Gui* gui;
  38. /**
  39. * @brief Timezone UTC offset in hours
  40. */
  41. float timezone_offset;
  42. /**
  43. * @brief Token list head node
  44. */
  45. ListNode* tokens_list;
  46. /**
  47. * @brief Whether token list is loaded or not
  48. */
  49. bool token_list_loaded;
  50. /**
  51. * @brief Tokens list length
  52. */
  53. uint16_t tokens_count;
  54. /**
  55. * @brief Encrypted well-known string data
  56. */
  57. uint8_t* crypto_verify_data;
  58. /**
  59. * @brief Encrypted well-known string data length
  60. */
  61. size_t crypto_verify_data_length;
  62. /**
  63. * @brief Whether PIN is set by user or not
  64. */
  65. bool pin_set;
  66. /**
  67. * @brief Initialization vector (IV) to be used for encryption\decryption
  68. */
  69. uint8_t iv[TOTP_IV_SIZE];
  70. /**
  71. * @brief Basic randomly-generated initialization vector (IV)
  72. */
  73. uint8_t base_iv[TOTP_IV_SIZE];
  74. /**
  75. * @brief Notification method
  76. */
  77. NotificationMethod notification_method;
  78. /**
  79. * @brief Main rendering loop mutex
  80. */
  81. FuriMutex* mutex;
  82. /**
  83. * @brief Automation method
  84. */
  85. AutomationMethod automation_method;
  86. #ifdef TOTP_BADBT_TYPE_ENABLED
  87. /**
  88. * @brief Bad-Bluetooth worker context
  89. */
  90. TotpBtTypeCodeWorkerContext* bt_type_code_worker_context;
  91. #endif
  92. } PluginState;