Przeglądaj źródła

Add '.modules/totp/' from commit 'c82f5d869ad234d2e6f0b66cf381c5910e4487ec'

git-subtree-dir: .modules/totp
git-subtree-mainline: 45dfa5bf90e027622e9a7ce1029b7a866303ee91
git-subtree-split: c82f5d869ad234d2e6f0b66cf381c5910e4487ec
Willy-JL 2 lat temu
rodzic
commit
6eb23550f9
100 zmienionych plików z 4560 dodań i 0 usunięć
  1. 20 0
      .modules/totp/.editorconfig
  2. 4 0
      .modules/totp/.gitattributes
  3. 5 0
      .modules/totp/.github/FUNDING.yml
  4. 31 0
      .modules/totp/.github/ISSUE_TEMPLATE/bug_report.md
  5. 20 0
      .modules/totp/.github/ISSUE_TEMPLATE/feature_request.md
  6. 13 0
      .modules/totp/.github/release-body.md
  7. 35 0
      .modules/totp/.github/workflows/auto-clang-format.yml
  8. 79 0
      .modules/totp/.github/workflows/create-new-release.yml
  9. 53 0
      .modules/totp/.github/workflows/pvsstudio.yml
  10. 39 0
      .modules/totp/.github/workflows/sonarcloud.yml
  11. 62 0
      .modules/totp/.gitignore
  12. 4 0
      .modules/totp/.gitmodules
  13. 2 0
      .modules/totp/.pvsconfig
  14. 1 0
      .modules/totp/.pvsoptions
  15. 674 0
      .modules/totp/LICENSE
  16. 48 0
      .modules/totp/README.md
  17. 15 0
      .modules/totp/SECURITY.md
  18. 103 0
      .modules/totp/build.ps1
  19. 9 0
      .modules/totp/clang-format-all.ps1
  20. BIN
      .modules/totp/docs/assets/custom_font_712_serif.png
  21. BIN
      .modules/totp/docs/assets/custom_font_bedstead.png
  22. BIN
      .modules/totp/docs/assets/custom_font_dpcomic.png
  23. BIN
      .modules/totp/docs/assets/custom_font_funclimbing.png
  24. BIN
      .modules/totp/docs/assets/custom_font_graph35pix.png
  25. BIN
      .modules/totp/docs/assets/custom_font_karma_future.png
  26. BIN
      .modules/totp/docs/assets/custom_font_pixelflag.png
  27. BIN
      .modules/totp/docs/assets/custom_font_redhat_mono.png
  28. BIN
      .modules/totp/docs/assets/custom_font_zector.png
  29. BIN
      .modules/totp/docs/assets/screenshot_1.png
  30. 336 0
      .modules/totp/docs/conf-file_description.md
  31. 113 0
      .modules/totp/docs/firmwares.schema.json
  32. 38 0
      .modules/totp/firmwares.json
  33. 64 0
      .modules/totp/generate-font.ps1
  34. 16 0
      .modules/totp/sonar-project.properties
  35. 191 0
      .modules/totp/totp/.clang-format
  36. BIN
      .modules/totp/totp/.flipcorg/banner.png
  37. BIN
      .modules/totp/totp/.flipcorg/gallery/1.png
  38. BIN
      .modules/totp/totp/.flipcorg/gallery/2.png
  39. BIN
      .modules/totp/totp/.flipcorg/gallery/3.png
  40. BIN
      .modules/totp/totp/.flipcorg/gallery/4.png
  41. BIN
      .modules/totp/totp/.flipcorg/gallery/5.png
  42. BIN
      .modules/totp/totp/.flipcorg/gallery/6.png
  43. BIN
      .modules/totp/totp/.flipcorg/gallery/7.png
  44. 13 0
      .modules/totp/totp/app_api_interface.h
  45. 19 0
      .modules/totp/totp/app_api_table.cpp
  46. 68 0
      .modules/totp/totp/app_api_table_i.h
  47. 171 0
      .modules/totp/totp/application.fam
  48. 57 0
      .modules/totp/totp/assets/cli/cli_help.txt
  49. BIN
      .modules/totp/totp/assets/fonts/00.font
  50. BIN
      .modules/totp/totp/assets/fonts/01.font
  51. BIN
      .modules/totp/totp/assets/fonts/02.font
  52. BIN
      .modules/totp/totp/assets/fonts/03.font
  53. BIN
      .modules/totp/totp/assets/fonts/04.font
  54. BIN
      .modules/totp/totp/assets/fonts/05.font
  55. BIN
      .modules/totp/totp/assets/fonts/06.font
  56. BIN
      .modules/totp/totp/assets/fonts/07.font
  57. BIN
      .modules/totp/totp/assets/fonts/08.font
  58. BIN
      .modules/totp/totp/assets/fonts/09.font
  59. 175 0
      .modules/totp/totp/cli/cli.c
  60. 19 0
      .modules/totp/totp/cli/cli.h
  61. 65 0
      .modules/totp/totp/cli/cli_helpers.h
  62. 13 0
      .modules/totp/totp/cli/cli_plugin_interface.h
  63. 95 0
      .modules/totp/totp/cli/cli_shared_methods.c
  64. 62 0
      .modules/totp/totp/cli/cli_shared_methods.h
  65. 173 0
      .modules/totp/totp/cli/plugins/automation/automation.c
  66. 4 0
      .modules/totp/totp/cli/plugins/automation/meta.h
  67. 95 0
      .modules/totp/totp/cli/plugins/delete/delete.c
  68. 5 0
      .modules/totp/totp/cli/plugins/delete/meta.h
  69. 140 0
      .modules/totp/totp/cli/plugins/details/details.c
  70. 37 0
      .modules/totp/totp/cli/plugins/details/formatters/table/details_output_formatter_table.c
  71. 16 0
      .modules/totp/totp/cli/plugins/details/formatters/table/details_output_formatter_table.h
  72. 34 0
      .modules/totp/totp/cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c
  73. 16 0
      .modules/totp/totp/cli/plugins/details/formatters/tsv/details_output_formatter_tsv.h
  74. 5 0
      .modules/totp/totp/cli/plugins/details/meta.h
  75. 42 0
      .modules/totp/totp/cli/plugins/help/help.c
  76. 6 0
      .modules/totp/totp/cli/plugins/help/meta.h
  77. 23 0
      .modules/totp/totp/cli/plugins/list/formatters/table/list_output_formatter_table.c
  78. 9 0
      .modules/totp/totp/cli/plugins/list/formatters/table/list_output_formatter_table.h
  79. 20 0
      .modules/totp/totp/cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c
  80. 9 0
      .modules/totp/totp/cli/plugins/list/formatters/tsv/list_output_formatter_tsv.h
  81. 82 0
      .modules/totp/totp/cli/plugins/list/list.c
  82. 5 0
      .modules/totp/totp/cli/plugins/list/meta.h
  83. 128 0
      .modules/totp/totp/cli/plugins/modify/add/add.c
  84. 6 0
      .modules/totp/totp/cli/plugins/modify/add/meta.h
  85. 182 0
      .modules/totp/totp/cli/plugins/modify/common.c
  86. 124 0
      .modules/totp/totp/cli/plugins/modify/common.h
  87. 4 0
      .modules/totp/totp/cli/plugins/modify/update/meta.h
  88. 167 0
      .modules/totp/totp/cli/plugins/modify/update/update.c
  89. 5 0
      .modules/totp/totp/cli/plugins/move/meta.h
  90. 75 0
      .modules/totp/totp/cli/plugins/move/move.c
  91. 4 0
      .modules/totp/totp/cli/plugins/notification/meta.h
  92. 97 0
      .modules/totp/totp/cli/plugins/notification/notification.c
  93. 4 0
      .modules/totp/totp/cli/plugins/pin/meta.h
  94. 179 0
      .modules/totp/totp/cli/plugins/pin/pin.c
  95. 4 0
      .modules/totp/totp/cli/plugins/reset/meta.h
  96. 43 0
      .modules/totp/totp/cli/plugins/reset/reset.c
  97. 5 0
      .modules/totp/totp/cli/plugins/timezone/meta.h
  98. 49 0
      .modules/totp/totp/cli/plugins/timezone/timezone.c
  99. 4 0
      .modules/totp/totp/cli/plugins/version/meta.h
  100. 27 0
      .modules/totp/totp/cli/plugins/version/version.c

+ 20 - 0
.modules/totp/.editorconfig

@@ -0,0 +1,20 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+
+[*.{cpp,h,c,py,sh}]
+indent_style = space
+indent_size = 4
+
+[*.json]
+indent_style = space
+indent_size = 2
+
+[{Makefile,*.mk}]
+indent_size = tab
+
+[totp/assets/cli/cli_help.txt]
+end_of_line = crlf

+ 4 - 0
.modules/totp/.gitattributes

@@ -0,0 +1,4 @@
+* text=auto eol=lf
+*.bat eol=crlf
+*.ps1 eol=crlf
+*.cmd eol=crlf

+ 5 - 0
.modules/totp/.github/FUNDING.yml

@@ -0,0 +1,5 @@
+# These are supported funding model platforms
+
+patreon: akopachov
+ko_fi: akopachov
+custom: ["https://www.buymeacoffee.com/mijumoho", "https://donorbox.org/flipper-authenticator", "https://buycoffee.to/akopachov"]

+ 31 - 0
.modules/totp/.github/ISSUE_TEMPLATE/bug_report.md

@@ -0,0 +1,31 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: "[BUG]"
+labels: ''
+assignees: akopachov
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Select '....'
+3. Click on '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Device information (please complete the following information):**
+ - Firmware: [e.g. Official stable]
+ - Firmware version [e.g. 0.67]
+
+**Additional context**
+Add any other context about the problem here.

+ 20 - 0
.modules/totp/.github/ISSUE_TEMPLATE/feature_request.md

@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: "[FEATURE]"
+labels: ''
+assignees: akopachov
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.

+ 13 - 0
.modules/totp/.github/release-body.md

@@ -0,0 +1,13 @@
+## Changes
+
+* TODO
+
+## Please support development of the project
+
+* Buy me a coffee [here](https://ko-fi.com/akopachov), [here](https://www.buymeacoffee.com/mijumoho), [here](https://donorbox.org/flipper-authenticator) or [here](https://buycoffee.to/akopachov)
+* Become a patron at [Patreon](https://patreon.com/akopachov)
+* BTC: `bc1qu9k48q93uhvr9w5cn8fzz5yxuvh4e27c6hnczq`
+* ETH: `0xa12163eD56e35d3B38F7087B573384E40b2785e1`
+* USDT: `0xa12163eD56e35d3B38F7087B573384E40b2785e1`
+* DOGE: `DAa3nu1RCWwxZdAnGVga77bgxDFP1nhahj`
+* TON: `EQCSBzoTb1B7RhXnka5RegmdjHR3gQwRVgZHNPPqzjjvlW9T`

+ 35 - 0
.modules/totp/.github/workflows/auto-clang-format.yml

@@ -0,0 +1,35 @@
+name: Auto CLang format
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened]
+    branches: ['master']
+
+jobs:
+  clang-format:
+    runs-on: ubuntu-latest
+
+    permissions:
+      contents: write
+
+    steps:
+    - uses: actions/checkout@v3
+      with:
+        fetch-depth: 0
+        ref: ${{ github.head_ref }}
+
+    - name: Get last commit on ${{ github.base_ref }} branch
+      run: echo "BASE_HEAD_REF=$(git rev-parse origin/${{ github.base_ref }})" >> $GITHUB_ENV
+
+    - uses: akopachov/git-clang-format-diff-action@v1.0.0
+      with:
+        style: file
+        commit: ${{ env.BASE_HEAD_REF }}
+
+    - name: Update Permissions
+      run: sudo chown --recursive $USER .
+
+    - uses: stefanzweifel/git-auto-commit-action@v4.16.0
+      with:
+        commit_message: CLang format changes
+        branch: ${{ github.head_ref }}

+ 79 - 0
.modules/totp/.github/workflows/create-new-release.yml

@@ -0,0 +1,79 @@
+name: Create new release
+
+on:
+  workflow_dispatch:
+    inputs:
+      new_version:
+        description: 'New version'
+        required: true
+        type: string
+
+jobs:
+  set-new-version:
+    runs-on: ubuntu-latest
+    outputs:
+      commit_hash: ${{steps.commit_new_version.outputs.commit_hash}}
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Set new version format
+        run: |
+          if [[ "${{ inputs.new_version }}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; 
+          then 
+            echo "New version looks okay";
+            MAJOR="${BASH_REMATCH[1]}"
+            MINOR="${BASH_REMATCH[2]}"
+            PATCH="${BASH_REMATCH[3]}"
+            sed -r -i "s/TOTP_APP_VERSION_MAJOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MAJOR ($MAJOR)/g" totp/version.h
+            sed -r -i "s/TOTP_APP_VERSION_MINOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MINOR ($MINOR)/g" totp/version.h
+            sed -r -i "s/TOTP_APP_VERSION_PATCH\\s+\\([0-9]+\\)/TOTP_APP_VERSION_PATCH ($PATCH)/g" totp/version.h
+            sed -r -i "s/fap_version=\"[0-9]+\\.[0-9]+\"/fap_version=\"$MAJOR.$MINOR$PATCH\"/g" totp/application.fam
+          else 
+            echo "Invalid version format";
+            exit 1
+          fi
+
+      - id: commit_new_version
+        uses: stefanzweifel/git-auto-commit-action@v4.16.0
+        with:
+          commit_message: Updated version
+          push_options: '--force'
+
+  build:
+    runs-on: ubuntu-latest
+    needs: set-new-version
+    env:
+      FBT_NO_SYNC: "true"
+      TARGETS: f7
+      DEFAULT_TARGET: f7
+    
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: "${{needs.set-new-version.outputs.commit_hash}}"
+          fetch-depth: 0
+          submodules: 'recursive'
+
+      - name: Install Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
+      
+      - name: Install uFBT
+        run: python3 -m pip install --upgrade ufbt
+
+      - name: Build
+        run: ./build.ps1
+        shell: pwsh
+
+      - uses: ncipollo/release-action@v1.12.0
+        with:
+          artifacts: "build/*.zip,build/checksums.sha256"
+          bodyFile: ".github/release-body.md"
+          artifactErrorsFailBuild: true
+          updateOnlyUnreleased: true
+          allowUpdates: true
+          removeArtifacts: true
+          draft: true
+          tag: "v${{ inputs.new_version }}"
+          commit: "${{needs.set-new-version.outputs.commit_hash}}"

+ 53 - 0
.modules/totp/.github/workflows/pvsstudio.yml

@@ -0,0 +1,53 @@
+name: PVS-Studio build analysis
+on:
+  workflow_dispatch:
+  pull_request:
+    types: [opened, synchronize, reopened]
+    branches: ['master']
+jobs:
+  build-analyze:
+    runs-on: ubuntu-latest
+    env:
+      FBT_NO_SYNC: "true"
+      TARGETS: f7
+      DEFAULT_TARGET: f7
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
+          submodules: 'recursive'
+      - name: Install tools
+        run: |
+          wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt \
+            | sudo apt-key add -
+          sudo wget -O /etc/apt/sources.list.d/viva64.list \
+            https://files.pvs-studio.com/etc/viva64.list
+          sudo apt update
+          sudo apt install pvs-studio
+          pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
+
+      - name: Install Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
+      
+      - name: Install uFBT
+        run: python3 -m pip install --upgrade ufbt
+
+      - name: Build
+        shell: pwsh
+        run: ./ufbt.ps1 x --clean
+          
+      - name: Analyze
+        run: |
+          pvs-studio-analyzer analyze @.pvsoptions -f totp/.vscode/compile_commands.json -j -o PVS-Studio.log
+      - name: Convert report
+        run: |
+          plog-converter -t sarif -o pvs-report.sarif PVS-Studio.log
+          sed -i 's/"results": null/"results": []/g' pvs-report.sarif
+          sed -i 's/"rules": null/"rules": []/g' pvs-report.sarif
+      - name: Publish report
+        uses: github/codeql-action/upload-sarif@v2
+        with:
+          sarif_file: pvs-report.sarif
+          category: PVS-Studio

+ 39 - 0
.modules/totp/.github/workflows/sonarcloud.yml

@@ -0,0 +1,39 @@
+name: SonarCloud
+on:
+  workflow_dispatch:
+  pull_request:
+    types: [opened, synchronize, reopened]
+    branches: ['master']
+jobs:
+  build:
+    name: Build and analyze
+    runs-on: ubuntu-latest
+    env:
+      BUILD_WRAPPER_OUT_DIR: "$HOME/build_wrapper_output" # Directory where build-wrapper output will be placed
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
+          submodules: 'recursive'
+
+      - name: Install sonar-scanner and build-wrapper
+        uses: SonarSource/sonarcloud-github-c-cpp@v2.0.1
+
+      - name: Install Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
+      
+      - name: Install uFBT
+        run: python3 -m pip install --upgrade ufbt
+
+      - name: Build
+        shell: pwsh
+        run: ./ufbt.ps1 x --clean
+
+      - name: Run sonar-scanner
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        run: |
+          sonar-scanner --define sonar.cfamily.compile-commands="totp/.vscode/compile_commands.json"

+ 62 - 0
.modules/totp/.gitignore

@@ -0,0 +1,62 @@
+*.swp
+*.gdb_history
+
+
+# LSP
+.cache
+compile_commands.json
+
+# JetBrains IDEs
+.idea/
+
+# Python VirtEnvironments
+.env
+.venv
+env/
+venv/
+
+# Python Byte-compiled / optimized files
+__pycache__/
+*.py[cod]
+*$py.class
+*.pickle
+
+.obj/
+bindings/
+.DS_Store
+.mxproject
+Brewfile.lock.json
+
+# Visual Studio Code
+.vscode/
+
+# legendary cmake's
+build
+CMakeLists.txt
+
+# bundle output
+dist
+
+# kde
+.directory
+null.d
+
+# SCons
+.sconsign.dblite
+# SCons build dir
+build/
+
+# Toolchain
+/toolchain
+
+# openocd output file
+openocd.log
+
+# PVS Studio temporary files
+.PVS-Studio/
+PVS-Studio.log
+
+totp/dist/*
+totp/config/app/ufbt_def.h
+.vscode
+.clang-format

+ 4 - 0
.modules/totp/.gitmodules

@@ -0,0 +1,4 @@
+[submodule "totp/lib/wolfssl"]
+	path = totp/lib/wolfssl
+	url = https://github.com/wolfSSL/wolfssl.git
+	branch = master

+ 2 - 0
.modules/totp/.pvsconfig

@@ -0,0 +1,2 @@
+# Warning about headers with copyleft license
+//-V::1042

+ 1 - 0
.modules/totp/.pvsoptions

@@ -0,0 +1 @@
+--rules-config .pvsconfig -e totp/lib/wolfssl -e ~/.ufbt

+ 674 - 0
.modules/totp/LICENSE

@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and`show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 48 - 0
.modules/totp/README.md

@@ -0,0 +1,48 @@
+# Flipper Authenticator
+
+[![GitHub release](https://img.shields.io/github/release/akopachov/flipper-zero_authenticator?include_prereleases=&sort=semver&color=blue)](https://github.com/akopachov/flipper-zero_authenticator/releases/)
+[![License](https://img.shields.io/github/license/akopachov/flipper-zero_authenticator)](/LICENSE)
+[![issues - flipper-zero_authenticator](https://img.shields.io/github/issues/akopachov/flipper-zero_authenticator)](https://github.com/akopachov/flipper-zero_authenticator/issues)
+![maintained - yes](https://img.shields.io/badge/maintained-yes-blue)
+![contributions - welcome](https://img.shields.io/badge/contributions-welcome-blue)
+[![Discord server](https://img.shields.io/discord/937479784148115456)](https://discord.gg/flipper-xtreme)
+[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=akopachov_flipper-zero_authenticator&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=akopachov_flipper-zero_authenticator)
+[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=akopachov_flipper-zero_authenticator&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=akopachov_flipper-zero_authenticator)
+[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=akopachov_flipper-zero_authenticator&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=akopachov_flipper-zero_authenticator)
+[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=akopachov_flipper-zero_authenticator&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=akopachov_flipper-zero_authenticator)
+
+![Screenshot](docs/assets/screenshot_1.png)
+
+## Description
+
+Flipper Authenticator is a software-based authenticator that implements multi-factor authentication services using the time-based one-time password (TOTP; specified in [RFC 6238](https://www.rfc-editor.org/rfc/rfc6238)) and HMAC-based One-time Password algorithm (HOTP; specified in [RFC 4226](https://www.rfc-editor.org/rfc/rfc4226)), for authenticating users of software applications.
+
+It is like [Google Authenticator](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2), but for [Flipper Zero](https://flipperzero.one/) device.
+
+## Companion app
+
+There is a companion app for desktop allowing you to interract with Flipper Authenticator in a more user-friendly way. Latest builds as well as all the information about it can be found in its official repo [here](https://github.com/akopachov/flipper-zero_authenticator-companion)
+
+## SAST Tools
+
+[PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=github&utm_medium=organic&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.
+
+[SonarCloud](https://www.sonarsource.com/products/sonarcloud/) - cloud-based code quality and security service
+
+## Support
+
+* Buy me a coffee [here](https://ko-fi.com/akopachov), [here](https://www.buymeacoffee.com/mijumoho), [here](https://donorbox.org/flipper-authenticator) or [here](https://buycoffee.to/akopachov)
+* Become a patron at [Patreon](https://patreon.com/akopachov)
+* BTC: `bc1qu9k48q93uhvr9w5cn8fzz5yxuvh4e27c6hnczq`
+* ETH: `0xa12163eD56e35d3B38F7087B573384E40b2785e1`
+* USDT: `0xa12163eD56e35d3B38F7087B573384E40b2785e1`
+* DOGE: `DAa3nu1RCWwxZdAnGVga77bgxDFP1nhahj`
+* TON: `EQCSBzoTb1B7RhXnka5RegmdjHR3gQwRVgZHNPPqzjjvlW9T`
+
+## Have questions?
+
+Checkout [FAQ](https://github.com/akopachov/flipper-zero_authenticator/wiki/FAQ) or ask in [Discord server](https://discord.gg/flipper-xtreme)
+
+## Looking for better Flipper Zero Firmware?
+
+You will find it on this [Discord server](https://discord.gg/flipper-xtreme)

+ 15 - 0
.modules/totp/SECURITY.md

@@ -0,0 +1,15 @@
+# Security Policy
+
+## Supported Versions
+
+We release patches for security vulnerabilities. Latest version only is eligible for receiving such a patches.
+
+| Version | Supported          |
+| ------- | ------------------ |
+| latest   | :white_check_mark: |
+| < latest | :x:                |
+
+## Reporting a Vulnerability
+
+Please report (suspected) security vulnerabilities to [alex.kopachov@gmail.com](mailto:alex.kopachov@gmail.com).
+You will receive a response from us as soon as possible. If the issue is confirmed, we will release a patch as soon as possible depending on complexity.

+ 103 - 0
.modules/totp/build.ps1

@@ -0,0 +1,103 @@
+param (
+    [switch]$doNotClearBuildFolder = $false
+)
+
+$build_commands = @(
+    [PSCustomObject]@{
+        Name         = "Official Dev";
+        FbtSwitch    = "od";
+        ArtifactName = "totp_official-dev_fw{FEATURES_SUFFIX}.zip";
+    }
+    [PSCustomObject]@{
+        Name         = "Official Stable";
+        FbtSwitch    = "os";
+        ArtifactName = "totp_official-stable_fw{FEATURES_SUFFIX}.zip";
+    }
+    [PSCustomObject]@{
+        Name         = "Xtreme \ Unleashed";
+        FbtSwitch    = "x";
+        ArtifactName = "totp_xtreme_unleashed_fw{FEATURES_SUFFIX}.zip";
+    }
+)
+
+Push-Location $PSScriptRoot
+
+if (!(Test-Path -PathType Container "build")) {
+    New-Item -ItemType Directory -Path "build"
+}
+elseif (!$doNotClearBuildFolder) {
+    Remove-Item "build/*" -Recurse -Force
+}
+
+function Build-Run {
+    param (
+        [string]$FeaturesSuffix,
+        [string[]]$CppDefine,
+        [string]$Subfolder
+    )
+
+    foreach ($build_command in $build_commands) {
+        Write-Host "Building $($build_command.Name)"
+        $build_path = Join-Path -Path $PSScriptRoot -ChildPath "totp/dist"
+
+        $fbt_args = @($build_command.FbtSwitch, "--clean")
+        if ($CppDefine.Length -gt 0) {
+            $CppDefine | ForEach-Object {
+                $fbt_args += '-D'
+                $fbt_args += $_
+            }
+        }
+
+        Invoke-Expression -Command "./ufbt.ps1 $fbt_args"
+
+        $build_output_folder = "build"
+        if ($Subfolder -ne $null -and $Subfolder -ne '') {
+            $build_output_folder = Join-Path $build_output_folder $Subfolder
+            if (!(Test-Path -PathType Container $build_output_folder)) {
+                New-Item -ItemType Directory -Path $build_output_folder
+            }
+        }
+
+        $build_output_artifact = Join-Path $build_output_folder "$($build_command.ArtifactName -replace '{FEATURES_SUFFIX}',$FeaturesSuffix)"
+
+        $zip_folder = Join-Path $build_output_folder ".zip"
+        if (!(Test-Path -PathType Container $zip_folder)) {
+            New-Item -ItemType Directory -Path $zip_folder
+        }
+        elseif (!$doNotClearBuildFolder) {
+            Remove-Item "$zip_folder/*" -Recurse -Force
+        }
+
+        $zip_app_folder = Join-Path $zip_folder "apps/Tools"
+        New-Item $zip_app_folder -ItemType Directory -Force
+
+        Copy-Item "$build_path/totp.fap" -Destination $zip_app_folder
+
+        $zip_plugins_folder = Join-Path $zip_folder "apps_data/totp/plugins"
+        New-Item $zip_plugins_folder -ItemType Directory -Force
+
+        Copy-Item "$build_path/*.fal" -Destination $zip_plugins_folder
+
+        Compress-Archive -Path "$zip_folder/*" -DestinationPath $build_output_artifact
+
+        Remove-Item $zip_folder -Recurse -Force
+
+        Write-Host "Artifacts for `"$($build_command.Name)`" stored at `"$build_output_artifact`""
+    }
+}
+
+Write-Information 'Building with all the features enables'
+Build-Run -FeaturesSuffix ''
+
+Write-Information 'Building without BadBT'
+Build-Run -FeaturesSuffix '_no-badbt' -CppDefine TOTP_NO_BADBT_AUTOMATION
+
+$checksum_file = 'build/checksums.sha256'
+New-Item $checksum_file -ItemType File -Force
+Get-ChildItem -Path 'build/*.zip' | ForEach-Object {
+    $checksum = (Get-FileHash $_ -Algorithm SHA256).Hash.ToLower()
+    $filename = $_.Name
+    "$checksum  $filename" >> $checksum_file
+}
+
+Pop-Location

+ 9 - 0
.modules/totp/clang-format-all.ps1

@@ -0,0 +1,9 @@
+$clang_format = Join-Path -Path $PSScriptRoot -ChildPath "flipperzero-firmware_official_dev/toolchain/x86_64-windows/bin/clang-format.exe"
+Push-Location $PSScriptRoot
+Get-ChildItem -Path "totp" -File -Recurse -Include "*.c", "*.h" | ForEach-Object {
+    if (!($_.FullName -like '*wolfssl*')) {
+        Write-Host "Formatting $($_.FullName)"
+        & $clang_format -i -style=file $_.FullName
+    }
+}
+Pop-Location

BIN
.modules/totp/docs/assets/custom_font_712_serif.png


BIN
.modules/totp/docs/assets/custom_font_bedstead.png


BIN
.modules/totp/docs/assets/custom_font_dpcomic.png


BIN
.modules/totp/docs/assets/custom_font_funclimbing.png


BIN
.modules/totp/docs/assets/custom_font_graph35pix.png


BIN
.modules/totp/docs/assets/custom_font_karma_future.png


BIN
.modules/totp/docs/assets/custom_font_pixelflag.png


BIN
.modules/totp/docs/assets/custom_font_redhat_mono.png


BIN
.modules/totp/docs/assets/custom_font_zector.png


BIN
.modules/totp/docs/assets/screenshot_1.png


+ 336 - 0
.modules/totp/docs/conf-file_description.md

@@ -0,0 +1,336 @@
+# Flipper Authenticator config file description
+
+By default Flipper Authenticator stores all its settings in `/ext/apps_data/totp/totp.conf` file.
+
+File format is standard for Flipper Zero device. Each line has one setting identified by key, where key and value are separated by `:` symbol.
+
+## Available keys
+
+<details>
+<summary><h3 style="display: inline">Filetype</h3></summary>
+<p>
+
+**Type:** const string
+
+**Description:** File type definition. Used internally. Should not be updated manually
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">Version</h3></summary>
+<p>
+
+**Type:** const unsigned int
+
+**Description:** File version. Used internally. Should not be updated manually.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">CryptoVersion</h3></summary>
+<p>
+
+**Type:** const unsigned int
+
+**Description:** Cryptographic algorithms version used for encryption\decryption. Should not be updated manually.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">CryptoKeySlot</h3></summary>
+<p>
+
+**Type:** const unsigned int
+
+**Description:** Key vault slot to be used for encryption\decryption. Should not be updated manually, instead CLI should be used to update encryption parameters.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">BaseIV</h3></summary>
+<p>
+
+**Type:** array of bytes
+
+**Default value:** none
+
+**Description:** Initialization vector (IV) base seed which is getting generated randomly at first app start. It is used to setup encryption subsytem. Should not be updated manually.
+
+**Important note:** changing or loosing this value will lead to incorrect decryption of all the encrypted data in the application and as a result it will not be possible to generate valid OTP tokens
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">Crypto</h3></summary>
+<p>
+
+**Type:** array of bytes
+
+**Default value:** none
+
+**Description:** Used internally to verify user's PIN and\or file consistency. Should not be changed manually.
+
+**Important note:** changing or loosing this value will lead to incorrect PIN verification and it will not be possible to signin into app
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">Timezone</h3></summary>
+<p>
+
+**Type:** float
+
+**Default value:** 0.000000
+
+**Description:** Timezone offset **in hours**. Need to be modified manually. Because of Flipper Zero API doesn't provide an access to timezone offset it is necessary to set it manually for correct TOTP tokens generation. You may find your timezone offset (or another name is "UTC offset") [here](https://www.utctime.net/time-zone-abbreviations), [here](https://time.is/) or on any other website found in [google](https://letmegooglethat.com/?q=What+is+my+timezone+offset).
+
+**Important note:** if your timezone offset is negative, use negative sign, like this `-2.0`, however if your timezone offset is positive DO NOT use explicit positive sign, just put offset without any sign like this `2.0`
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">PinIsSet</h3></summary>
+<p>
+
+**Type:** bool
+
+**Default value:** none
+
+**Description:** Used internally to identify whether user set PIN or not. Should not be changed manually.
+
+**Important note:** changing or loosing this value will lead to incorrect PIN verification and it will not be possible to signin into app
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">NotificationMethod</h3></summary>
+<p>
+
+**Type:** enum (available options are `0`, `1`, `2`, `3`)
+
+**Default value:** `3`
+
+**Description:** How to notify user when new token is generated or badusb mode is activated. Possible values are:
+
+* `0` - do not notify
+* `1` - notify using sound only
+* `2` - notify using vibro only
+* `3` - notify using sound and vibro
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">AutomationMethod</h3></summary>
+<p>
+
+**Type:** enum (available options are `0`, `1`, `2`, `3`)
+
+**Default value:** `1`
+
+**Description:** Which OTP code input automation method is enabled for the user. Possible values are:
+
+* `0` - none
+* `1` - USB - application will represent itself as an USB keyboard and type current code (BadUSB)
+* `2` - Bluetooth - application will represent itself as an Bluetooth keyboard and type current code (BadBT)
+* `3` - USB and Bluetooth
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">Font</h3></summary>
+<p>
+
+**Type:** enum (available options are `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`)
+
+**Default value:** `7`
+
+**Description:** Font index to be used to display token. Can be modified manually.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">AutomationKbLayout</h3></summary>
+<p>
+
+**Type:** enum (available options are `0`, `1`)
+
+**Default value:** `0`
+
+**Description:** Keyboard layout index to be used during token input automation. Can be modified manually.
+
+* `0` - QWERTY
+* `1` - AZERTY
+* `3` - QWERTZ
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenName</h3></summary>
+<p>
+
+**Type:** string
+
+**Default value:** none
+
+**Description:** Token name which will be visible in the UI and used just to let user identify token. Can be modified manually.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenSecret</h3></summary>
+<p>
+
+**Type:** array of bytes OR string
+
+**Default value:** none
+
+**Description:** Token secret. It can be either an array of encrypted bytes OR pure unencrypted token secret.
+
+**Important note:** if app finds pure unencrypted token in config file app will encrypt it and replace in a config file for security purposes
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenAlgo</h3></summary>
+<p>
+
+**Type:** enum (available options are: `0`, `1`, `2`, `3`)
+
+**Default value:** `0`
+
+**Description:** Token hashing algorithm to be used to generate OTP code. If you don't know which one to use - use `0`.
+
+* `0` - `SHA1`
+* `1` - `SHA256`
+* `2` - `SHA512`
+* `3` - `STEAM`
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenDigits</h3></summary>
+<p>
+
+**Type:** enum (available options are `6` and `8`)
+
+**Default value:** `6`
+
+**Description:** Defines OTP code length. If you don't know which to use - use `6` as majority of websites requires 6-digits code.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenDuration</h3></summary>
+<p>
+
+**Type:** unsigned int
+
+**Default value:** `30`
+
+**Description:** Token lifetime duration in seconds. Applicable for TOTP tokens only. Should be between `15` and `255`. Majority websites requires `30`, however some rare websites may require custom lifetime. If you are not sure which one to use - use `30`.
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenAutomationFeatures</h3></summary>
+<p>
+
+**Type:** unsigned int
+
+**Default value:** `0` (no features enabled)
+
+**Description:** Token automation features. Meaningful bits:
+
+* Bit 1 - if set, token input automation will type \<ENTER\> key at the end of automation
+* Bit 2 - if set, token input automation will type \<TAB\> key at the end of automation
+* Bit 3 - if set, token input automation will type slower
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenType</h3></summary>
+<p>
+
+**Type:** enum (available options are `0` and `1`)
+
+**Default value:** `0` (Time-based token, TOTP)
+
+**Description:** Token type.
+
+* `0` - Time-based (TOTP)
+* `1` - Counter-based (HOTP)
+
+</p>
+</details>
+
+<details>
+<summary><h3 style="display: inline">TokenCounter</h3></summary>
+<p>
+
+**Type:** unsigned int
+
+**Default value:** `0`
+
+**Description:** Token counter. Applicable for HOTP tokens only.
+
+</p>
+</details>
+
+## Example config file
+
+```text
+Filetype: Flipper TOTP plugin config file
+Version: 10
+CryptoVersion: 2
+CryptoKeySlot: 12
+BaseIV: 71 88 EF D4 F0 3E 40 B5 3D 0A 0E 39 C2 AF C5 D6
+Crypto: 43 41 1F 91 A8 41 77 DB D7 EC 9D 0E 23 36 B5 0B
+Timezone: 2.000000
+PinIsSet: true
+NotificationMethod: 0
+AutomationMethod: 3
+Font: 7
+AutomationKbLayout: 0
+TokenName: Steam token
+TokenSecret: C7 F5 35 9D 77 B6 99 8A 5F 05 71 EB 9F DD A4 07 29 82 1E 50 C8 A7 D0 E9 9D 21 52 56 6C 09 DA 38
+TokenAlgo: 3
+TokenDigits: 5
+TokenDuration: 30
+TokenAutomationFeatures: 0
+TokenType: 0
+TokenCounter: 0000000000000000
+TokenName: sha1 token
+TokenSecret: 1F 13 EC CB C7 24 32 BC 48 28 92 BB A6 A2 60 68 D6 DA 74 65 53 08 84 BD 7D 2B 4F FC 17 F1 C8 35 3E B0 37 EA 82 69 95 00 47 5E DA 12 7F 3C 73 05 10 A1 E6 89 1D C0 58 A7 E4 1D 46 B9 28 9E 16 48
+TokenAlgo: 0
+TokenDigits: 6
+TokenDuration: 30
+TokenAutomationFeatures: 0
+TokenType: 0
+TokenCounter: 0000000000000000
+TokenName: sha256 token
+TokenSecret: 80 02 69 36 AC 28 6B 83 08 90 75 81 CA 39 4B 11 C9 69 C7 45 C2 F8 98 14 D7 BB 1E B8 03 BB 52 3E 79 6E 1D F3 A7 E5 89 99 06 4E 08 87 66 9A BD C2 D9 95 65 ED 3A 40 50 F5 D3 2B C4 FE 48 D0 78 4B
+TokenAlgo: 1
+TokenDigits: 6
+TokenDuration: 30
+TokenAutomationFeatures: 0
+TokenType: 0
+TokenCounter: 0000000000000000
+```

+ 113 - 0
.modules/totp/docs/firmwares.schema.json

@@ -0,0 +1,113 @@
+{
+  "description": "Schema file for uFBT-FirmwareManager firmwares.json file",
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "type": "object",
+  "properties": {
+    "firmwares": {
+      "description": "Available firmwares",
+      "type": "array",
+      "items": {
+        "type": "object",
+        "allOf": [
+          {
+            "properties": {
+              "alias": {
+                "description": "Firmware alias(-es)",
+                "type": "array",
+                "items": {
+                  "type": "string"
+                },
+                "minItems": 1,
+                "uniqueItems": true
+              },
+              "description": {
+                "description": "User-friendly description explaining firmware details",
+                "type": "string"
+              },
+              "type": {
+                "description": "Type of firmware reference. `index` - firmware from index; `git-release` - firmware from gir releases",
+                "enum": [
+                  "index",
+                  "git-release"
+                ]
+              }
+            },
+            "required": [
+              "alias",
+              "description"
+            ],
+            "unevaluatedProperties ": false
+          },
+          {
+            "oneOf": [
+              {
+                "if": {
+                  "properties": {
+                    "type": {
+                      "const": "index"
+                    }
+                  },
+                  "required": [
+                    "type"
+                  ]
+                },
+                "then": {
+                  "properties": {
+                    "index_url": {
+                      "description": "Index URL to look for firmware",
+                      "type": "string"
+                    },
+                    "channel": {
+                      "description": "Index channel to pull firmware from",
+                      "type": "string"
+                    }
+                  },
+                  "required": [
+                    "index_url",
+                    "channel"
+                  ],
+                  "unevaluatedProperties ": false
+                },
+                "else": false
+              },
+              {
+                "if": {
+                  "properties": {
+                    "type": {
+                      "const": "git-release"
+                    }
+                  },
+                  "required": [
+                    "type"
+                  ]
+                },
+                "then": {
+                  "properties": {
+                    "git_repo": {
+                      "description": "Firmware Github repo in format `author/repo_name`",
+                      "type": "string"
+                    },
+                    "git_release": {
+                      "description": "Github release name to pull firmware from",
+                      "type": "string"
+                    }
+                  },
+                  "required": [
+                    "git_repo",
+                    "git_release"
+                  ],
+                  "unevaluatedProperties ": false
+                },
+                "else": false
+              }
+            ]
+          }
+        ]
+      }
+    }
+  },
+  "required": [
+    "firmwares"
+  ],
+  "unevaluatedProperties ": false
+}

+ 38 - 0
.modules/totp/firmwares.json

@@ -0,0 +1,38 @@
+{
+  "$schema": "docs/firmwares.schema.json",
+  "firmwares": [
+    {
+      "alias": [
+        "od",
+        "official-dev",
+        "off-dev"
+      ],
+      "description": "Official Dev",
+      "type": "index",
+      "index_url": "https://update.flipperzero.one/firmware/directory.json",
+      "channel": "dev"
+    },
+    {
+      "alias": [
+        "os",
+        "official-stable",
+        "off-stbl"
+      ],
+      "description": "Official Stable",
+      "type": "index",
+      "index_url": "https://update.flipperzero.one/firmware/directory.json",
+      "channel": "release"
+    },
+    {
+      "alias": [
+        "x",
+        "xtreme",
+        "xt"
+      ],
+      "description": "Xtreme",
+      "type": "git-release",
+      "git_repo": "Flipper-XFW/Xtreme-Firmware",
+      "git_release": "latest"
+    }
+  ]
+}

+ 64 - 0
.modules/totp/generate-font.ps1

@@ -0,0 +1,64 @@
+# Font file format generator script.
+
+param (
+    [Parameter(Mandatory)][string]$inputFile,
+    [Parameter(Mandatory)][string]$outputFile
+)
+
+function Get-UInt16AsBytes() {
+    [OutputType([Array])]
+    param (
+        [Parameter(Mandatory)][uint16]$Value
+    )
+
+    $hi = ($Value -shr 8) -band 0xFF
+    $lo = $Value -band 0xFF
+
+    return [Array]@($lo, $hi)
+}
+
+$inputFileContent = Get-Content -Path $inputFile -Raw
+
+$fontFile = New-Item -Name $outputFile -ItemType File -Force
+$fileStream = $fontFile.OpenWrite()
+try {
+    # Font info
+    if ($inputFileContent -match "FontInfo\s*=\s*{\s*`"(.+)`",\s*(\d+).*\s*('.').*\s*('.').*\s*(\d+)") {
+        $fileStream.WriteByte([Byte]$Matches[1].Length) # Font name length
+        $fileStream.Write([System.Text.Encoding]::ASCII.GetBytes($Matches[1]), 0, $Matches[1].Length) # Font name
+        $fileStream.WriteByte([Byte]$Matches[2]) # Character height
+        $fileStream.WriteByte([Byte][Char]$Matches[3][1]) # Start character
+        $fileStream.WriteByte([Byte][Char]$Matches[4][1]) # End character
+        $fileStream.WriteByte([Byte]$Matches[5]) # Width, in pixels, of space character
+    } else {
+        throw "Unable to find FontInfo data"
+    }
+
+    # Font bitmaps
+    if ($inputFileContent -match 'Bitmaps\[\]\s*=\s*\{([^}]+)\}') {
+        $bitmapsRaw = $Matches[1];
+        $bitmapsMatch = $bitmapsRaw | Select-String -Pattern '0x[0-9a-zA-Z]{2}' -AllMatches
+        $bitmapBytes = $bitmapsMatch.Matches.Value | ForEach({ [byte]$_ })
+        $length = [uint16]$bitmapBytes.Length
+        $fileStream.Write((Get-UInt16AsBytes -Value $length), 0, 2) # Bitmap array length
+        $fileStream.Write($bitmapBytes, 0, $length) # Bitmap data
+    } else {
+        throw "Unable to find Bitmap data"
+    }
+
+    # Font descriptors
+    if ($inputFileContent -match 'Descriptors\[\]\s*=\s*\{([\w\W]+?)\};') {
+        $descriptorsRaw = $Matches[1];
+        $descriptorsMatch = $descriptorsRaw | Select-String -Pattern '\{\s*(\d+),\s*(\d+)\s*\}' -AllMatches
+        $fileStream.WriteByte([Byte]$descriptorsMatch.Matches.Length) # Descriptors array length
+        foreach ($match in $descriptorsMatch.Matches) {
+            $fileStream.WriteByte([Byte]$match.Groups[1].Value) # Character width
+            $offset = [uint16]$match.Groups[2].Value
+            $fileStream.Write((Get-UInt16AsBytes -Value $offset), 0, 2) # Character offset
+        }
+    } else {
+        throw "Unable to find Descriptors data"
+    }
+} finally {
+    $fileStream.Dispose()
+}

+ 16 - 0
.modules/totp/sonar-project.properties

@@ -0,0 +1,16 @@
+sonar.projectKey=akopachov_flipper-zero_authenticator
+sonar.organization=akopachov
+
+# This is the name and version displayed in the SonarCloud UI.
+#sonar.projectName=flipper-zero_authenticator
+#sonar.projectVersion=1.0
+
+# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
+sonar.sources=totp
+sonar.importSources=true
+
+# Encoding of the source code. Default is default system encoding
+#sonar.sourceEncoding=UTF-8
+
+sonar.scm.exclusions.disabled=true
+sonar.exclusions=totp/lib/wolfssl/**

+ 191 - 0
.modules/totp/totp/.clang-format

@@ -0,0 +1,191 @@
+---
+Language:        Cpp
+AccessModifierOffset: -4
+AlignAfterOpenBracket: AlwaysBreak
+AlignArrayOfStructures: None
+AlignConsecutiveMacros: None
+AlignConsecutiveAssignments: None
+AlignConsecutiveBitFields: None
+AlignConsecutiveDeclarations: None
+AlignEscapedNewlines: Left
+AlignOperands:   Align
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: Yes
+AttributeMacros:
+  - __capability
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+  AfterCaseLabel:  false
+  AfterClass:      false
+  AfterControlStatement: Never
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     false
+  AfterUnion:      false
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      false
+  BeforeLambdaBody: false
+  BeforeWhile:     false
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeConceptDeclarations: true
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: false
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeComma
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: false
+ColumnLimit:     99
+CommentPragmas:  '^ IWYU pragma:'
+QualifierAlignment: Leave
+CompactNamespaces: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DeriveLineEnding: true
+DerivePointerAlignment: false
+DisableFormat:   false
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
+ExperimentalAutoDetectBinPacking: false
+PackConstructorInitializers: BinPack
+BasedOnStyle:    ''
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+AllowAllConstructorInitializersOnNextLine: true
+FixNamespaceComments: false
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IfMacros:
+  - KJ_IF_MAYBE
+IncludeBlocks:   Preserve
+IncludeCategories:
+  - Regex:           '.*'
+    Priority:        1
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '.*'
+    Priority:        1
+    SortPriority:    0
+    CaseSensitive:   false
+IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseLabels: false
+IndentCaseBlocks: false
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentExternBlock: AfterExternBlock
+IndentRequires:  false
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+InsertTrailingCommas: None
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: Signature
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 4
+ObjCBreakBeforeNestedBlockParam: true
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 10
+PenaltyBreakBeforeFirstCallParameter: 30
+PenaltyBreakComment: 10
+PenaltyBreakFirstLessLess: 0
+PenaltyBreakOpenParenthesis: 0
+PenaltyBreakString: 10
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 100
+PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
+PPIndentWidth:   -1
+ReferenceAlignment: Pointer
+ReflowComments:  false
+RemoveBracesLLVM: false
+SeparateDefinitionBlocks: Leave
+ShortNamespaceLines: 1
+SortIncludes:    Never
+SortJavaStaticImport: Before
+SortUsingDeclarations: false
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: Never
+SpaceBeforeParensOptions:
+  AfterControlStatements: false
+  AfterForeachMacros: false
+  AfterFunctionDefinitionName: false
+  AfterFunctionDeclarationName: false
+  AfterIfMacros:   false
+  AfterOverloadedOperator: false
+  BeforeNonEmptyParentheses: false
+SpaceAroundPointerQualifiers: Default
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  Never
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpacesInLineCommentPrefix:
+  Minimum:         1
+  Maximum:         -1
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+BitFieldColonSpacing: Both
+Standard:        c++03
+StatementAttributeLikeMacros:
+  - Q_EMIT
+StatementMacros:
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        4
+UseCRLF:         false
+UseTab:          Never
+WhitespaceSensitiveMacros:
+  - STRINGIZE
+  - PP_STRINGIZE
+  - BOOST_PP_STRINGIZE
+  - NS_SWIFT_NAME
+  - CF_SWIFT_NAME
+...
+

BIN
.modules/totp/totp/.flipcorg/banner.png


BIN
.modules/totp/totp/.flipcorg/gallery/1.png


BIN
.modules/totp/totp/.flipcorg/gallery/2.png


BIN
.modules/totp/totp/.flipcorg/gallery/3.png


BIN
.modules/totp/totp/.flipcorg/gallery/4.png


BIN
.modules/totp/totp/.flipcorg/gallery/5.png


BIN
.modules/totp/totp/.flipcorg/gallery/6.png


BIN
.modules/totp/totp/.flipcorg/gallery/7.png


+ 13 - 0
.modules/totp/totp/app_api_interface.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#include <flipper_application/api_hashtable/api_hashtable.h>
+
+/* 
+ * Resolver interface with private application's symbols. 
+ * Implementation is contained in app_api_table.c
+ */
+#ifdef __cplusplus
+extern "C" const ElfApiInterface* const application_api_interface;
+#else
+extern const ElfApiInterface* const application_api_interface;
+#endif

+ 19 - 0
.modules/totp/totp/app_api_table.cpp

@@ -0,0 +1,19 @@
+#include <flipper_application/api_hashtable/api_hashtable.h>
+#include <flipper_application/api_hashtable/compilesort.hpp>
+#include "app_api_interface.h"
+#include "app_api_table_i.h"
+
+static_assert(!has_hash_collisions(app_api_table), "Detected API method hash collision!");
+
+constexpr HashtableApiInterface applicaton_hashtable_api_interface{
+    {
+        .api_version_major = 0,
+        .api_version_minor = 0,
+        .resolver_callback = &elf_resolve_from_hashtable,
+    },
+    .table_cbegin = app_api_table.cbegin(),
+    .table_cend = app_api_table.cend(),
+};
+
+extern "C" const ElfApiInterface* const application_api_interface =
+    &applicaton_hashtable_api_interface;

+ 68 - 0
.modules/totp/totp/app_api_table_i.h

@@ -0,0 +1,68 @@
+#include <stdbool.h>
+#include <cli/cli.h>
+#include <lib/print/wrappers.h>
+#include <lib/toolbox/args.h>
+#include <memset_s.h>
+#include "services/crypto/crypto_facade.h"
+#include "ui/scene_director.h"
+#include "services/config/config.h"
+#include "cli/cli_helpers.h"
+#include "workers/bt_type_code/bt_type_code.h"
+
+static constexpr auto app_api_table = sort(create_array_t<sym_entry>(
+    API_METHOD(memset_s, errno_t, (void*, rsize_t, int, rsize_t)),
+    API_METHOD(totp_scene_director_activate_scene, void, (PluginState* const, Scene)),
+    API_METHOD(totp_scene_director_force_redraw, void, (PluginState* const)),
+    API_METHOD(totp_config_file_update_timezone_offset, bool, (const PluginState*)),
+    API_METHOD(totp_config_file_reset, void, (PluginState* const)),
+    API_METHOD(
+        totp_config_get_token_iterator_context,
+        TokenInfoIteratorContext*,
+        (const PluginState*)),
+    API_METHOD(totp_config_file_backup, char*, (const PluginState*)),
+    API_METHOD(
+        totp_config_file_update_encryption,
+        bool,
+        (PluginState*, uint8_t, const uint8_t*, uint8_t)),
+    API_METHOD(totp_config_file_update_automation_method, bool, (const PluginState*)),
+    API_METHOD(totp_config_file_update_notification_method, bool, (const PluginState*)),
+    API_METHOD(totp_token_info_iterator_get_total_count, size_t, (const TokenInfoIteratorContext*)),
+    API_METHOD(
+        totp_token_info_iterator_get_current_token_index,
+        size_t,
+        (const TokenInfoIteratorContext*)),
+    API_METHOD(totp_token_info_iterator_go_to, bool, (TokenInfoIteratorContext*, size_t)),
+    API_METHOD(
+        totp_token_info_iterator_get_current_token,
+        const TokenInfo*,
+        (const TokenInfoIteratorContext*)),
+    API_METHOD(
+        totp_token_info_iterator_add_new_token,
+        TotpIteratorUpdateTokenResult,
+        (TokenInfoIteratorContext*, TOTP_ITERATOR_UPDATE_TOKEN_ACTION, const void*)),
+    API_METHOD(
+        totp_token_info_iterator_update_current_token,
+        TotpIteratorUpdateTokenResult,
+        (TokenInfoIteratorContext*, TOTP_ITERATOR_UPDATE_TOKEN_ACTION, const void*)),
+    API_METHOD(
+        totp_token_info_iterator_move_current_token_info,
+        bool,
+        (TokenInfoIteratorContext*, size_t)),
+    API_METHOD(
+        totp_token_info_iterator_remove_current_token_info,
+        bool,
+        (TokenInfoIteratorContext*)),
+    API_METHOD(token_info_get_algo_as_cstr, const char*, (const TokenInfo*)),
+    API_METHOD(token_info_set_algo_from_str, bool, (TokenInfo*, const FuriString*)),
+    API_METHOD(token_info_set_digits_from_int, bool, (TokenInfo*, uint8_t)),
+    API_METHOD(token_info_set_duration_from_int, bool, (TokenInfo*, uint8_t)),
+    API_METHOD(token_info_set_automation_feature_from_str, bool, (TokenInfo*, const FuriString*)),
+    API_METHOD(
+        token_info_set_secret,
+        bool,
+        (TokenInfo*, const char*, size_t, PlainTokenSecretEncoding, const CryptoSettings*)),
+    API_METHOD(totp_crypto_check_key_slot, bool, (uint8_t)),
+    API_METHOD(totp_bt_type_code_worker_free, void, (TotpBtTypeCodeWorkerContext*)),
+    API_METHOD(token_info_set_token_type_from_str, bool, (TokenInfo*, const FuriString*)),
+    API_METHOD(token_info_set_token_counter_from_str, bool, (TokenInfo*, const FuriString*)),
+    API_METHOD(token_info_get_type_as_cstr, const char*, (const TokenInfo*))));

+ 171 - 0
.modules/totp/totp/application.fam

@@ -0,0 +1,171 @@
+App(
+    appid="totp",
+    name="Authenticator",
+    apptype=FlipperAppType.EXTERNAL,
+    entry_point="totp_app",
+    cdefines=["APP_TOTP"],
+    requires=["gui", "cli", "dialogs", "storage", "input", "notification", "bt"],
+    stack_size=2 * 1024,
+    order=20,
+    fap_version="5.50",
+    fap_author="Alexander Kopachov (@akopachov)",
+    fap_description="Software-based TOTP/HOTP authenticator for Flipper Zero device",
+    fap_weburl="https://github.com/akopachov/flipper-zero_authenticator",
+    fap_category="Tools",
+    fap_icon_assets="images",
+    fap_icon="totp_10px.png",
+    fap_file_assets="assets",
+    fap_private_libs=[
+        Lib(
+            name="base32",
+        ),
+        Lib(
+            name="base64",
+        ),
+        Lib(
+            name="timezone_utils",
+        ),
+        Lib(
+            name="polyfills",
+        ),
+        Lib(
+            name="roll_value",
+        ),
+        Lib(
+            name="wolfssl",
+            sources=[
+                "wolfcrypt/src/pwdbased.c",
+                "wolfcrypt/src/hmac.c",
+                "wolfcrypt/src/hash.c",
+                "wolfcrypt/src/sha.c",
+                "wolfcrypt/src/sha256.c",
+                "wolfcrypt/src/sha512.c",
+            ],
+            cflags=["-Wno-error"],
+            cdefines=["HAVE_CONFIG_H"],
+            cincludes=["config/wolfssl"],
+        ),
+    ],
+)
+
+App(
+    appid="totp_cli_timezone_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_timezone_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/timezone/timezone.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_version_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_version_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/version/version.c"],
+)
+
+App(
+    appid="totp_cli_help_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_help_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/help/help.c"],
+)
+
+App(
+    appid="totp_cli_list_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_list_plugin_ep",
+    requires=["totp"],
+    sources=[
+        "cli/plugins/list/list.c",
+        "cli/cli_shared_methods.c",
+        "cli/plugins/list/formatters/table/list_output_formatter_table.c",
+        "cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c",
+    ],
+)
+
+App(
+    appid="totp_cli_details_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_details_plugin_ep",
+    requires=["totp"],
+    sources=[
+        "cli/plugins/details/details.c",
+        "cli/cli_shared_methods.c",
+        "cli/plugins/details/formatters/table/details_output_formatter_table.c",
+        "cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c",
+    ],
+)
+
+App(
+    appid="totp_cli_add_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_add_plugin_ep",
+    requires=["totp"],
+    sources=[
+        "cli/plugins/modify/add/add.c",
+        "cli/plugins/modify/common.c",
+        "cli/cli_shared_methods.c",
+    ],
+)
+
+App(
+    appid="totp_cli_update_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_update_plugin_ep",
+    requires=["totp"],
+    sources=[
+        "cli/plugins/modify/update/update.c",
+        "cli/plugins/modify/common.c",
+        "cli/cli_shared_methods.c",
+    ],
+)
+
+App(
+    appid="totp_cli_delete_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_delete_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/delete/delete.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_move_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_move_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/move/move.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_reset_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_reset_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/reset/reset.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_pin_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_pin_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/pin/pin.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_automation_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_automation_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/automation/automation.c", "cli/cli_shared_methods.c"],
+)
+
+App(
+    appid="totp_cli_notification_plugin",
+    apptype=FlipperAppType.PLUGIN,
+    entry_point="totp_cli_notification_plugin_ep",
+    requires=["totp"],
+    sources=["cli/plugins/notification/notification.c", "cli/cli_shared_methods.c"],
+)

+ 57 - 0
.modules/totp/totp/assets/cli/cli_help.txt

@@ -0,0 +1,57 @@
+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>] [<automation>...]
+
+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
+
+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>    Number of digits to generate, 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
+  

BIN
.modules/totp/totp/assets/fonts/00.font


BIN
.modules/totp/totp/assets/fonts/01.font


BIN
.modules/totp/totp/assets/fonts/02.font


BIN
.modules/totp/totp/assets/fonts/03.font


BIN
.modules/totp/totp/assets/fonts/04.font


BIN
.modules/totp/totp/assets/fonts/05.font


BIN
.modules/totp/totp/assets/fonts/06.font


BIN
.modules/totp/totp/assets/fonts/07.font


BIN
.modules/totp/totp/assets/fonts/08.font


BIN
.modules/totp/totp/assets/fonts/09.font


+ 175 - 0
.modules/totp/totp/cli/cli.c

@@ -0,0 +1,175 @@
+#include "cli.h"
+#include <lib/toolbox/args.h>
+#include <flipper_application/flipper_application.h>
+#include <flipper_application/plugins/composite_resolver.h>
+#include <loader/firmware_api/firmware_api.h>
+#include "cli_helpers.h"
+#include "plugins/timezone/meta.h"
+#include "plugins/list/meta.h"
+#include "plugins/modify/add/meta.h"
+#include "plugins/modify/update/meta.h"
+#include "plugins/delete/meta.h"
+#include "plugins/help/meta.h"
+#include "plugins/move/meta.h"
+#include "plugins/pin/meta.h"
+#include "plugins/notification/meta.h"
+#include "plugins/reset/meta.h"
+#include "plugins/automation/meta.h"
+#include "plugins/details/meta.h"
+#include "plugins/version/meta.h"
+#include "cli_plugin_interface.h"
+#include "../app_api_interface.h"
+
+struct TotpCliContext {
+    PluginState* plugin_state;
+    CompositeApiResolver* plugin_api_resolver;
+};
+
+static void totp_cli_print_unknown_command(const FuriString* unknown_command) {
+    TOTP_CLI_PRINTF_ERROR(
+        "Command \"%s\" is unknown. Use \"" TOTP_CLI_COMMAND_HELP
+        "\" command to get list of available commands.",
+        furi_string_get_cstr(unknown_command));
+}
+
+static void run_external_cli_plugin_handler(
+    const char* handler_name,
+    TotpCliContext* cli_context,
+    FuriString* args,
+    Cli* cli) {
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    FlipperApplication* plugin_app = flipper_application_alloc(
+        storage, composite_api_resolver_get(cli_context->plugin_api_resolver));
+    do {
+        FuriString* full_handler_path =
+            furi_string_alloc_printf(EXT_PATH("apps_data/totp/plugins/%s.fal"), handler_name);
+        FlipperApplicationPreloadStatus preload_res =
+            flipper_application_preload(plugin_app, furi_string_get_cstr(full_handler_path));
+        furi_string_free(full_handler_path);
+
+        if(preload_res != FlipperApplicationPreloadStatusSuccess) {
+            TOTP_CLI_PRINTF_ERROR("Failed to preload plugin. Code: %d\r\n", preload_res);
+            break;
+        }
+
+        if(!flipper_application_is_plugin(plugin_app)) {
+            TOTP_CLI_PRINTF_ERROR("Plugin file is not a library\r\n");
+            break;
+        }
+
+        FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(plugin_app);
+        if(load_status != FlipperApplicationLoadStatusSuccess) {
+            TOTP_CLI_PRINTF_ERROR("Failed to load plugin file. Code %d\r\n", load_status);
+            break;
+        }
+
+        const FlipperAppPluginDescriptor* app_descriptor =
+            flipper_application_plugin_get_descriptor(plugin_app);
+
+        if(strcmp(app_descriptor->appid, PLUGIN_APP_ID) != 0) {
+            TOTP_CLI_PRINTF_ERROR("Plugin doesn't seems to be a valid TOTP CLI plugin\r\n");
+            break;
+        }
+
+        if(app_descriptor->ep_api_version != PLUGIN_API_VERSION) {
+            TOTP_CLI_PRINTF_ERROR(
+                "Plugin version %" PRIu32 " is not compatible with your app version\r\n",
+                app_descriptor->ep_api_version);
+            break;
+        }
+
+        const CliPlugin* plugin = app_descriptor->entry_point;
+
+        plugin->handle(cli_context->plugin_state, args, cli);
+    } while(false);
+    flipper_application_free(plugin_app);
+
+    furi_record_close(RECORD_STORAGE);
+}
+
+static void totp_cli_handler(Cli* cli, FuriString* args, void* context) {
+    TotpCliContext* cli_context = context;
+
+    FuriString* cmd = furi_string_alloc();
+
+    args_read_string_and_trim(args, cmd);
+
+    const char* external_plugin_name = NULL;
+
+    if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_HELP) == 0 ||
+       furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_HELP_ALT) == 0 ||
+       furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_HELP_ALT2) == 0 || furi_string_empty(cmd)) {
+        external_plugin_name = TOTP_CLI_PLUGIN_HELP_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_ADD) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_ADD_ALT) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_ADD_ALT2) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_ADD_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_LIST) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_LIST_ALT) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_LIST_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DELETE) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DELETE_ALT) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_DELETE_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_TIMEZONE) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_TIMEZONE_ALT) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_TIMEZONE_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_MOVE) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_MOVE_ALT) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_MOVE_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_PIN) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_PIN_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_NOTIFICATION) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_NOTIFICATION_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_AUTOMATION) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_AUTOMATION_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_RESET) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_RESET_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_UPDATE) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_UPDATE_FILE_NAME;
+    } else if(
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS) == 0 ||
+        furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS_ALT) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_DETAILS_FILE_NAME;
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_VERSION) == 0) {
+        external_plugin_name = TOTP_CLI_PLUGIN_VERSION_FILE_NAME;
+    } else {
+        totp_cli_print_unknown_command(cmd);
+    }
+
+    if(external_plugin_name != NULL) {
+        run_external_cli_plugin_handler(external_plugin_name, cli_context, args, cli);
+    }
+
+    furi_string_free(cmd);
+}
+
+TotpCliContext* totp_cli_register_command_handler(PluginState* plugin_state) {
+    Cli* cli = furi_record_open(RECORD_CLI);
+    TotpCliContext* context = malloc(sizeof(TotpCliContext));
+    furi_check(context != NULL);
+    context->plugin_state = plugin_state;
+
+    context->plugin_api_resolver = composite_api_resolver_alloc();
+    composite_api_resolver_add(context->plugin_api_resolver, firmware_api_interface);
+    composite_api_resolver_add(context->plugin_api_resolver, application_api_interface);
+
+    cli_add_command(
+        cli, TOTP_CLI_COMMAND_NAME, CliCommandFlagParallelSafe, totp_cli_handler, context);
+    furi_record_close(RECORD_CLI);
+    return context;
+}
+
+void totp_cli_unregister_command_handler(TotpCliContext* context) {
+    Cli* cli = furi_record_open(RECORD_CLI);
+    cli_delete_command(cli, TOTP_CLI_COMMAND_NAME);
+
+    composite_api_resolver_free(context->plugin_api_resolver);
+
+    furi_record_close(RECORD_CLI);
+    free(context);
+}

+ 19 - 0
.modules/totp/totp/cli/cli.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include <cli/cli.h>
+#include "../types/plugin_state.h"
+
+typedef struct TotpCliContext TotpCliContext;
+
+/**
+ * @brief Registers TOTP CLI handler
+ * @param plugin_state application state
+ * @return TOTP CLI context
+ */
+TotpCliContext* totp_cli_register_command_handler(PluginState* plugin_state);
+
+/**
+ * @brief Unregisters TOTP CLI handler
+ * @param context application state
+ */
+void totp_cli_unregister_command_handler(TotpCliContext* context);

+ 65 - 0
.modules/totp/totp/cli/cli_helpers.h

@@ -0,0 +1,65 @@
+#pragma once
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TOTP_CLI_COMMAND_NAME "totp"
+
+#define TOTP_CLI_COLOR_ERROR "91m"
+#define TOTP_CLI_COLOR_WARNING "93m"
+#define TOTP_CLI_COLOR_SUCCESS "92m"
+#define TOTP_CLI_COLOR_INFO "96m"
+
+#define TOTP_CLI_PRINTF(format, ...) printf(format, ##__VA_ARGS__)
+
+#define TOTP_CLI_PRINTF_COLORFUL(color, format, ...) \
+    TOTP_CLI_PRINTF("\e[%s" format "\e[0m", color, ##__VA_ARGS__)
+
+#define TOTP_CLI_PRINTF_ERROR(format, ...) \
+    TOTP_CLI_PRINTF_COLORFUL(TOTP_CLI_COLOR_ERROR, format, ##__VA_ARGS__)
+#define TOTP_CLI_PRINTF_WARNING(format, ...) \
+    TOTP_CLI_PRINTF_COLORFUL(TOTP_CLI_COLOR_WARNING, format, ##__VA_ARGS__)
+#define TOTP_CLI_PRINTF_SUCCESS(format, ...) \
+    TOTP_CLI_PRINTF_COLORFUL(TOTP_CLI_COLOR_SUCCESS, format, ##__VA_ARGS__)
+#define TOTP_CLI_PRINTF_INFO(format, ...) \
+    TOTP_CLI_PRINTF_COLORFUL(TOTP_CLI_COLOR_INFO, format, ##__VA_ARGS__)
+
+#define TOTP_CLI_LOCK_UI(plugin_state)                                  \
+    Scene __previous_scene = plugin_state->current_scene;               \
+    totp_scene_director_activate_scene(plugin_state, TotpSceneStandby); \
+    totp_scene_director_force_redraw(plugin_state)
+
+#define TOTP_CLI_UNLOCK_UI(plugin_state)                                \
+    totp_scene_director_activate_scene(plugin_state, __previous_scene); \
+    totp_scene_director_force_redraw(plugin_state)
+
+#define TOTP_CLI_PRINT_INVALID_ARGUMENTS() \
+    TOTP_CLI_PRINTF_ERROR(                 \
+        "Invalid command arguments. use \"help\" command to get list of available commands")
+
+#define TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE() \
+    TOTP_CLI_PRINTF_ERROR("An error has occurred during updating config file\r\n")
+
+#define TOTP_CLI_PRINT_ERROR_LOADING_TOKEN_INFO() \
+    TOTP_CLI_PRINTF_ERROR("An error has occurred during loading token information\r\n")
+
+#define TOTP_CLI_PRINT_PROCESSING() TOTP_CLI_PRINTF("Processing, please wait...\r\n")
+
+#define TOTP_CLI_DELETE_LAST_CHAR() \
+    TOTP_CLI_PRINTF("\b \b");       \
+    fflush(stdout)
+
+#define TOTP_CLI_DELETE_CURRENT_LINE() \
+    TOTP_CLI_PRINTF("\33[2K\r");       \
+    fflush(stdout)
+
+#define TOTP_CLI_DELETE_LAST_LINE()    \
+    TOTP_CLI_PRINTF("\033[A\33[2K\r"); \
+    fflush(stdout)
+
+#ifdef __cplusplus
+}
+#endif

+ 13 - 0
.modules/totp/totp/cli/cli_plugin_interface.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#include <cli/cli.h>
+#include <furi/core/string.h>
+#include "../types/plugin_state.h"
+
+#define PLUGIN_APP_ID "totp_cli"
+#define PLUGIN_API_VERSION 1
+
+typedef struct {
+    const char* name;
+    void (*handle)(PluginState*, FuriString*, Cli*);
+} CliPlugin;

+ 95 - 0
.modules/totp/totp/cli/cli_shared_methods.c

@@ -0,0 +1,95 @@
+#include "cli_shared_methods.h"
+#include <cli/cli.h>
+#include <lib/toolbox/args.h>
+#include "cli_helpers.h"
+#include "../types/plugin_event.h"
+
+bool totp_cli_ensure_authenticated(const PluginState* plugin_state, Cli* cli) {
+    if(plugin_state->current_scene == TotpSceneAuthentication) {
+        TOTP_CLI_PRINTF("Pleases enter PIN on your flipper device\r\n");
+
+        while((plugin_state->current_scene == TotpSceneAuthentication ||
+               plugin_state->current_scene == TotpSceneNone) &&
+              !cli_cmd_interrupt_received(cli)) {
+            furi_delay_ms(100);
+        }
+
+        TOTP_CLI_DELETE_LAST_LINE();
+
+        if(plugin_state->current_scene == TotpSceneAuthentication || //-V560
+           plugin_state->current_scene == TotpSceneNone) { //-V560
+            TOTP_CLI_PRINTF_INFO("Cancelled by user\r\n");
+            return false;
+        }
+    }
+
+    return true;
+}
+
+void totp_cli_force_close_app(FuriMessageQueue* event_queue) {
+    PluginEvent event = {.type = EventForceCloseApp};
+    furi_message_queue_put(event_queue, &event, FuriWaitForever);
+}
+
+bool totp_cli_read_line(Cli* cli, FuriString* out_str, bool mask_user_input) {
+    uint8_t c;
+    while(cli_read(cli, &c, 1) == 1) {
+        if(c == CliSymbolAsciiEsc) {
+            // Some keys generating escape-sequences
+            // We need to ignore them as we care about alpha-numerics only
+            uint8_t c2;
+            cli_read_timeout(cli, &c2, 1, 0);
+            cli_read_timeout(cli, &c2, 1, 0);
+        } else if(c == CliSymbolAsciiETX) {
+            cli_nl();
+            return false;
+        } else if(
+            (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
+            c == '/' || c == '=' || c == '+') {
+            if(mask_user_input) {
+                putc('*', stdout);
+            } else {
+                putc(c, stdout);
+            }
+            fflush(stdout);
+            furi_string_push_back(out_str, c);
+        } else if(c == CliSymbolAsciiBackspace || c == CliSymbolAsciiDel) {
+            size_t out_str_size = furi_string_size(out_str);
+            if(out_str_size > 0) {
+                TOTP_CLI_DELETE_LAST_CHAR();
+                furi_string_left(out_str, out_str_size - 1);
+            }
+        } else if(c == CliSymbolAsciiCR) {
+            cli_nl();
+            break;
+        }
+    }
+
+    return true;
+}
+
+bool args_read_uint8_and_trim(FuriString* args, uint8_t* value) {
+    int int_value;
+    if(!args_read_int_and_trim(args, &int_value) || int_value < 0 || int_value > UINT8_MAX) {
+        return false;
+    }
+
+    *value = (uint8_t)int_value;
+    return true;
+}
+
+void furi_string_secure_free(FuriString* str) {
+    for(long i = furi_string_size(str) - 1; i >= 0; i--) {
+        furi_string_set_char(str, i, '\0');
+    }
+
+    furi_string_free(str);
+}
+
+void totp_cli_printf_missed_argument_value(char* arg) {
+    TOTP_CLI_PRINTF_ERROR("Missed or incorrect value for argument \"%s\"\r\n", arg);
+}
+
+void totp_cli_printf_unknown_argument(const FuriString* arg) {
+    TOTP_CLI_PRINTF("Unknown argument \"%s\"\r\n", furi_string_get_cstr(arg));
+}

+ 62 - 0
.modules/totp/totp/cli/cli_shared_methods.h

@@ -0,0 +1,62 @@
+#pragma once
+
+#include <cli/cli.h>
+#include "../types/plugin_state.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Checks whether user is authenticated and entered correct PIN.
+ *        If user is not authenticated it prompts user to enter correct PIN to authenticate.
+ * @param plugin_state application state
+ * @param cli pointer to the firmware CLI subsystem 
+ * @return \c true if user is already authenticated or successfully authenticated; \c false otherwise
+ */
+bool totp_cli_ensure_authenticated(const PluginState* plugin_state, Cli* cli);
+
+/**
+ * @brief Forces application to be instantly closed
+ * @param event_queue main app queue
+ */
+void totp_cli_force_close_app(FuriMessageQueue* event_queue);
+
+/**
+ * @brief Reads line of characters from console
+ * @param cli pointer to the firmware CLI subsystem 
+ * @param out_str pointer to an output string to put read line to
+ * @param mask_user_input whether to mask input characters in console or not
+ * @return \c true if line successfully read and confirmed; \c false otherwise
+ */
+bool totp_cli_read_line(Cli* cli, FuriString* out_str, bool mask_user_input);
+
+/**
+ * @brief Extracts \c uint8_t value and trims arguments string
+ * @param args arguments string
+ * @param[out] value parsed value
+ * @return \c true if value successfully read and parsed as \c uint8_t ; \c false otherwise
+ */
+bool args_read_uint8_and_trim(FuriString* args, uint8_t* value);
+
+/**
+ * @brief Free \c FuriString instance in a secure manner by clearing it first
+ * @param str instance to free
+ */
+void furi_string_secure_free(FuriString* str);
+
+/**
+ * @brief Prints information about unknown argument
+ * @param arg 
+ */
+void totp_cli_printf_unknown_argument(const FuriString* arg);
+
+/**
+ * @brief Prints information about missed required argument
+ * @param arg 
+ */
+void totp_cli_printf_missed_argument_value(char* arg);
+
+#ifdef __cplusplus
+}
+#endif

+ 173 - 0
.modules/totp/totp/cli/plugins/automation/automation.c

@@ -0,0 +1,173 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+#include "../../../config/app/config.h"
+
+#define TOTP_CLI_COMMAND_AUTOMATION_ARG_METHOD "automation"
+#define TOTP_CLI_COMMAND_AUTOMATION_METHOD_NONE "none"
+#define TOTP_CLI_COMMAND_AUTOMATION_METHOD_USB "usb"
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+#define TOTP_CLI_COMMAND_AUTOMATION_METHOD_BT "bt"
+#endif
+#define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY "QWERTY"
+#define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY "AZERTY"
+#define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ "QWERTZ"
+#define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT_PREFIX "-k"
+
+static void print_method(AutomationMethod method, const char* color) {
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+    bool has_previous_method = false;
+#endif
+    if(method & AutomationMethodBadUsb) {
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_AUTOMATION_METHOD_USB "\"");
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+        has_previous_method = true;
+#endif
+    }
+
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+    if(method & AutomationMethodBadBt) {
+        if(has_previous_method) {
+            TOTP_CLI_PRINTF_COLORFUL(color, " and ");
+        }
+
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_AUTOMATION_METHOD_BT "\"");
+    }
+#endif
+
+    if(method == AutomationMethodNone) {
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_AUTOMATION_METHOD_NONE "\"");
+    }
+}
+
+static void print_kb_layout(AutomationKeyboardLayout layout, const char* color) {
+    char* layoutToPrint;
+    switch(layout) {
+    case AutomationKeyboardLayoutQWERTY:
+        layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY;
+        break;
+    case AutomationKeyboardLayoutAZERTY:
+        layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY;
+        break;
+    case AutomationKeyboardLayoutQWERTZ:
+        layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ;
+        break;
+    default:
+        furi_crash("Unknown automation keyboard layout");
+        break;
+    }
+
+    TOTP_CLI_PRINTF_COLORFUL(color, "%s", layoutToPrint);
+}
+
+static bool
+    parse_automation_keyboard_layout(const FuriString* str, AutomationKeyboardLayout* out) {
+    bool result = true;
+    if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY) == 0) {
+        *out = AutomationKeyboardLayoutQWERTY;
+    } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY) == 0) {
+        *out = AutomationKeyboardLayoutAZERTY;
+    } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ) == 0) {
+        *out = AutomationKeyboardLayoutQWERTZ;
+    } else {
+        result = false;
+    }
+
+    return result;
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    FuriString* temp_str = furi_string_alloc();
+    bool new_method_provided = false;
+    AutomationMethod new_method = AutomationMethodNone;
+    AutomationKeyboardLayout new_kb_layout = plugin_state->automation_kb_layout;
+    bool args_valid = true;
+    while(args_read_string_and_trim(args, temp_str)) {
+        if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_AUTOMATION_METHOD_NONE) == 0) {
+            new_method_provided = true;
+            new_method = AutomationMethodNone;
+        } else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_AUTOMATION_METHOD_USB) == 0) {
+            new_method_provided = true;
+            new_method |= AutomationMethodBadUsb;
+        }
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+        else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_AUTOMATION_METHOD_BT) == 0) {
+            new_method_provided = true;
+            new_method |= AutomationMethodBadBt;
+        }
+#endif
+        else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT_PREFIX) == 0) {
+            if(!args_read_string_and_trim(args, temp_str) ||
+               !parse_automation_keyboard_layout(temp_str, &new_kb_layout)) {
+                args_valid = false;
+                break;
+            }
+        } else {
+            args_valid = false;
+            break;
+        }
+    }
+
+    do {
+        if(!args_valid) {
+            TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+            break;
+        }
+
+        if(new_method_provided) {
+            TOTP_CLI_LOCK_UI(plugin_state);
+
+            plugin_state->automation_method = new_method;
+            plugin_state->automation_kb_layout = new_kb_layout;
+            if(totp_config_file_update_automation_method(plugin_state)) {
+                TOTP_CLI_PRINTF_SUCCESS("Automation method is set to ");
+                print_method(new_method, TOTP_CLI_COLOR_SUCCESS);
+                TOTP_CLI_PRINTF_SUCCESS(" (");
+                print_kb_layout(plugin_state->automation_kb_layout, TOTP_CLI_COLOR_SUCCESS);
+                TOTP_CLI_PRINTF_SUCCESS(")");
+                cli_nl();
+            } else {
+                TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+            }
+
+#ifdef TOTP_BADBT_AUTOMATION_ENABLED
+            if(!(new_method & AutomationMethodBadBt) &&
+               plugin_state->bt_type_code_worker_context != NULL) {
+                totp_bt_type_code_worker_free(plugin_state->bt_type_code_worker_context);
+                plugin_state->bt_type_code_worker_context = NULL;
+            }
+#endif
+
+            TOTP_CLI_UNLOCK_UI(plugin_state);
+        } else {
+            TOTP_CLI_PRINTF_INFO("Current automation method is ");
+            print_method(plugin_state->automation_method, TOTP_CLI_COLOR_INFO);
+            TOTP_CLI_PRINTF_INFO(" (");
+            print_kb_layout(plugin_state->automation_kb_layout, TOTP_CLI_COLOR_INFO);
+            TOTP_CLI_PRINTF_INFO(")");
+            cli_nl();
+        }
+    } while(false);
+
+    furi_string_free(temp_str);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Automation", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_automation_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 4 - 0
.modules/totp/totp/cli/plugins/automation/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_AUTOMATION "automation"
+#define TOTP_CLI_PLUGIN_AUTOMATION_FILE_NAME "totp_cli_automation_plugin"

+ 95 - 0
.modules/totp/totp/cli/plugins/delete/delete.c

@@ -0,0 +1,95 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+
+#define TOTP_CLI_COMMAND_DELETE_ARG_FORCE_PREFIX "-f"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+
+    int token_number;
+    if(!args_read_int_and_trim(args, &token_number) || token_number <= 0 ||
+       (size_t)token_number > totp_token_info_iterator_get_total_count(iterator_context)) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        return;
+    }
+
+    FuriString* temp_str = furi_string_alloc();
+    bool confirm_needed = true;
+    if(args_read_string_and_trim(args, temp_str)) {
+        if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_DELETE_ARG_FORCE_PREFIX) == 0) {
+            confirm_needed = false;
+        } else {
+            totp_cli_printf_unknown_argument(temp_str);
+            TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+            furi_string_free(temp_str);
+            return;
+        }
+    }
+    furi_string_free(temp_str);
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    size_t original_token_index =
+        totp_token_info_iterator_get_current_token_index(iterator_context);
+    totp_token_info_iterator_go_to(iterator_context, token_number - 1);
+    const TokenInfo* token_info = totp_token_info_iterator_get_current_token(iterator_context);
+    const char* token_info_name = furi_string_get_cstr(token_info->name);
+
+    bool confirmed = !confirm_needed;
+    if(confirm_needed) {
+        TOTP_CLI_PRINTF_WARNING("WARNING!\r\n");
+        TOTP_CLI_PRINTF_WARNING(
+            "TOKEN \"%s\" WILL BE PERMANENTLY DELETED WITHOUT ABILITY TO RECOVER IT.\r\n",
+            token_info_name);
+        TOTP_CLI_PRINTF_WARNING("Confirm? [y/n]\r\n");
+        fflush(stdout);
+        char user_pick;
+        do {
+            user_pick = tolower(cli_getc(cli));
+        } while(user_pick != 'y' && user_pick != 'n' && user_pick != CliSymbolAsciiCR &&
+                user_pick != CliSymbolAsciiETX && user_pick != CliSymbolAsciiEsc);
+
+        confirmed = user_pick == 'y' || user_pick == CliSymbolAsciiCR;
+    }
+
+    if(confirmed) {
+        TOTP_CLI_PRINT_PROCESSING();
+        if(totp_token_info_iterator_remove_current_token_info(iterator_context)) {
+            TOTP_CLI_DELETE_LAST_LINE();
+            TOTP_CLI_PRINTF_SUCCESS(
+                "Token \"%s\" has been successfully deleted\r\n", token_info_name);
+            totp_token_info_iterator_go_to(iterator_context, 0);
+        } else {
+            TOTP_CLI_DELETE_LAST_LINE();
+            TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+            totp_token_info_iterator_go_to(iterator_context, original_token_index);
+        }
+    } else {
+        TOTP_CLI_PRINTF_INFO("User has not confirmed\r\n");
+        totp_token_info_iterator_go_to(iterator_context, original_token_index);
+    }
+
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Delete", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_delete_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 5 - 0
.modules/totp/totp/cli/plugins/delete/meta.h

@@ -0,0 +1,5 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_DELETE "delete"
+#define TOTP_CLI_COMMAND_DELETE_ALT "rm"
+#define TOTP_CLI_PLUGIN_DELETE_FILE_NAME "totp_cli_delete_plugin"

+ 140 - 0
.modules/totp/totp/cli/plugins/details/details.c

@@ -0,0 +1,140 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../../services/config/config.h"
+#include "../../../services/config/constants.h"
+#include "../../../types/token_info.h"
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../ui/scene_director.h"
+#include "formatters/table/details_output_formatter_table.h"
+#include "formatters/tsv/details_output_formatter_tsv.h"
+
+typedef void (*TOTP_CLI_DETAILS_HEADER_FORMATTER)();
+typedef void (*TOTP_CLI_DETAILS_FOOTER_FORMATTER)();
+typedef void (*TOTP_CLI_DETAILS_AUTOMATION_FEATURE_ITEM_FORMATTER)(
+    const char* key,
+    const char* feature,
+    bool* header_printed);
+typedef void (*TOTP_CLI_DETAILS_CSTR_FORMATTER)(const char* key, const char* value);
+typedef void (*TOTP_CLI_DETAILS_UINT8T_FORMATTER)(const char* key, uint8_t value);
+typedef void (*TOTP_CLI_DETAILS_SIZET_FORMATTER)(const char* key, size_t value);
+typedef void (*TOTP_CLI_DETAILS_UINT64T_FORMATTER)(const char* key, uint64_t value);
+
+typedef struct {
+    const TOTP_CLI_DETAILS_HEADER_FORMATTER header_formatter;
+    const TOTP_CLI_DETAILS_FOOTER_FORMATTER footer_formatter;
+    const TOTP_CLI_DETAILS_AUTOMATION_FEATURE_ITEM_FORMATTER automation_feature_item_formatter;
+    const TOTP_CLI_DETAILS_CSTR_FORMATTER cstr_formatter;
+    const TOTP_CLI_DETAILS_UINT8T_FORMATTER uint8t_formatter;
+    const TOTP_CLI_DETAILS_SIZET_FORMATTER sizet_formatter;
+    const TOTP_CLI_DETAILS_UINT64T_FORMATTER uint64t_formatter;
+} TotpCliDetailsFormatter;
+
+static const TotpCliDetailsFormatter available_formatters[] = {
+    {.header_formatter = &details_output_formatter_print_header_table,
+     .footer_formatter = &details_output_formatter_print_footer_table,
+     .automation_feature_item_formatter = &details_output_formatter_print_automation_feature_table,
+     .cstr_formatter = &details_output_formatter_print_cstr_table,
+     .uint8t_formatter = &details_output_formatter_print_uint8t_table,
+     .sizet_formatter = &details_output_formatter_print_sizet_table,
+     .uint64t_formatter = &details_output_formatter_print_uint64t_table},
+
+    {.header_formatter = &details_output_formatter_print_header_tsv,
+     .footer_formatter = &details_output_formatter_print_footer_tsv,
+     .automation_feature_item_formatter = &details_output_formatter_print_automation_feature_tsv,
+     .cstr_formatter = &details_output_formatter_print_cstr_tsv,
+     .uint8t_formatter = &details_output_formatter_print_uint8t_tsv,
+     .sizet_formatter = &details_output_formatter_print_sizet_tsv,
+     .uint64t_formatter = &details_output_formatter_print_uint64t_tsv},
+};
+
+static void print_automation_features(
+    const TokenInfo* token_info,
+    const TotpCliDetailsFormatter* formatter) {
+    bool header_printed = false;
+    const char* AUTOMATION_FEATURES_PRINT_KEY = "Automation features";
+    if(token_info->automation_features == TokenAutomationFeatureNone) {
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "None", &header_printed);
+        return;
+    }
+
+    if(token_info->automation_features & TokenAutomationFeatureEnterAtTheEnd) {
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type <Enter> key at the end", &header_printed);
+    }
+
+    if(token_info->automation_features & TokenAutomationFeatureTabAtTheEnd) {
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type <Tab> key at the end", &header_printed);
+    }
+
+    if(token_info->automation_features & TokenAutomationFeatureTypeSlower) {
+        (*formatter->automation_feature_item_formatter)(
+            AUTOMATION_FEATURES_PRINT_KEY, "Type slower", &header_printed);
+    }
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    int token_number;
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+    if(!args_read_int_and_trim(args, &token_number) || token_number <= 0 ||
+       (size_t)token_number > totp_token_info_iterator_get_total_count(iterator_context)) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        return;
+    }
+
+    const TotpCliDetailsFormatter* formatter = &available_formatters[0];
+    FuriString* arg = furi_string_alloc();
+    if(args_read_string_and_trim(args, arg) && furi_string_cmpi_str(arg, "--tsv") == 0) {
+        formatter = &available_formatters[1];
+    }
+
+    furi_string_free(arg);
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    size_t original_token_index =
+        totp_token_info_iterator_get_current_token_index(iterator_context);
+    if(totp_token_info_iterator_go_to(iterator_context, token_number - 1)) {
+        const TokenInfo* token_info = totp_token_info_iterator_get_current_token(iterator_context);
+
+        (*formatter->header_formatter)();
+        (*formatter->sizet_formatter)("Index", token_number);
+        (*formatter->cstr_formatter)("Type", token_info_get_type_as_cstr(token_info));
+        (*formatter->cstr_formatter)("Name", furi_string_get_cstr(token_info->name));
+        (*formatter->cstr_formatter)("Hashing algorithm", token_info_get_algo_as_cstr(token_info));
+        (*formatter->uint8t_formatter)("Number of digits", token_info->digits);
+        if(token_info->type == TokenTypeTOTP) {
+            (*formatter->uint8t_formatter)("Token lifetime", token_info->duration);
+        } else if(token_info->type == TokenTypeHOTP) {
+            (*formatter->uint64t_formatter)("Token counter", token_info->counter);
+        }
+        print_automation_features(token_info, formatter);
+        (*formatter->footer_formatter)();
+    } else {
+        TOTP_CLI_PRINT_ERROR_LOADING_TOKEN_INFO();
+    }
+
+    totp_token_info_iterator_go_to(iterator_context, original_token_index);
+
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Details", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_details_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 37 - 0
.modules/totp/totp/cli/plugins/details/formatters/table/details_output_formatter_table.c

@@ -0,0 +1,37 @@
+#include "details_output_formatter_table.h"
+#include <inttypes.h>
+#include "../../../../cli_helpers.h"
+
+void details_output_formatter_print_header_table() {
+    TOTP_CLI_PRINTF("+----------------------+-------------------------------+\r\n");
+    TOTP_CLI_PRINTF("| %-20s | %-29s |\r\n", "Property", "Value");
+    TOTP_CLI_PRINTF("+----------------------+-------------------------------+\r\n");
+}
+
+void details_output_formatter_print_footer_table() {
+    TOTP_CLI_PRINTF("+----------------------+-------------------------------+\r\n");
+}
+
+void details_output_formatter_print_automation_feature_table(
+    const char* key,
+    const char* feature,
+    bool* header_printed) {
+    TOTP_CLI_PRINTF("| %-20s | %-29.29s |\r\n", *header_printed ? "" : key, feature);
+    *header_printed = true;
+}
+
+void details_output_formatter_print_cstr_table(const char* key, const char* value) {
+    TOTP_CLI_PRINTF("| %-20s | %-29.29s |\r\n", key, value);
+}
+
+void details_output_formatter_print_uint8t_table(const char* key, uint8_t value) {
+    TOTP_CLI_PRINTF("| %-20s | %-29" PRIu8 " |\r\n", key, value);
+}
+
+void details_output_formatter_print_sizet_table(const char* key, size_t value) {
+    TOTP_CLI_PRINTF("| %-20s | %-29" PRIu16 " |\r\n", key, value);
+}
+
+void details_output_formatter_print_uint64t_table(const char* key, uint64_t value) {
+    TOTP_CLI_PRINTF("| %-20s | %-29" PRIu64 " |\r\n", key, value);
+}

+ 16 - 0
.modules/totp/totp/cli/plugins/details/formatters/table/details_output_formatter_table.h

@@ -0,0 +1,16 @@
+#pragma once
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+void details_output_formatter_print_header_table();
+void details_output_formatter_print_footer_table();
+void details_output_formatter_print_automation_feature_table(
+    const char* key,
+    const char* feature,
+    bool* header_printed);
+void details_output_formatter_print_cstr_table(const char* key, const char* value);
+void details_output_formatter_print_uint8t_table(const char* key, uint8_t value);
+void details_output_formatter_print_sizet_table(const char* key, size_t value);
+void details_output_formatter_print_uint64t_table(const char* key, uint64_t value);

+ 34 - 0
.modules/totp/totp/cli/plugins/details/formatters/tsv/details_output_formatter_tsv.c

@@ -0,0 +1,34 @@
+#include "details_output_formatter_tsv.h"
+#include <inttypes.h>
+#include "../../../../cli_helpers.h"
+
+void details_output_formatter_print_header_tsv() {
+    TOTP_CLI_PRINTF("%s\t%s\r\n", "Property", "Value");
+}
+
+void details_output_formatter_print_footer_tsv() {
+}
+
+void details_output_formatter_print_automation_feature_tsv(
+    const char* key,
+    const char* feature,
+    bool* header_printed) {
+    TOTP_CLI_PRINTF("%s\t%s\r\n", *header_printed ? "" : key, feature);
+    *header_printed = true;
+}
+
+void details_output_formatter_print_cstr_tsv(const char* key, const char* value) {
+    TOTP_CLI_PRINTF("%s\t%s\r\n", key, value);
+}
+
+void details_output_formatter_print_uint8t_tsv(const char* key, uint8_t value) {
+    TOTP_CLI_PRINTF("%s\t%" PRIu8 "\r\n", key, value);
+}
+
+void details_output_formatter_print_sizet_tsv(const char* key, size_t value) {
+    TOTP_CLI_PRINTF("%s\t%" PRIu16 "\r\n", key, value);
+}
+
+void details_output_formatter_print_uint64t_tsv(const char* key, uint64_t value) {
+    TOTP_CLI_PRINTF("%s\t%" PRIu64 "\r\n", key, value);
+}

+ 16 - 0
.modules/totp/totp/cli/plugins/details/formatters/tsv/details_output_formatter_tsv.h

@@ -0,0 +1,16 @@
+#pragma once
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+void details_output_formatter_print_header_tsv();
+void details_output_formatter_print_footer_tsv();
+void details_output_formatter_print_automation_feature_tsv(
+    const char* key,
+    const char* feature,
+    bool* header_printed);
+void details_output_formatter_print_cstr_tsv(const char* key, const char* value);
+void details_output_formatter_print_uint8t_tsv(const char* key, uint8_t value);
+void details_output_formatter_print_sizet_tsv(const char* key, size_t value);
+void details_output_formatter_print_uint64t_tsv(const char* key, uint64_t value);

+ 5 - 0
.modules/totp/totp/cli/plugins/details/meta.h

@@ -0,0 +1,5 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_DETAILS "lsattr"
+#define TOTP_CLI_COMMAND_DETAILS_ALT "cat"
+#define TOTP_CLI_PLUGIN_DETAILS_FILE_NAME "totp_cli_details_plugin"

+ 42 - 0
.modules/totp/totp/cli/plugins/help/help.c

@@ -0,0 +1,42 @@
+#include <flipper_application/flipper_application.h>
+#include <storage/storage.h>
+#include <toolbox/stream/stream.h>
+#include <toolbox/stream/file_stream.h>
+#include "../../cli_helpers.h"
+#include "../../cli_plugin_interface.h"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    UNUSED(args);
+    UNUSED(cli);
+    UNUSED(plugin_state);
+
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+
+    Stream* stream = file_stream_alloc(storage);
+
+    if(file_stream_open(
+           stream, EXT_PATH("apps_assets/totp/cli/cli_help.txt"), FSAM_READ, FSOM_OPEN_EXISTING)) {
+        uint8_t buffer[32U];
+        size_t bytes_read;
+        while((bytes_read = stream_read(stream, &buffer[0], sizeof(buffer))) > 0) {
+            cli_write(cli, &buffer[0], bytes_read);
+        }
+    }
+
+    file_stream_close(stream);
+    stream_free(stream);
+
+    furi_record_close(RECORD_STORAGE);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Help", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_help_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 6 - 0
.modules/totp/totp/cli/plugins/help/meta.h

@@ -0,0 +1,6 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_HELP "help"
+#define TOTP_CLI_COMMAND_HELP_ALT "h"
+#define TOTP_CLI_COMMAND_HELP_ALT2 "?"
+#define TOTP_CLI_PLUGIN_HELP_FILE_NAME "totp_cli_help_plugin"

+ 23 - 0
.modules/totp/totp/cli/plugins/list/formatters/table/list_output_formatter_table.c

@@ -0,0 +1,23 @@
+#include "list_output_formatter_table.h"
+#include <inttypes.h>
+#include "../../../../cli_helpers.h"
+
+void list_output_formatter_print_header_table() {
+    TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+------+\r\n");
+    TOTP_CLI_PRINTF("| %-3s | %-25s | %-6s | %-s | %-s |\r\n", "#", "Name", "Algo", "Ln", "Type");
+    TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+------+\r\n");
+}
+
+void list_output_formatter_print_body_item_table(size_t index, const TokenInfo* token_info) {
+    TOTP_CLI_PRINTF(
+        "| %-3" PRIu16 " | %-25.25s | %-6s | %-2" PRIu8 " | %-4s |\r\n",
+        index + 1,
+        furi_string_get_cstr(token_info->name),
+        token_info_get_algo_as_cstr(token_info),
+        token_info->digits,
+        token_info_get_type_as_cstr(token_info));
+}
+
+void list_output_formatter_print_footer_table() {
+    TOTP_CLI_PRINTF("+-----+---------------------------+--------+----+------+\r\n");
+}

+ 9 - 0
.modules/totp/totp/cli/plugins/list/formatters/table/list_output_formatter_table.h

@@ -0,0 +1,9 @@
+#pragma once
+
+#include "../../../../../types/token_info.h"
+
+void list_output_formatter_print_header_table();
+
+void list_output_formatter_print_body_item_table(size_t index, const TokenInfo* token_info);
+
+void list_output_formatter_print_footer_table();

+ 20 - 0
.modules/totp/totp/cli/plugins/list/formatters/tsv/list_output_formatter_tsv.c

@@ -0,0 +1,20 @@
+#include "list_output_formatter_tsv.h"
+#include <inttypes.h>
+#include "../../../../cli_helpers.h"
+
+void list_output_formatter_print_header_tsv() {
+    TOTP_CLI_PRINTF("%s\t%s\t%s\t%s\t%s\r\n", "#", "Name", "Algo", "Ln", "Type");
+}
+
+void list_output_formatter_print_body_item_tsv(size_t index, const TokenInfo* token_info) {
+    TOTP_CLI_PRINTF(
+        "%" PRIu16 "\t%s\t%s\t%" PRIu8 "\t%s\r\n",
+        index + 1,
+        furi_string_get_cstr(token_info->name),
+        token_info_get_algo_as_cstr(token_info),
+        token_info->digits,
+        token_info_get_type_as_cstr(token_info));
+}
+
+void list_output_formatter_print_footer_tsv() {
+}

+ 9 - 0
.modules/totp/totp/cli/plugins/list/formatters/tsv/list_output_formatter_tsv.h

@@ -0,0 +1,9 @@
+#pragma once
+
+#include "../../../../../types/token_info.h"
+
+void list_output_formatter_print_header_tsv();
+
+void list_output_formatter_print_body_item_tsv(size_t index, const TokenInfo* token_info);
+
+void list_output_formatter_print_footer_tsv();

+ 82 - 0
.modules/totp/totp/cli/plugins/list/list.c

@@ -0,0 +1,82 @@
+#include <flipper_application/flipper_application.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+
+#include <lib/toolbox/args.h>
+#include "../../../types/token_info.h"
+#include "../../../services/config/constants.h"
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+#include "formatters/table/list_output_formatter_table.h"
+#include "formatters/tsv/list_output_formatter_tsv.h"
+
+typedef void (*TOTP_CLI_LIST_HEADER_FORMATTER)();
+typedef void (*TOTP_CLI_LIST_FOOTER_FORMATTER)();
+typedef void (*TOTP_CLI_LIST_BODY_ITEM_FORMATTER)(size_t index, const TokenInfo* token_info);
+
+typedef struct {
+    const TOTP_CLI_LIST_HEADER_FORMATTER header_formatter;
+    const TOTP_CLI_LIST_FOOTER_FORMATTER footer_formatter;
+    const TOTP_CLI_LIST_BODY_ITEM_FORMATTER body_item_formatter;
+} TotpCliListFormatter;
+
+static const TotpCliListFormatter available_formatters[] = {
+    {.header_formatter = &list_output_formatter_print_header_table,
+     .body_item_formatter = &list_output_formatter_print_body_item_table,
+     .footer_formatter = &list_output_formatter_print_footer_table},
+
+    {.header_formatter = &list_output_formatter_print_header_tsv,
+     .body_item_formatter = &list_output_formatter_print_body_item_tsv,
+     .footer_formatter = &list_output_formatter_print_footer_tsv}};
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+    size_t total_count = totp_token_info_iterator_get_total_count(iterator_context);
+    if(total_count <= 0) {
+        TOTP_CLI_PRINTF("There are no tokens");
+        return;
+    }
+
+    const TotpCliListFormatter* formatter = &available_formatters[0];
+    FuriString* arg = furi_string_alloc();
+    if(args_read_string_and_trim(args, arg) && furi_string_cmpi_str(arg, "--tsv") == 0) {
+        formatter = &available_formatters[1];
+    }
+
+    furi_string_free(arg);
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    size_t original_index = totp_token_info_iterator_get_current_token_index(iterator_context);
+
+    (*formatter->header_formatter)();
+    for(size_t i = 0; i < total_count; i++) {
+        totp_token_info_iterator_go_to(iterator_context, i);
+        const TokenInfo* token_info = totp_token_info_iterator_get_current_token(iterator_context);
+        (*formatter->body_item_formatter)(i, token_info);
+    }
+
+    (*formatter->footer_formatter)();
+
+    totp_token_info_iterator_go_to(iterator_context, original_index);
+
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: List", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_list_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 5 - 0
.modules/totp/totp/cli/plugins/list/meta.h

@@ -0,0 +1,5 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_LIST "list"
+#define TOTP_CLI_COMMAND_LIST_ALT "ls"
+#define TOTP_CLI_PLUGIN_LIST_FILE_NAME "totp_cli_list_plugin"

+ 128 - 0
.modules/totp/totp/cli/plugins/modify/add/add.c

@@ -0,0 +1,128 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../../cli_helpers.h"
+#include "../../../cli_shared_methods.h"
+#include "../../../cli_plugin_interface.h"
+#include "../../../../types/token_info.h"
+#include "../../../../services/config/config.h"
+#include "../../../../services/convert/convert.h"
+#include "../../../../ui/scene_director.h"
+#include "../common.h"
+
+struct TotpAddContext {
+    FuriString* args;
+    Cli* cli;
+    const CryptoSettings* crypto_settings;
+};
+
+enum TotpIteratorUpdateTokenResultsEx {
+    TotpIteratorUpdateTokenResultInvalidSecret = 1,
+    TotpIteratorUpdateTokenResultCancelled = 2,
+    TotpIteratorUpdateTokenResultInvalidArguments = 3
+};
+
+static TotpIteratorUpdateTokenResult
+    add_token_handler(TokenInfo* token_info, const void* context) {
+    const struct TotpAddContext* context_t = context;
+
+    // Reading token name
+    if(!args_read_probably_quoted_string_and_trim(context_t->args, token_info->name)) {
+        return TotpIteratorUpdateTokenResultInvalidArguments;
+    }
+
+    FuriString* temp_str = furi_string_alloc();
+
+    // Read optional arguments
+    bool mask_user_input = true;
+    PlainTokenSecretEncoding token_secret_encoding = PlainTokenSecretEncodingBase32;
+    while(args_read_string_and_trim(context_t->args, temp_str)) {
+        bool parsed = false;
+        if(!totp_cli_try_read_algo(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_digits(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_duration(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_unsecure_flag(temp_str, &parsed, &mask_user_input) &&
+           !totp_cli_try_read_automation_features(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_plain_token_secret_encoding(
+               temp_str, context_t->args, &parsed, &token_secret_encoding) &&
+           !totp_cli_try_read_token_type(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_token_counter(token_info, temp_str, context_t->args, &parsed)) {
+            totp_cli_printf_unknown_argument(temp_str);
+        }
+
+        if(!parsed) {
+            furi_string_free(temp_str);
+            return TotpIteratorUpdateTokenResultInvalidArguments;
+        }
+    }
+
+    // Reading token secret
+    furi_string_reset(temp_str);
+    TOTP_CLI_PRINTF("Enter token secret and confirm with [ENTER]:\r\n");
+    if(!totp_cli_read_line(context_t->cli, temp_str, mask_user_input)) {
+        TOTP_CLI_DELETE_LAST_LINE();
+        furi_string_secure_free(temp_str);
+        return TotpIteratorUpdateTokenResultCancelled;
+    }
+
+    TOTP_CLI_DELETE_LAST_LINE();
+
+    bool secret_set = token_info_set_secret(
+        token_info,
+        furi_string_get_cstr(temp_str),
+        furi_string_size(temp_str),
+        token_secret_encoding,
+        context_t->crypto_settings);
+
+    furi_string_secure_free(temp_str);
+
+    if(!secret_set) {
+        return TotpIteratorUpdateTokenResultInvalidSecret;
+    }
+
+    return TotpIteratorUpdateTokenResultSuccess;
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    struct TotpAddContext add_context = {
+        .args = args, .cli = cli, .crypto_settings = &plugin_state->crypto_settings};
+    TotpIteratorUpdateTokenResult add_result =
+        totp_token_info_iterator_add_new_token(iterator_context, &add_token_handler, &add_context);
+
+    if(add_result == TotpIteratorUpdateTokenResultSuccess) {
+        TOTP_CLI_PRINTF_SUCCESS(
+            "Token \"%s\" has been successfully added\r\n",
+            furi_string_get_cstr(
+                totp_token_info_iterator_get_current_token(iterator_context)->name));
+    } else if(add_result == TotpIteratorUpdateTokenResultCancelled) {
+        TOTP_CLI_PRINTF_INFO("Cancelled by user\r\n");
+    } else if(add_result == TotpIteratorUpdateTokenResultInvalidArguments) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+    } else if(add_result == TotpIteratorUpdateTokenResultInvalidSecret) {
+        TOTP_CLI_PRINTF_ERROR("Token secret seems to be invalid and can not be parsed\r\n");
+    } else if(add_result == TotpIteratorUpdateTokenResultFileUpdateFailed) {
+        TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+    }
+
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Add", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_add_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 6 - 0
.modules/totp/totp/cli/plugins/modify/add/meta.h

@@ -0,0 +1,6 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_ADD "add"
+#define TOTP_CLI_COMMAND_ADD_ALT "mk"
+#define TOTP_CLI_COMMAND_ADD_ALT2 "new"
+#define TOTP_CLI_PLUGIN_ADD_FILE_NAME "totp_cli_add_plugin"

+ 182 - 0
.modules/totp/totp/cli/plugins/modify/common.c

@@ -0,0 +1,182 @@
+#include "common.h"
+#include <lib/toolbox/args.h>
+#include "stdint.h"
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+
+bool totp_cli_try_read_algo(TokenInfo* token_info, FuriString* arg, FuriString* args, bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_ALGO_PREFIX) == 0) {
+        if(!args_read_string_and_trim(args, arg)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_ALGO_PREFIX);
+        } else if(!token_info_set_algo_from_str(token_info, arg)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%s\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_ALGO_PREFIX
+                "\"\r\n",
+                furi_string_get_cstr(arg));
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_digits(
+    TokenInfo* token_info,
+    const FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_DIGITS_PREFIX) == 0) {
+        uint8_t digit_value;
+        if(!args_read_uint8_and_trim(args, &digit_value)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_DIGITS_PREFIX);
+        } else if(!token_info_set_digits_from_int(token_info, digit_value)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%" PRIu8
+                "\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_DIGITS_PREFIX
+                "\"\r\n",
+                digit_value);
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_duration(
+    TokenInfo* token_info,
+    const FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_DURATION_PREFIX) == 0) {
+        uint8_t duration_value;
+        if(!args_read_uint8_and_trim(args, &duration_value)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_DURATION_PREFIX);
+        } else if(!token_info_set_duration_from_int(token_info, duration_value)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%" PRIu8
+                "\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_DURATION_PREFIX
+                "\"\r\n",
+                duration_value);
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_automation_features(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_AUTOMATION_FEATURE_PREFIX) == 0) {
+        if(!args_read_string_and_trim(args, arg)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_AUTOMATION_FEATURE_PREFIX);
+        } else if(!token_info_set_automation_feature_from_str(token_info, arg)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%s\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_AUTOMATION_FEATURE_PREFIX
+                "\"\r\n",
+                furi_string_get_cstr(arg));
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_unsecure_flag(const FuriString* arg, bool* parsed, bool* unsecure_flag) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_UNSECURE_PREFIX) == 0) {
+        *unsecure_flag = false;
+        *parsed = true;
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_plain_token_secret_encoding(
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed,
+    PlainTokenSecretEncoding* secret_encoding) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_SECRET_ENCODING_PREFIX) == 0) {
+        if(!args_read_string_and_trim(args, arg)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_SECRET_ENCODING_PREFIX);
+        } else {
+            if(furi_string_cmpi_str(arg, PLAIN_TOKEN_ENCODING_BASE32_NAME) == 0) {
+                *secret_encoding = PlainTokenSecretEncodingBase32;
+                *parsed = true;
+            } else if(furi_string_cmpi_str(arg, PLAIN_TOKEN_ENCODING_BASE64_NAME) == 0) {
+                *secret_encoding = PlainTokenSecretEncodingBase64;
+                *parsed = true;
+            } else {
+                TOTP_CLI_PRINTF_ERROR(
+                    "\"%s\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_SECRET_ENCODING_PREFIX
+                    "\"\r\n",
+                    furi_string_get_cstr(arg));
+            }
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_token_type(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_TYPE_PREFIX) == 0) {
+        if(!args_read_string_and_trim(args, arg)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_TYPE_PREFIX);
+        } else if(!token_info_set_token_type_from_str(token_info, arg)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%s\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_TYPE_PREFIX
+                "\"\r\n",
+                furi_string_get_cstr(arg));
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+bool totp_cli_try_read_token_counter(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_COUNTER_PREFIX) == 0) {
+        if(!args_read_string_and_trim(args, arg)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_COUNTER_PREFIX);
+        } else if(!token_info_set_token_counter_from_str(token_info, arg)) {
+            TOTP_CLI_PRINTF_ERROR(
+                "\"%s\" is incorrect value for argument \"" TOTP_CLI_COMMAND_ARG_COUNTER_PREFIX
+                "\"\r\n",
+                furi_string_get_cstr(arg));
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}

+ 124 - 0
.modules/totp/totp/cli/plugins/modify/common.h

@@ -0,0 +1,124 @@
+#pragma once
+#include <stdlib.h>
+#include "../../../types/token_info.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TOTP_CLI_COMMAND_ARG_NAME_PREFIX "-n"
+#define TOTP_CLI_COMMAND_ARG_ALGO_PREFIX "-a"
+#define TOTP_CLI_COMMAND_ARG_DIGITS_PREFIX "-d"
+#define TOTP_CLI_COMMAND_ARG_UNSECURE_PREFIX "-u"
+#define TOTP_CLI_COMMAND_ARG_DURATION_PREFIX "-l"
+#define TOTP_CLI_COMMAND_ARG_AUTOMATION_FEATURE_PREFIX "-b"
+#define TOTP_CLI_COMMAND_ARG_SECRET_ENCODING_PREFIX "-e"
+#define TOTP_CLI_COMMAND_ARG_TYPE_PREFIX "-t"
+#define TOTP_CLI_COMMAND_ARG_COUNTER_PREFIX "-i"
+
+/**
+ * @brief Tries to read token hashing algo
+ * @param token_info token info to set parsed algo to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param[out] parsed will be set to \c true if token hashing algo sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token hashing algo argument; \c false otherwise
+ */
+bool totp_cli_try_read_algo(TokenInfo* token_info, FuriString* arg, FuriString* args, bool* parsed);
+
+/**
+ * @brief Tries to read token digits count
+ * @param token_info token info to set parsed digits count to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param[out] parsed will be set to \c true if token digits count sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token digits count argument; \c false otherwise
+ */
+bool totp_cli_try_read_digits(
+    TokenInfo* token_info,
+    const FuriString* arg,
+    FuriString* args,
+    bool* parsed);
+
+/**
+ * @brief Tries to read token duration
+ * @param token_info token info to set parsed duration to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param[out] parsed will be set to \c true if token duration sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token duration argument; \c false otherwise
+ */
+bool totp_cli_try_read_duration(
+    TokenInfo* token_info,
+    const FuriString* arg,
+    FuriString* args,
+    bool* parsed);
+
+/**
+ * @brief Tries to read token automation features
+ * @param token_info token info to set parsed automation features to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param[out] parsed will be set to \c true if token automation features sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token automation features argument; \c false otherwise
+ */
+bool totp_cli_try_read_automation_features(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed);
+
+/**
+ * @brief Tries to read unsecure flag
+ * @param arg argument to parse
+ * @param[out] parsed will be set to \c true if unsecure flag sucecssfully read and parsed; \c false otherwise
+ * @param[out] unsecure_flag will be set to parsed unsecure flag state if read and parsed successfully
+ * @return \c true if \c arg represents unsecure flag argument; \c false otherwise
+ */
+bool totp_cli_try_read_unsecure_flag(const FuriString* arg, bool* parsed, bool* unsecure_flag);
+
+/**
+ * @brief Tries to read plain token secret encoding
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param[out] parsed will be set to \c true if plain token secret encoding sucecssfully read and parsed; \c false otherwise
+ * @param[out] secret_encoding will be set to parsed plain token secret encoding if read and parsed successfully
+ * @return \c true if \c arg represents plain token secret encoding argument; \c false otherwise
+ */
+bool totp_cli_try_read_plain_token_secret_encoding(
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed,
+    PlainTokenSecretEncoding* secret_encoding);
+
+/**
+ * @brief Tries to read token type
+ * @param token_info token info to set parsed token type to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param parsed will be set to \c true if token type sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token type argument; \c false otherwise
+ */
+bool totp_cli_try_read_token_type(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed);
+
+/**
+ * @brief Tries to read token counter
+ * @param token_info token info to set parsed token counter to if successfully read and parsed
+ * @param arg argument to parse
+ * @param args rest of arguments
+ * @param parsed will be set to \c true if token counter sucecssfully read and parsed; \c false otherwise
+ * @return \c true if \c arg represents token counter argument; \c false otherwise
+ */
+bool totp_cli_try_read_token_counter(
+    TokenInfo* token_info,
+    FuriString* arg,
+    FuriString* args,
+    bool* parsed);
+
+#ifdef __cplusplus
+}
+#endif

+ 4 - 0
.modules/totp/totp/cli/plugins/modify/update/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_UPDATE "update"
+#define TOTP_CLI_PLUGIN_UPDATE_FILE_NAME "totp_cli_update_plugin"

+ 167 - 0
.modules/totp/totp/cli/plugins/modify/update/update.c

@@ -0,0 +1,167 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../../cli_helpers.h"
+#include "../../../cli_shared_methods.h"
+#include "../../../cli_plugin_interface.h"
+#include "../../../../types/token_info.h"
+#include "../../../../services/config/config.h"
+#include "../../../../services/convert/convert.h"
+#include "../../../../ui/scene_director.h"
+#include "../common.h"
+
+#define TOTP_CLI_COMMAND_UPDATE_ARG_SECRET_PREFIX "-s"
+
+struct TotpUpdateContext {
+    FuriString* args;
+    Cli* cli;
+    const CryptoSettings* crypto_settings;
+};
+
+enum TotpIteratorUpdateTokenResultsEx {
+    TotpIteratorUpdateTokenResultInvalidSecret = 1,
+    TotpIteratorUpdateTokenResultCancelled = 2,
+    TotpIteratorUpdateTokenResultInvalidArguments = 3
+};
+
+static bool totp_cli_try_read_name(
+    TokenInfo* token_info,
+    const FuriString* arg,
+    FuriString* args,
+    bool* parsed) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_ARG_NAME_PREFIX) == 0) {
+        if(!args_read_probably_quoted_string_and_trim(args, token_info->name) ||
+           furi_string_empty(token_info->name)) {
+            totp_cli_printf_missed_argument_value(TOTP_CLI_COMMAND_ARG_NAME_PREFIX);
+        } else {
+            *parsed = true;
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+static bool totp_cli_try_read_change_secret_flag(const FuriString* arg, bool* parsed, bool* flag) {
+    if(furi_string_cmpi_str(arg, TOTP_CLI_COMMAND_UPDATE_ARG_SECRET_PREFIX) == 0) {
+        *flag = true;
+        *parsed = true;
+        return true;
+    }
+
+    return false;
+}
+
+static TotpIteratorUpdateTokenResult
+    update_token_handler(TokenInfo* token_info, const void* context) {
+    const struct TotpUpdateContext* context_t = context;
+
+    // Read optional arguments
+    FuriString* temp_str = furi_string_alloc();
+    bool mask_user_input = true;
+    bool update_token_secret = false;
+    PlainTokenSecretEncoding token_secret_encoding = PlainTokenSecretEncodingBase32;
+    while(args_read_string_and_trim(context_t->args, temp_str)) {
+        bool parsed = false;
+        if(!totp_cli_try_read_name(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_algo(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_digits(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_duration(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_unsecure_flag(temp_str, &parsed, &mask_user_input) &&
+           !totp_cli_try_read_change_secret_flag(temp_str, &parsed, &update_token_secret) &&
+           !totp_cli_try_read_automation_features(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_plain_token_secret_encoding(
+               temp_str, context_t->args, &parsed, &token_secret_encoding) &&
+           !totp_cli_try_read_token_type(token_info, temp_str, context_t->args, &parsed) &&
+           !totp_cli_try_read_token_counter(token_info, temp_str, context_t->args, &parsed)) {
+            totp_cli_printf_unknown_argument(temp_str);
+        }
+
+        if(!parsed) {
+            furi_string_free(temp_str);
+            return TotpIteratorUpdateTokenResultInvalidArguments;
+        }
+    }
+
+    if(update_token_secret) {
+        // Reading token secret
+        furi_string_reset(temp_str);
+        TOTP_CLI_PRINTF("Enter token secret and confirm with [ENTER]:\r\n");
+        bool token_secret_read = totp_cli_read_line(context_t->cli, temp_str, mask_user_input);
+        TOTP_CLI_DELETE_LAST_LINE();
+        if(!token_secret_read) {
+            furi_string_secure_free(temp_str);
+            return TotpIteratorUpdateTokenResultCancelled;
+        }
+
+        if(!token_info_set_secret(
+               token_info,
+               furi_string_get_cstr(temp_str),
+               furi_string_size(temp_str),
+               token_secret_encoding,
+               context_t->crypto_settings)) {
+            furi_string_secure_free(temp_str);
+            return TotpIteratorUpdateTokenResultInvalidSecret;
+        }
+    }
+
+    furi_string_secure_free(temp_str);
+
+    return TotpIteratorUpdateTokenResultSuccess;
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+
+    int token_number;
+    if(!args_read_int_and_trim(args, &token_number) || token_number <= 0 ||
+       (size_t)token_number > totp_token_info_iterator_get_total_count(iterator_context)) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        return;
+    }
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    size_t previous_index = totp_token_info_iterator_get_current_token_index(iterator_context);
+    totp_token_info_iterator_go_to(iterator_context, token_number - 1);
+
+    struct TotpUpdateContext update_context = {
+        .args = args, .cli = cli, .crypto_settings = &plugin_state->crypto_settings};
+    TotpIteratorUpdateTokenResult update_result = totp_token_info_iterator_update_current_token(
+        iterator_context, &update_token_handler, &update_context);
+
+    if(update_result == TotpIteratorUpdateTokenResultSuccess) {
+        TOTP_CLI_PRINTF_SUCCESS(
+            "Token \"%s\" has been successfully updated\r\n",
+            furi_string_get_cstr(
+                totp_token_info_iterator_get_current_token(iterator_context)->name));
+    } else if(update_result == TotpIteratorUpdateTokenResultInvalidArguments) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+    } else if(update_result == TotpIteratorUpdateTokenResultCancelled) {
+        TOTP_CLI_PRINTF_INFO("Cancelled by user\r\n");
+    } else if(update_result == TotpIteratorUpdateTokenResultInvalidSecret) {
+        TOTP_CLI_PRINTF_ERROR("Token secret seems to be invalid and can not be parsed\r\n");
+    } else if(update_result == TotpIteratorUpdateTokenResultFileUpdateFailed) {
+        TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+    }
+
+    totp_token_info_iterator_go_to(iterator_context, previous_index);
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Update", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_update_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 5 - 0
.modules/totp/totp/cli/plugins/move/meta.h

@@ -0,0 +1,5 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_MOVE "move"
+#define TOTP_CLI_COMMAND_MOVE_ALT "mv"
+#define TOTP_CLI_PLUGIN_MOVE_FILE_NAME "totp_cli_move_plugin"

+ 75 - 0
.modules/totp/totp/cli/plugins/move/move.c

@@ -0,0 +1,75 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../types/token_info.h"
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    int token_number;
+    TokenInfoIteratorContext* iterator_context =
+        totp_config_get_token_iterator_context(plugin_state);
+    size_t total_count = totp_token_info_iterator_get_total_count(iterator_context);
+    if(!args_read_int_and_trim(args, &token_number) || token_number < 1 ||
+       (size_t)token_number > total_count) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        return;
+    }
+
+    int new_token_number = 0;
+
+    if(!args_read_int_and_trim(args, &new_token_number) || new_token_number < 1 ||
+       (size_t)new_token_number > total_count) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        return;
+    }
+
+    if(token_number == new_token_number) {
+        TOTP_CLI_PRINTF_ERROR("New token number matches current token number\r\n");
+        return;
+    }
+
+    TOTP_CLI_LOCK_UI(plugin_state);
+
+    size_t token_index = token_number - 1;
+    size_t new_token_index = new_token_number - 1;
+
+    size_t original_token_index =
+        totp_token_info_iterator_get_current_token_index(iterator_context);
+
+    TOTP_CLI_PRINT_PROCESSING();
+
+    if(totp_token_info_iterator_go_to(iterator_context, token_index) &&
+       totp_token_info_iterator_move_current_token_info(iterator_context, new_token_index)) {
+        TOTP_CLI_DELETE_LAST_LINE();
+        TOTP_CLI_PRINTF_SUCCESS(
+            "Token \"%s\" has been successfully updated\r\n",
+            furi_string_get_cstr(
+                totp_token_info_iterator_get_current_token(iterator_context)->name));
+    } else {
+        TOTP_CLI_DELETE_LAST_LINE();
+        TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+    }
+
+    totp_token_info_iterator_go_to(iterator_context, original_token_index);
+
+    TOTP_CLI_UNLOCK_UI(plugin_state);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Move", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_move_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 4 - 0
.modules/totp/totp/cli/plugins/notification/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_NOTIFICATION "notify"
+#define TOTP_CLI_PLUGIN_NOTIFICATION_FILE_NAME "totp_cli_notification_plugin"

+ 97 - 0
.modules/totp/totp/cli/plugins/notification/notification.c

@@ -0,0 +1,97 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+
+#define TOTP_CLI_COMMAND_NOTIFICATION_METHOD_NONE "none"
+#define TOTP_CLI_COMMAND_NOTIFICATION_METHOD_SOUND "sound"
+#define TOTP_CLI_COMMAND_NOTIFICATION_METHOD_VIBRO "vibro"
+
+static void
+    totp_cli_command_notification_print_method(NotificationMethod method, const char* color) {
+    bool has_previous_method = false;
+    if(method & NotificationMethodSound) {
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_NOTIFICATION_METHOD_SOUND "\"");
+        has_previous_method = true;
+    }
+    if(method & NotificationMethodVibro) {
+        if(has_previous_method) {
+            TOTP_CLI_PRINTF_COLORFUL(color, " and ");
+        }
+
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_NOTIFICATION_METHOD_VIBRO "\"");
+    }
+    if(method == NotificationMethodNone) {
+        TOTP_CLI_PRINTF_COLORFUL(color, "\"" TOTP_CLI_COMMAND_NOTIFICATION_METHOD_NONE "\"");
+    }
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    FuriString* temp_str = furi_string_alloc();
+    bool new_method_provided = false;
+    NotificationMethod new_method = NotificationMethodNone;
+    bool args_valid = true;
+    while(args_read_string_and_trim(args, temp_str)) {
+        if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_NOTIFICATION_METHOD_NONE) == 0) {
+            new_method_provided = true;
+            new_method = NotificationMethodNone;
+        } else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_NOTIFICATION_METHOD_SOUND) == 0) {
+            new_method_provided = true;
+            new_method |= NotificationMethodSound;
+        } else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_NOTIFICATION_METHOD_VIBRO) == 0) {
+            new_method_provided = true;
+            new_method |= NotificationMethodVibro;
+        } else {
+            args_valid = false;
+            break;
+        }
+    }
+
+    do {
+        if(!args_valid) {
+            TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+            break;
+        }
+
+        if(new_method_provided) {
+            TOTP_CLI_LOCK_UI(plugin_state);
+
+            plugin_state->notification_method = new_method;
+            if(totp_config_file_update_notification_method(plugin_state)) {
+                TOTP_CLI_PRINTF_SUCCESS("Notification method is set to ");
+                totp_cli_command_notification_print_method(new_method, TOTP_CLI_COLOR_SUCCESS);
+                cli_nl();
+            } else {
+                TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+            }
+
+            TOTP_CLI_UNLOCK_UI(plugin_state);
+        } else {
+            TOTP_CLI_PRINTF_INFO("Current notification method is ");
+            totp_cli_command_notification_print_method(
+                plugin_state->notification_method, TOTP_CLI_COLOR_INFO);
+            cli_nl();
+        }
+    } while(false);
+
+    furi_string_free(temp_str);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Notification", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_notification_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 4 - 0
.modules/totp/totp/cli/plugins/pin/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_PIN "pin"
+#define TOTP_CLI_PLUGIN_PIN_FILE_NAME "totp_cli_pin_plugin"

+ 179 - 0
.modules/totp/totp/cli/plugins/pin/pin.c

@@ -0,0 +1,179 @@
+#include <flipper_application/flipper_application.h>
+#include <lib/toolbox/args.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../types/token_info.h"
+#include "../../../types/user_pin_codes.h"
+#include "../../../services/config/config.h"
+#include "../../../services/crypto/crypto_facade.h"
+#include "../../../ui/scene_director.h"
+#include "../../../lib/polyfills/memset_s.h"
+
+#define TOTP_CLI_COMMAND_PIN_COMMAND_SET "set"
+#define TOTP_CLI_COMMAND_PIN_COMMAND_REMOVE "remove"
+#define TOTP_CLI_COMMAND_PIN_ARG_NEW_CRYPTO_KEY_SLOT_PREFIX "-c"
+
+static inline uint8_t totp_cli_key_to_pin_code(uint8_t key) {
+    uint8_t code = 0;
+    switch(key) {
+    case 0x44: // left
+        code = PinCodeArrowLeft;
+        break;
+    case 0x41: // up
+        code = PinCodeArrowUp;
+        break;
+    case 0x43: // right
+        code = PinCodeArrowRight;
+        break;
+    case 0x42: // down
+        code = PinCodeArrowDown;
+        break;
+    default:
+        break;
+    }
+
+    return code;
+}
+
+static bool totp_cli_read_pin(Cli* cli, uint8_t* pin, uint8_t* pin_length) {
+    TOTP_CLI_PRINTF("Enter new PIN (use arrow keys on your keyboard): ");
+    fflush(stdout);
+    uint8_t c;
+    *pin_length = 0;
+    while(cli_read(cli, &c, 1) == 1) {
+        if(c == CliSymbolAsciiEsc) {
+            uint8_t c2;
+            uint8_t c3;
+            if(cli_read_timeout(cli, &c2, 1, 0) == 1 && cli_read_timeout(cli, &c3, 1, 0) == 1 &&
+               c2 == 0x5b) {
+                uint8_t code = totp_cli_key_to_pin_code(c3);
+                if(code > 0) {
+                    pin[*pin_length] = code;
+                    *pin_length = *pin_length + 1;
+                    putc('*', stdout);
+                    fflush(stdout);
+                }
+            }
+        } else if(c == CliSymbolAsciiETX) {
+            TOTP_CLI_DELETE_CURRENT_LINE();
+            TOTP_CLI_PRINTF_INFO("Cancelled by user\r\n");
+            return false;
+        } else if(c == CliSymbolAsciiBackspace || c == CliSymbolAsciiDel) {
+            if(*pin_length > 0) {
+                *pin_length = *pin_length - 1;
+                pin[*pin_length] = 0;
+                TOTP_CLI_DELETE_LAST_CHAR();
+            }
+        } else if(c == CliSymbolAsciiCR) {
+            cli_nl();
+            break;
+        }
+    }
+
+    TOTP_CLI_DELETE_LAST_LINE();
+    return true;
+}
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    UNUSED(plugin_state);
+    FuriString* temp_str = furi_string_alloc();
+
+    bool do_change = false;
+    bool do_remove = false;
+    uint8_t crypto_key_slot = plugin_state->crypto_settings.crypto_key_slot;
+
+    bool arguments_parsed = true;
+    while(args_read_string_and_trim(args, temp_str)) {
+        if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_PIN_COMMAND_SET) == 0) {
+            do_change = true;
+        } else if(furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_PIN_COMMAND_REMOVE) == 0) {
+            do_remove = true;
+        } else if(
+            furi_string_cmpi_str(temp_str, TOTP_CLI_COMMAND_PIN_ARG_NEW_CRYPTO_KEY_SLOT_PREFIX) ==
+            0) {
+            if(!args_read_uint8_and_trim(args, &crypto_key_slot) ||
+               !totp_crypto_check_key_slot(crypto_key_slot)) {
+                TOTP_CLI_PRINTF_ERROR("Slot \"%" PRIu8 "\" can not be used\r\n", crypto_key_slot);
+                arguments_parsed = false;
+                break;
+            }
+        } else {
+            TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+            arguments_parsed = false;
+            break;
+        }
+    }
+
+    if(!(do_change || do_remove) || (do_change && do_remove)) {
+        TOTP_CLI_PRINT_INVALID_ARGUMENTS();
+        arguments_parsed = false;
+    }
+
+    if(arguments_parsed && totp_cli_ensure_authenticated(plugin_state, cli)) {
+        TOTP_CLI_LOCK_UI(plugin_state);
+        do {
+            uint8_t new_pin[CRYPTO_IV_LENGTH];
+            memset(&new_pin[0], 0, CRYPTO_IV_LENGTH);
+            uint8_t new_pin_length = 0;
+            if(do_change) {
+                if(!totp_cli_read_pin(cli, &new_pin[0], &new_pin_length)) {
+                    memset_s(&new_pin[0], CRYPTO_IV_LENGTH, 0, CRYPTO_IV_LENGTH);
+                    break;
+                }
+            } else if(do_remove) {
+                new_pin_length = 0;
+                memset(&new_pin[0], 0, CRYPTO_IV_LENGTH);
+            }
+
+            char* backup_path = totp_config_file_backup(plugin_state);
+            if(backup_path != NULL) {
+                TOTP_CLI_PRINTF_WARNING("Backup conf file %s has been created\r\n", backup_path);
+                TOTP_CLI_PRINTF_WARNING(
+                    "Once you make sure everything is fine and works as expected, please delete this backup file\r\n");
+                free(backup_path);
+            } else {
+                memset_s(&new_pin[0], CRYPTO_IV_LENGTH, 0, CRYPTO_IV_LENGTH);
+                TOTP_CLI_PRINTF_ERROR(
+                    "An error has occurred during taking backup of config file\r\n");
+                break;
+            }
+
+            TOTP_CLI_PRINTF("Encrypting...\r\n");
+
+            bool update_result = totp_config_file_update_encryption(
+                plugin_state, crypto_key_slot, new_pin, new_pin_length);
+
+            memset_s(&new_pin[0], CRYPTO_IV_LENGTH, 0, CRYPTO_IV_LENGTH);
+
+            TOTP_CLI_DELETE_LAST_LINE();
+
+            if(update_result) {
+                if(do_change) {
+                    TOTP_CLI_PRINTF_SUCCESS("PIN has been successfully changed\r\n");
+                } else if(do_remove) {
+                    TOTP_CLI_PRINTF_SUCCESS("PIN has been successfully removed\r\n");
+                }
+            } else {
+                TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+            }
+
+        } while(false);
+
+        TOTP_CLI_UNLOCK_UI(plugin_state);
+    }
+
+    furi_string_free(temp_str);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: PIN", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_pin_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 4 - 0
.modules/totp/totp/cli/plugins/reset/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_RESET "reset"
+#define TOTP_CLI_PLUGIN_RESET_FILE_NAME "totp_cli_reset_plugin"

+ 43 - 0
.modules/totp/totp/cli/plugins/reset/reset.c

@@ -0,0 +1,43 @@
+#include <flipper_application/flipper_application.h>
+#include "../../cli_helpers.h"
+#include "../../cli_shared_methods.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../ui/scene_director.h"
+#include "../../../services/config/config.h"
+
+#define TOTP_CLI_RESET_CONFIRMATION_KEYWORD "YES"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    UNUSED(args);
+    TOTP_CLI_LOCK_UI(plugin_state);
+    TOTP_CLI_PRINTF_WARNING(
+        "As a result of reset all the settings and tokens will be permanently lost.\r\n");
+    TOTP_CLI_PRINTF_WARNING("Do you really want to reset application?\r\n");
+    TOTP_CLI_PRINTF_WARNING("Type \"" TOTP_CLI_RESET_CONFIRMATION_KEYWORD
+                            "\" and hit <ENTER> to confirm:\r\n");
+    FuriString* temp_str = furi_string_alloc();
+    bool is_confirmed = totp_cli_read_line(cli, temp_str, false) &&
+                        furi_string_cmpi_str(temp_str, TOTP_CLI_RESET_CONFIRMATION_KEYWORD) == 0;
+    furi_string_free(temp_str);
+    if(is_confirmed) {
+        totp_config_file_reset(plugin_state);
+        TOTP_CLI_PRINTF_SUCCESS("Application has been successfully reset to default.\r\n");
+        TOTP_CLI_PRINTF_SUCCESS("Now application will be closed to apply all the changes.\r\n");
+        totp_cli_force_close_app(plugin_state->event_queue);
+    } else {
+        TOTP_CLI_PRINTF_INFO("Action was not confirmed by user\r\n");
+        TOTP_CLI_UNLOCK_UI(plugin_state);
+    }
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Reset", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_reset_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 5 - 0
.modules/totp/totp/cli/plugins/timezone/meta.h

@@ -0,0 +1,5 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_TIMEZONE "timezone"
+#define TOTP_CLI_COMMAND_TIMEZONE_ALT "tz"
+#define TOTP_CLI_PLUGIN_TIMEZONE_FILE_NAME "totp_cli_timezone_plugin"

+ 49 - 0
.modules/totp/totp/cli/plugins/timezone/timezone.c

@@ -0,0 +1,49 @@
+#include <lib/toolbox/args.h>
+#include <flipper_application/flipper_application.h>
+#include "../../../services/config/config.h"
+#include "../../../ui/scene_director.h"
+#include "../../cli_helpers.h"
+#include "../../cli_plugin_interface.h"
+#include "../../cli_shared_methods.h"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    UNUSED(args);
+    UNUSED(plugin_state);
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
+    FuriString* temp_str = furi_string_alloc();
+    if(args_read_string_and_trim(args, temp_str)) {
+        char* strtof_endptr;
+        float tz = strtof(furi_string_get_cstr(temp_str), &strtof_endptr);
+        if(*strtof_endptr == 0 && tz >= -12.75f && tz <= 12.75f) {
+            TOTP_CLI_LOCK_UI(plugin_state);
+            plugin_state->timezone_offset = tz;
+            if(totp_config_file_update_timezone_offset(plugin_state)) {
+                TOTP_CLI_PRINTF_SUCCESS("Timezone is set to %f\r\n", (double)tz);
+            } else {
+                TOTP_CLI_PRINT_ERROR_UPDATING_CONFIG_FILE();
+            }
+            TOTP_CLI_UNLOCK_UI(plugin_state);
+        } else {
+            TOTP_CLI_PRINTF_ERROR("Invalid timezone offset\r\n");
+        }
+    } else {
+        TOTP_CLI_PRINTF_INFO(
+            "Current timezone offset is %f\r\n", (double)plugin_state->timezone_offset);
+    }
+    furi_string_free(temp_str);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Timezone", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_timezone_plugin_ep() {
+    return &plugin_descriptor;
+}

+ 4 - 0
.modules/totp/totp/cli/plugins/version/meta.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TOTP_CLI_COMMAND_VERSION "version"
+#define TOTP_CLI_PLUGIN_VERSION_FILE_NAME "totp_cli_version_plugin"

+ 27 - 0
.modules/totp/totp/cli/plugins/version/version.c

@@ -0,0 +1,27 @@
+#include <flipper_application/flipper_application.h>
+#include "../../cli_helpers.h"
+#include "../../cli_plugin_interface.h"
+#include "../../../version.h"
+
+static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
+    UNUSED(args);
+    UNUSED(cli);
+    UNUSED(plugin_state);
+    TOTP_CLI_PRINTF(
+        "%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\r\n",
+        TOTP_APP_VERSION_MAJOR,
+        TOTP_APP_VERSION_MINOR,
+        TOTP_APP_VERSION_PATCH);
+}
+
+static const CliPlugin plugin = {.name = "TOTP CLI Plugin: Version", .handle = &handle};
+
+static const FlipperAppPluginDescriptor plugin_descriptor = {
+    .appid = PLUGIN_APP_ID,
+    .ep_api_version = PLUGIN_API_VERSION,
+    .entry_point = &plugin,
+};
+
+const FlipperAppPluginDescriptor* totp_cli_version_plugin_ep() {
+    return &plugin_descriptor;
+}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików