totp_app_cli.c 854 B

1234567891011121314151617181920212223242526272829303132
  1. #include <furi.h>
  2. #include <cli/cli.h>
  3. #include <storage/storage.h>
  4. void totp_cli_print_usage() {
  5. printf("Usage:\r\n");
  6. printf("totp <cmd> <args>\r\n");
  7. printf("Cmd list:\r\n");
  8. printf("\tadd <secret:string> <name:string>\t - Add new TOTP secret\r\n");
  9. printf("\tremove <name:string>\t - Remove TOTP token\r\n");
  10. printf("\reset\t - Reset app to default (reset PIN and removes all tokens)\r\n");
  11. };
  12. static void totp_cli(Cli* cli, FuriString* args, void* context) {
  13. UNUSED(cli);
  14. UNUSED(args);
  15. UNUSED(context);
  16. totp_cli_print_usage();
  17. // TODO: implement add\remove\reset
  18. }
  19. void totp_on_system_start() {
  20. #ifdef SRV_CLI
  21. Cli* cli = furi_record_open(RECORD_CLI);
  22. cli_add_command(cli, "totp", CliCommandFlagDefault, totp_cli, NULL);
  23. furi_record_close(RECORD_CLI);
  24. #else
  25. UNUSED(totp_cli);
  26. #endif
  27. }