plugin_state.h 2.4 KB

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