Giter Site home page Giter Site logo

powertoysruntotp's Introduction

Powertoys Run TOTP Plugin

A plugin helps you to copy your two-factor verification code in Powertoys Run

Screenshot

screenshot

Installation

  1. Download plugin from Release
  2. Extract it to %LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins

Upgrade

  1. Download plugin from Release
  2. Delete %LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins\TOTP (Will not lose any data)
  3. Extract it to %LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins

Usage

  1. Add account
    Plugin support standard OTPAuth URI (starts with otpauth://) and Google Authenticator Export URI(starts with otpauth-migration://), you can paste it to the PT Run input bar and you will see an option to add it to list.
    You can use any QRCode scanner to resolve QRCode to link, Accounts with same key in the list will not be added.
    You can also add manually by editing config file in %LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Settings\Plugins\Community.PowerToys.Run.Plugin.TOTP\OTPList.json:

    {
        "Version": 2,
        "Entries": [
            {
                "Name": "Github: Hello",
                "Key": "12313",
                "IsEncrypted": false
            },
            {
                "Name": "Twitter: @Hello",
                "Key": "12313213",
                "IsEncrypted": false
            }
        ]
    }

    Change to the config file will be applied immediately.
    Once the plugin loads the config again, all unencrypted data will be encrypted.

  2. Delete account
    There is no way to delete accounts by GUI.
    You delete an account by editing the config file in %LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Settings\Plugins\Community.PowerToys.Run.Plugin.TOTP\OTPList.json. Change to the config file will be applied immediately.

About Encryption

Plugin uses System.Security.Cryptography.ProtectedData to encrypt every key. All keys will be decrypted in memory if needed.
Encrypted data only can be decrypted in your current machine with the current account login, if you reinstall the OS or change the account you log in to, the key cannot be decrypted.

Build Plugin

  1. Clone repo
  2. Use "Publish" to build plugin and copy dependencies
  3. Use ILRepack to bundle all dependencies to a single file(Powertoys doesn't support load dll by the PTRun plugin).
      # In publish directory 
      ~\.nuget\packages\ilrepack\2.0.18\tools\ILRepack.exe /lib:"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.25" /out:Community.PowerToys.Run.Plugin.TOTP.dll .\Community.PowerToys.Run.Plugin.TOTP.dll .\Google.Protobuf.dll .\Otp.NET.dll
    
  4. Use ILRepack to generate PowerToysRunTOTP.dll to replace the original output.

powertoysruntotp's People

Contributors

kawaiizapic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

powertoysruntotp's Issues

Crash after pasting authenticator URL

When i try to paste the authenticator url it initially is recognized correctly and shows a prompt to import items:
image

When I confirm the import Power toys crash:
image

I have noticed that the json config file stays at 0 bytes
image

In my attempt to troubleshoot I deleted the config file and attempted the setup again. This time it did not crush, but the config file was again created with 0 length. When i entered '[' I got the following message:

image

Is there any more information you need to help troubleshoot this?

Action keyword

The 1.1.0 release of TOTP has the same action keyword, #, as the out of the box Value Generator plugin.
This could be confusing.

Lose data after update

After updating PowerToys to the latest version (0.78), the plugin has lost all data (OTPList is empty)

This plugin does not work

Did I do something wrong?

image

[2024-04-15 11:33:57.2088] [ERROR] [C:\a\_work\1\s\src\modules\launcher\PowerLauncher\Plugin\PluginManager.cs::239]
-------------------------- Begin exception --------------------------
Message: Exception for plugin <TOTP> when query <[>

Exception full name  : System.ArgumentException
Exception message    : Character is not a Base32 character. (Parameter 'c')
Exception stack trace:
   at OtpNet.Base32Encoding.CharToValue(Char c)
   at OtpNet.Base32Encoding.ToBytes(String input)
   at Community.PowerToys.Run.Plugin.TOTP.Main.<>c__DisplayClass17_0.<Query>b__0(KeyEntry totp)
   at Community.PowerToys.Run.Plugin.TOTP.Main.Query(Query query)
   at PowerLauncher.Plugin.PluginManager.<>c__DisplayClass23_0.<QueryForPlugin>b__0()
   at Wox.Infrastructure.Stopwatch.Debug(String message, Action action)
   at PowerLauncher.Plugin.PluginManager.QueryForPlugin(PluginPair pair, Query query, Boolean delayedExecution)
Exception source     : Community.PowerToys.Run.Plugin.TOTP
Exception target site: Int32 CharToValue(Char)
Exception HResult    : -2147024809
-------------------------- End exception --------------------------


[2024-04-15 11:33:57.3553] [ERROR] [C:\a\_work\1\s\src\modules\launcher\PowerLauncher\Plugin\PluginManager.cs::239]
-------------------------- Begin exception --------------------------
Message: Exception for plugin <TOTP> when query <[>

Exception full name  : System.ArgumentException
Exception message    : Character is not a Base32 character. (Parameter 'c')
Exception stack trace:
   at OtpNet.Base32Encoding.CharToValue(Char c)
   at OtpNet.Base32Encoding.ToBytes(String input)
   at Community.PowerToys.Run.Plugin.TOTP.Main.<>c__DisplayClass17_0.<Query>b__0(KeyEntry totp)
   at Community.PowerToys.Run.Plugin.TOTP.Main.Query(Query query)
   at PowerLauncher.Plugin.PluginManager.<>c__DisplayClass23_0.<QueryForPlugin>b__0()
   at Wox.Infrastructure.Stopwatch.Debug(String message, Action action)
   at PowerLauncher.Plugin.PluginManager.QueryForPlugin(PluginPair pair, Query query, Boolean delayedExecution)
Exception source     : Community.PowerToys.Run.Plugin.TOTP
Exception target site: Int32 CharToValue(Char)
Exception HResult    : -2147024809
-------------------------- End exception --------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.