Browse Source

Merge totp from https://github.com/xMasterX/all-the-plugins

Willy-JL 1 year ago
parent
commit
f8a5c9e0ec

+ 59 - 59
totp/assets/cli/cli_help.txt

@@ -1,59 +1,59 @@
-Usage:
-  totp (help | h | ?)
-  totp version
-  totp (list | ls)
-  totp (lsattr | cat) <index>
-  totp (add | mk | new) <name> [-t <type>] [-i <counter>] [-a <algo>] [-e <encoding>] [-d <digits>] [-l <duration>] [-u] [-b <feature>]...
-  totp (update) <index> [-t <type>] [-i <counter>] [-a <algo>] [-e <encoding>] [-n <name>] [-d <digits>] [-l <duration>] [-u] [-s] [-b <feature>]...
-  totp (delete | rm) <index> [-f]
-  totp (move | mv) <index> <new_index>
-  totp pin (set | remove) [-c <slot>]
-  totp notify [<notification>...]
-  totp (timezone | tz) [<timezone>]
-  totp reset
-  totp automation [-k <layout>] [-w <delay>] [<automation>...]
-  totp export
-
-Commands:
-  help, h, ?       Show command usage help
-  version          Get application version
-  list, ls         List all available tokens
-  lsattr, cat      Displays token details
-  add, mk, new     Add new token
-  update           Update existing token
-  delete, rm       Delete existing token
-  move, mv         Move token
-  pin              Set\change\remove PIN
-  notify           Get or set notification method
-  timezone, tz     Get or set current timezone
-  reset            Reset application to default settings
-  automation       Get or set automation settings
-  export           Exports and prints all the tokens into URI-list format
-
-Arguments:
-  name          Token name
-  index         Token index in the list
-  new_index     New token index in the list
-  notification  Notification method to be set. Must be one of: none, sound, vibro
-  timezone      Timezone offset in hours to be set
-  automation    Automation method to be set. Must be one of: none, usb, bt
-
-Options:
-  -t <type>      Token type. Must be one of: totp, hotp [default: totp]
-  -i <counter>   Token initial counter. Applicable for HOTP tokens only. Must be positive integer number [default: 0]
-  -a <algo>      Token hashing algorithm. Must be one of: sha1, sha256, sha512, steam [default: sha1]
-  -d <digits>    Token digits count. Must be one of: 5, 6, 8 [default: 6]
-  -e <encoding>  Token secret encoding, one of base32, base64 [default: base32]
-  -l <duration>  Token lifetime duration in seconds. Applicable for TOTP tokens only. Must be between: 15 and 255 [default: 30]
-  -u             Show console user input as-is without masking
-  -b <feature>   Token automation features to be enabled. Must be one of: none, enter, tab [default: none]
-                 # none - No features
-                 # enter - Type <Enter> key at the end of token input automation
-                 # tab - Type <Tab> key at the end of token input automation
-                 # slower - Type slower
-  -n <name>      Token name
-  -s             Update token secret
-  -f             Force command to do not ask user for interactive confirmation
-  -c <slot>      New crypto key slot. Must be between 12 and 100
-  -k <layout>    Automation keyboard layout. Must be one of: QWERTY, AZERTY, QWERTZ, Czech, Dvorak, Hungarian, Slovak
-  -w <delay>     Automation initial delay in seconds. Must be positive float value [default: 0.5]
+Usage:
+  totp (help | h | ?)
+  totp version
+  totp (list | ls)
+  totp (lsattr | cat) <index>
+  totp (add | mk | new) <name> [-t <type>] [-i <counter>] [-a <algo>] [-e <encoding>] [-d <digits>] [-l <duration>] [-u] [-b <feature>]...
+  totp (update) <index> [-t <type>] [-i <counter>] [-a <algo>] [-e <encoding>] [-n <name>] [-d <digits>] [-l <duration>] [-u] [-s] [-b <feature>]...
+  totp (delete | rm) <index> [-f]
+  totp (move | mv) <index> <new_index>
+  totp pin (set | remove) [-c <slot>]
+  totp notify [<notification>...]
+  totp (timezone | tz) [<timezone>]
+  totp reset
+  totp automation [-k <layout>] [-w <delay>] [<automation>...]
+  totp export
+
+Commands:
+  help, h, ?       Show command usage help
+  version          Get application version
+  list, ls         List all available tokens
+  lsattr, cat      Displays token details
+  add, mk, new     Add new token
+  update           Update existing token
+  delete, rm       Delete existing token
+  move, mv         Move token
+  pin              Set\change\remove PIN
+  notify           Get or set notification method
+  timezone, tz     Get or set current timezone
+  reset            Reset application to default settings
+  automation       Get or set automation settings
+  export           Exports and prints all the tokens into URI-list format
+
+Arguments:
+  name          Token name
+  index         Token index in the list
+  new_index     New token index in the list
+  notification  Notification method to be set. Must be one of: none, sound, vibro
+  timezone      Timezone offset in hours to be set
+  automation    Automation method to be set. Must be one of: none, usb, bt
+
+Options:
+  -t <type>      Token type. Must be one of: totp, hotp [default: totp]
+  -i <counter>   Token initial counter. Applicable for HOTP tokens only. Must be positive integer number [default: 0]
+  -a <algo>      Token hashing algorithm. Must be one of: sha1, sha256, sha512, steam [default: sha1]
+  -d <digits>    Token digits count. Must be one of: 5, 6, 8 [default: 6]
+  -e <encoding>  Token secret encoding, one of base32, base64 [default: base32]
+  -l <duration>  Token lifetime duration in seconds. Applicable for TOTP tokens only. Must be between: 15 and 255 [default: 30]
+  -u             Show console user input as-is without masking
+  -b <feature>   Token automation features to be enabled. Must be one of: none, enter, tab [default: none]
+                 # none - No features
+                 # enter - Type <Enter> key at the end of token input automation
+                 # tab - Type <Tab> key at the end of token input automation
+                 # slower - Type slower
+  -n <name>      Token name
+  -s             Update token secret
+  -f             Force command to do not ask user for interactive confirmation
+  -c <slot>      New crypto key slot. Must be between 12 and 100
+  -k <layout>    Automation keyboard layout. Must be one of: QWERTY, AZERTY, QWERTZ, Czech, Dvorak, Hungarian, Slovak
+  -w <delay>     Automation initial delay in seconds. Must be positive float value [default: 0.5]

+ 4 - 8
totp/services/config/config.c

@@ -738,19 +738,15 @@ bool totp_config_file_ensure_latest_encryption(
     uint8_t pin_length) {
     bool result = true;
     if(plugin_state->crypto_settings.crypto_version < CRYPTO_LATEST_VERSION) {
-        FURI_LOG_I(
-            LOGGING_TAG,
-            "Migration crypto from v%" PRIu8 " to v%" PRIu8 " is needed",
-            plugin_state->crypto_settings.crypto_version,
-            CRYPTO_LATEST_VERSION);
-
+        FURI_LOG_I(LOGGING_TAG, "Migration crypto from v%" PRIu8 " to v%" PRIu8 " is needed", plugin_state->crypto_settings.crypto_version, CRYPTO_LATEST_VERSION);
+        
 #ifndef TOTP_OBSOLETE_CRYPTO_V1_COMPATIBILITY_ENABLED
-        if(plugin_state->crypto_settings.crypto_version == 1) {
+        if (plugin_state->crypto_settings.crypto_version == 1) {
             furi_crash("Authenticator: Crypto v1 is not supported");
         }
 #endif
 #ifndef TOTP_OBSOLETE_CRYPTO_V2_COMPATIBILITY_ENABLED
-        if(plugin_state->crypto_settings.crypto_version == 2) {
+        if (plugin_state->crypto_settings.crypto_version == 2) {
             furi_crash("Authenticator: Crypto v2 is not supported");
         }
 #endif

+ 1 - 1
totp/services/idle_timeout/idle_timeout.c

@@ -3,7 +3,7 @@
 #include <furi/core/timer.h>
 
 #define IDLE_TIMER_CHECK_PERIODICITY_SEC (1)
-#define SEC_TO_TICKS(sec) ((sec) * 1000)
+#define SEC_TO_TICKS(sec) ((sec)*1000)
 
 struct IdleTimeoutContext {
     FuriTimer* timer;

+ 2 - 2
totp/types/token_info.c

@@ -8,8 +8,8 @@
 #include "common.h"
 #include "../services/crypto/crypto_facade.h"
 
-#define ESTIMATE_BASE32_PLAIN_LENGTH(base32_length) ((base32_length) * 0.625f)
-#define ESTIMATE_BASE64_PLAIN_LENGTH(base64_length) ((base64_length) * 0.75f)
+#define ESTIMATE_BASE32_PLAIN_LENGTH(base32_length) ((base32_length)*0.625f)
+#define ESTIMATE_BASE64_PLAIN_LENGTH(base64_length) ((base64_length)*0.75f)
 
 TokenInfo* token_info_alloc() {
     TokenInfo* tokenInfo = malloc(sizeof(TokenInfo));