cli_helpers.c 617 B

12345678910111213141516171819202122
  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. fflush(stdout);
  12. if(plugin_state->current_scene == TotpSceneAuthentication) {
  13. return false;
  14. }
  15. }
  16. return true;
  17. }