plugin_state.h 1.7 KB

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