mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
totp update
This commit is contained in:
@@ -79,6 +79,7 @@ static TotpIteratorUpdateTokenResult
|
||||
return TotpIteratorUpdateTokenResultSuccess;
|
||||
}
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_add_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_ADD ", " TOTP_CLI_COMMAND_ADD_ALT
|
||||
", " TOTP_CLI_COMMAND_ADD_ALT2 " Add new token\r\n");
|
||||
@@ -155,6 +156,7 @@ void totp_cli_command_add_docopt_options() {
|
||||
TOTP_CLI_PRINTF(" # " TOKEN_AUTOMATION_FEATURE_TYPE_SLOWER_NAME
|
||||
" - Type slower\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_add_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../config/app/config.h"
|
||||
#include "../../../types/plugin_state.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_ADD "add"
|
||||
@@ -8,7 +9,9 @@
|
||||
#define TOTP_CLI_COMMAND_ADD_ALT2 "new"
|
||||
|
||||
void totp_cli_command_add_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_add_docopt_commands();
|
||||
void totp_cli_command_add_docopt_usage();
|
||||
void totp_cli_command_add_docopt_arguments();
|
||||
void totp_cli_command_add_docopt_options();
|
||||
void totp_cli_command_add_docopt_options();
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
#define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT_PREFIX "-k"
|
||||
#define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT "layout"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_automation_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_AUTOMATION " Get or set automation settings\r\n");
|
||||
}
|
||||
@@ -45,6 +46,7 @@ void totp_cli_command_automation_docopt_options() {
|
||||
", " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY
|
||||
"\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void print_method(AutomationMethod method, const char* color) {
|
||||
#ifdef TOTP_BADBT_AUTOMATION_ENABLED
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_AUTOMATION "automation"
|
||||
|
||||
void totp_cli_command_automation_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_automation_docopt_commands();
|
||||
void totp_cli_command_automation_docopt_usage();
|
||||
void totp_cli_command_automation_docopt_arguments();
|
||||
void totp_cli_command_automation_docopt_options();
|
||||
void totp_cli_command_automation_docopt_options();
|
||||
#endif
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#define TOTP_CLI_COMMAND_DELETE_ARG_FORCE_PREFIX "-f"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_delete_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_DELETE ", " TOTP_CLI_COMMAND_DELETE_ALT
|
||||
" Delete existing token\r\n");
|
||||
@@ -30,6 +31,7 @@ void totp_cli_command_delete_docopt_options() {
|
||||
TOTP_CLI_PRINTF(" " DOCOPT_SWITCH(
|
||||
TOTP_CLI_COMMAND_DELETE_ARG_FORCE_PREFIX) " Force command to do not ask user for interactive confirmation\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_delete_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_DELETE "delete"
|
||||
#define TOTP_CLI_COMMAND_DELETE_ALT "rm"
|
||||
|
||||
void totp_cli_command_delete_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_delete_docopt_commands();
|
||||
void totp_cli_command_delete_docopt_usage();
|
||||
void totp_cli_command_delete_docopt_arguments();
|
||||
void totp_cli_command_delete_docopt_options();
|
||||
void totp_cli_command_delete_docopt_options();
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,7 @@ static void print_automation_features(const TokenInfo* token_info) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_details_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_DETAILS ", " TOTP_CLI_COMMAND_DETAILS_ALT
|
||||
" Displays token details\r\n");
|
||||
@@ -47,6 +48,7 @@ void totp_cli_command_details_docopt_usage() {
|
||||
TOTP_CLI_COMMAND_DETAILS
|
||||
" | " TOTP_CLI_COMMAND_DETAILS_ALT) " " DOCOPT_ARGUMENT(TOTP_CLI_COMMAND_ARG_INDEX) "\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_details_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_DETAILS "lsattr"
|
||||
#define TOTP_CLI_COMMAND_DETAILS_ALT "cat"
|
||||
|
||||
void totp_cli_command_details_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_details_docopt_commands();
|
||||
void totp_cli_command_details_docopt_usage();
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "../automation/automation.h"
|
||||
#include "../details/details.h"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_help_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_HELP ", " TOTP_CLI_COMMAND_HELP_ALT
|
||||
", " TOTP_CLI_COMMAND_HELP_ALT2 " Show command usage help\r\n");
|
||||
@@ -22,8 +23,10 @@ void totp_cli_command_help_docopt_usage() {
|
||||
TOTP_CLI_COMMAND_HELP " | " TOTP_CLI_COMMAND_HELP_ALT
|
||||
" | " TOTP_CLI_COMMAND_HELP_ALT2) "\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_help_handle() {
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
TOTP_CLI_PRINTF("Usage:\r\n");
|
||||
totp_cli_command_help_docopt_usage();
|
||||
totp_cli_command_list_docopt_usage();
|
||||
@@ -66,4 +69,8 @@ void totp_cli_command_help_handle() {
|
||||
totp_cli_command_delete_docopt_options();
|
||||
totp_cli_command_pin_docopt_options();
|
||||
totp_cli_command_automation_docopt_options();
|
||||
#else
|
||||
TOTP_CLI_PRINTF(
|
||||
"All the TOTP CLI commands, their arguments, options and usage can be found here https://t.ly/_6pJG");
|
||||
#endif
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../config/app/config.h"
|
||||
#include <cli/cli.h>
|
||||
|
||||
#define TOTP_CLI_COMMAND_HELP "help"
|
||||
@@ -7,5 +8,7 @@
|
||||
#define TOTP_CLI_COMMAND_HELP_ALT2 "?"
|
||||
|
||||
void totp_cli_command_help_handle();
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_help_docopt_commands();
|
||||
void totp_cli_command_help_docopt_usage();
|
||||
void totp_cli_command_help_docopt_usage();
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "../../../ui/scene_director.h"
|
||||
#include "../../cli_helpers.h"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_list_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_LIST ", " TOTP_CLI_COMMAND_LIST_ALT
|
||||
" List all available tokens\r\n");
|
||||
@@ -15,6 +16,7 @@ void totp_cli_command_list_docopt_usage() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_NAME " " DOCOPT_REQUIRED(
|
||||
TOTP_CLI_COMMAND_LIST " | " TOTP_CLI_COMMAND_LIST_ALT) "\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_list_handle(PluginState* plugin_state, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_LIST "list"
|
||||
#define TOTP_CLI_COMMAND_LIST_ALT "ls"
|
||||
|
||||
void totp_cli_command_list_handle(PluginState* plugin_state, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_list_docopt_commands();
|
||||
void totp_cli_command_list_docopt_usage();
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#define TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX "new_index"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_move_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_MOVE ", " TOTP_CLI_COMMAND_MOVE_ALT
|
||||
" Move token\r\n");
|
||||
@@ -26,6 +27,7 @@ void totp_cli_command_move_docopt_arguments() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_MOVE_ARG_NEW_INDEX
|
||||
" New token index in the list\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_move_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_MOVE "move"
|
||||
#define TOTP_CLI_COMMAND_MOVE_ALT "mv"
|
||||
|
||||
void totp_cli_command_move_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_move_docopt_commands();
|
||||
void totp_cli_command_move_docopt_usage();
|
||||
void totp_cli_command_move_docopt_arguments();
|
||||
void totp_cli_command_move_docopt_arguments();
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define TOTP_CLI_COMMAND_NOTIFICATION_METHOD_SOUND "sound"
|
||||
#define TOTP_CLI_COMMAND_NOTIFICATION_METHOD_VIBRO "vibro"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_notification_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_NOTIFICATION
|
||||
" Get or set notification method\r\n");
|
||||
@@ -27,6 +28,7 @@ void totp_cli_command_notification_docopt_arguments() {
|
||||
", " TOTP_CLI_COMMAND_NOTIFICATION_METHOD_SOUND
|
||||
", " TOTP_CLI_COMMAND_NOTIFICATION_METHOD_VIBRO "\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
totp_cli_command_notification_print_method(NotificationMethod method, const char* color) {
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_NOTIFICATION "notify"
|
||||
|
||||
void totp_cli_command_notification_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_notification_docopt_commands();
|
||||
void totp_cli_command_notification_docopt_usage();
|
||||
void totp_cli_command_notification_docopt_arguments();
|
||||
void totp_cli_command_notification_docopt_arguments();
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
#define TOTP_CLI_COMMAND_PIN_ARG_NEW_CRYPTO_KEY_SLOT_PREFIX "-c"
|
||||
#define TOTP_CLI_COMMAND_PIN_ARG_NEW_CRYPTO_KEY_SLOT "slot"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_pin_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_PIN " Set\\change\\remove PIN\r\n");
|
||||
}
|
||||
@@ -37,6 +38,7 @@ void totp_cli_command_pin_docopt_options() {
|
||||
ACCEPTABLE_CRYPTO_KEY_SLOT_START,
|
||||
ACCEPTABLE_CRYPTO_KEY_SLOT_END);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline uint8_t totp_cli_key_to_pin_code(uint8_t key) {
|
||||
uint8_t code = 0;
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_PIN "pin"
|
||||
|
||||
void totp_cli_command_pin_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_pin_docopt_commands();
|
||||
void totp_cli_command_pin_docopt_usage();
|
||||
void totp_cli_command_pin_docopt_options();
|
||||
void totp_cli_command_pin_docopt_options();
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#define TOTP_CLI_RESET_CONFIRMATION_KEYWORD "YES"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_reset_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_RESET
|
||||
" Reset application to default settings\r\n");
|
||||
@@ -16,6 +17,7 @@ void totp_cli_command_reset_docopt_commands() {
|
||||
void totp_cli_command_reset_docopt_usage() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_NAME " " TOTP_CLI_COMMAND_RESET "\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_reset_handle(PluginState* plugin_state, Cli* cli) {
|
||||
TOTP_CLI_LOCK_UI(plugin_state);
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_RESET "reset"
|
||||
|
||||
void totp_cli_command_reset_handle(PluginState* plugin_state, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_reset_docopt_commands();
|
||||
void totp_cli_command_reset_docopt_usage();
|
||||
void totp_cli_command_reset_docopt_usage();
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#define TOTP_CLI_COMMAND_TIMEZONE_ARG_TIMEZONE "timezone"
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_timezone_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_TIMEZONE ", " TOTP_CLI_COMMAND_TIMEZONE_ALT
|
||||
" Get or set current timezone\r\n");
|
||||
@@ -22,6 +23,7 @@ void totp_cli_command_timezone_docopt_arguments() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_TIMEZONE_ARG_TIMEZONE
|
||||
" Timezone offset in hours to be set\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_timezone_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_TIMEZONE "timezone"
|
||||
#define TOTP_CLI_COMMAND_TIMEZONE_ALT "tz"
|
||||
|
||||
void totp_cli_command_timezone_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_timezone_docopt_commands();
|
||||
void totp_cli_command_timezone_docopt_usage();
|
||||
void totp_cli_command_timezone_docopt_arguments();
|
||||
void totp_cli_command_timezone_docopt_arguments();
|
||||
#endif
|
||||
|
||||
@@ -107,6 +107,7 @@ static TotpIteratorUpdateTokenResult
|
||||
return TotpIteratorUpdateTokenResultSuccess;
|
||||
}
|
||||
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_update_docopt_commands() {
|
||||
TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_UPDATE " Update existing token\r\n");
|
||||
}
|
||||
@@ -129,6 +130,7 @@ void totp_cli_command_update_docopt_options() {
|
||||
TOTP_CLI_PRINTF(" " DOCOPT_SWITCH(
|
||||
TOTP_CLI_COMMAND_UPDATE_ARG_SECRET_PREFIX) " Update token secret\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void totp_cli_command_update_handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
|
||||
if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <cli/cli.h>
|
||||
#include "../../../types/plugin_state.h"
|
||||
#include "../../../config/app/config.h"
|
||||
|
||||
#define TOTP_CLI_COMMAND_UPDATE "update"
|
||||
|
||||
void totp_cli_command_update_handle(PluginState* plugin_state, FuriString* args, Cli* cli);
|
||||
#ifdef TOTP_CLI_RICH_HELP_ENABLED
|
||||
void totp_cli_command_update_docopt_commands();
|
||||
void totp_cli_command_update_docopt_usage();
|
||||
void totp_cli_command_update_docopt_options();
|
||||
void totp_cli_command_update_docopt_options();
|
||||
#endif
|
||||
Reference in New Issue
Block a user