cli_helpers.c 593 B

123456789101112131415161718192021
  1. #include "cli_helpers.h"
  2. #include <cli/cli.h>
  3. bool totp_cli_ensure_authenticated(PluginState* plugin_state, Cli* cli) {
  4. if(plugin_state->current_scene == TotpSceneAuthentication) {
  5. TOTP_CLI_PRINTF("Pleases enter PIN on your flipper device\r\n");
  6. while(plugin_state->current_scene == TotpSceneAuthentication &&
  7. !cli_cmd_interrupt_received(cli)) {
  8. furi_delay_ms(100);
  9. }
  10. TOTP_CLI_DELETE_LAST_LINE();
  11. if(plugin_state->current_scene == TotpSceneAuthentication) {
  12. return false;
  13. }
  14. }
  15. return true;
  16. }