plugin_state.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 "../ui/totp_scenes_enum.h"
  7. #include "../services/config/config_file_context.h"
  8. #include "../services/idle_timeout/idle_timeout.h"
  9. #include "notification_method.h"
  10. #include "automation_method.h"
  11. #include "automation_kb_layout.h"
  12. #ifdef TOTP_BADBT_TYPE_ENABLED
  13. #include "../workers/bt_type_code/bt_type_code.h"
  14. #endif
  15. #include "../services/crypto/constants.h"
  16. /**
  17. * @brief Application state structure
  18. */
  19. typedef struct {
  20. /**
  21. * @brief Application current scene
  22. */
  23. Scene current_scene;
  24. /**
  25. * @brief Application current scene state
  26. */
  27. void* current_scene_state;
  28. /**
  29. * @brief Reference to the firmware dialogs subsystem
  30. */
  31. DialogsApp* dialogs_app;
  32. /**
  33. * @brief Reference to the firmware GUI subsystem
  34. */
  35. Gui* gui;
  36. /**
  37. * @brief Timezone UTC offset in hours
  38. */
  39. float timezone_offset;
  40. /**
  41. * @brief Config file context
  42. */
  43. ConfigFileContext* config_file_context;
  44. /**
  45. * @brief Encrypted well-known data
  46. */
  47. uint8_t* crypto_verify_data;
  48. /**
  49. * @brief Encrypted well-known data length
  50. */
  51. size_t crypto_verify_data_length;
  52. /**
  53. * @brief Whether PIN is set by user or not
  54. */
  55. bool pin_set;
  56. /**
  57. * @brief Initialization vector (IV) to be used for encryption\decryption
  58. */
  59. uint8_t iv[CRYPTO_IV_LENGTH];
  60. /**
  61. * @brief Basic randomly-generated initialization vector (IV)
  62. */
  63. uint8_t base_iv[CRYPTO_IV_LENGTH];
  64. /**
  65. * @brief Notification method
  66. */
  67. NotificationMethod notification_method;
  68. /**
  69. * @brief Automation method
  70. */
  71. AutomationMethod automation_method;
  72. /**
  73. * @brief Automation keyboard layout to be used
  74. */
  75. AutomationKeyboardLayout automation_kb_layout;
  76. #ifdef TOTP_BADBT_TYPE_ENABLED
  77. /**
  78. * @brief Bad-Bluetooth worker context
  79. */
  80. TotpBtTypeCodeWorkerContext* bt_type_code_worker_context;
  81. #endif
  82. /**
  83. * @brief IDLE timeout context
  84. */
  85. IdleTimeoutContext* idle_timeout_context;
  86. /**
  87. * @brief Font index to be used to draw TOTP token
  88. */
  89. uint8_t active_font_index;
  90. /**
  91. * @brief Crypto key slot to be used
  92. */
  93. uint8_t crypto_key_slot;
  94. /**
  95. * @brief Crypto algorithms version to be used
  96. */
  97. uint8_t crypto_version;
  98. /**
  99. * @brief Application even queue
  100. */
  101. FuriMessageQueue* event_queue;
  102. } PluginState;