HowTo: migrating from Two Factor Authenticator browser extension to 2FAuth
-
I have been using the Two Factor Authenticator browser extension for a while now. However, it's not been updated for a while. I also have to keep reminding myself to keep a copy of all the 2fa and also it's not really safe to have 2fa in a browser extension....
It's straightforward to migrate to the 2FAuth:
- First, export all the keys. Firefox -> Extension Preferences -> Export . This gives a json file.
- There is UI in 2FAuth to import keys. However, this wants a line separated otpuri . Syntax for this is
otpauth://TYPE/LABEL?PARAMETERS
. Exampleotpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
. Maybe , chatgpt helps with the conversion here But , I had this via node REPL:
$ node Welcome to Node.js v20.12.2. Type ".help" for more information. > data = JSON.parse(fs.readFileSync('/home/girish/Downloads/totp.json', 'utf8')) > data.otp_list.forEach(otp => console.log(`otpauth://totp/${encodeURIComponent(otp.name)}?secret=${otp.key}&issuer=${encodeURIComponent(otp.name)}`))
-
The above will generate like this
-
Copy/paste the output into the Import UI of 2FAuth. That's it!