plugin_state.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #define TOTP_IV_SIZE 16
  8. /**
  9. * @brief Application state structure
  10. */
  11. typedef struct {
  12. /**
  13. * @brief Application current scene
  14. */
  15. Scene current_scene;
  16. /**
  17. * @brief Application current scene state
  18. */
  19. void* current_scene_state;
  20. /**
  21. * @brief Whether scene is changing now
  22. */
  23. bool changing_scene;
  24. /**
  25. * @brief Reference to the firmware notification subsystem
  26. */
  27. NotificationApp* notification;
  28. /**
  29. * @brief Reference to the firmware dialogs subsystem
  30. */
  31. DialogsApp* dialogs;
  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 Token list head node
  42. */
  43. ListNode* tokens_list;
  44. /**
  45. * @brief Whether token list is loaded or not
  46. */
  47. bool token_list_loaded;
  48. /**
  49. * @brief Tokens list length
  50. */
  51. uint16_t tokens_count;
  52. /**
  53. * @brief Encrypted well-known string data
  54. */
  55. uint8_t* crypto_verify_data;
  56. /**
  57. * @brief Encrypted well-known string data length
  58. */
  59. size_t crypto_verify_data_length;
  60. /**
  61. * @brief Whether PIN is set by user or not
  62. */
  63. bool pin_set;
  64. /**
  65. * @brief Initialization vector (IV) to be used for encryption\decryption
  66. */
  67. uint8_t iv[TOTP_IV_SIZE];
  68. /**
  69. * @brief Basic randomly-generated initialization vector (IV)
  70. */
  71. uint8_t base_iv[TOTP_IV_SIZE];
  72. } PluginState;