Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import 2FAS #277

Closed
1 task done
captainabloc opened this issue Jan 10, 2024 · 5 comments
Closed
1 task done

import 2FAS #277

captainabloc opened this issue Jan 10, 2024 · 5 comments

Comments

@captainabloc
Copy link

Version

5.0.2

Details & Steps to reproduce

Hi Everyone,

trying to import a 2fas file with the following scheme:
"schemaVersion":4,"appVersionCode":5000012,"appVersionName":"5.2.0","appOrigin":"android"
leads to "server error" message.

how could I proceed?

image

Expectation

import data from 2fas-backup.2fas (not encrypted)

Error & Logs

[2024-01-10 12:04:58] local.ERROR: Undefined array key "algorithm" {"userId":1,"exception":"[object] (ErrorException(code: 0): Undefined array key \"algorithm\" at /srv/app/Services/Migrators/TwoFASMigrator.php:89)

Execution environment

docker-compose

Containerization

  • Docker

Additional information

data folder on debian machine located on /2fauth, docker-compose used, and up.

@Bubka
Copy link
Owner

Bubka commented Jan 10, 2024

Hi,

It's weird, your export file is missing a property normally available in 2FAs export. Could you open the 2fas file with a text editor and check how are composed the otp objects?
They look like this, except that at least one of them does not contain the algorithm property:

"otp":
{
    "account": "My account",
    "digits": 6,
    "counter": 0,
    "period": 30,
    "algorithm": "SHA1",
    "tokenType": "TOTP"
}

How many don't have the algorithm property? For them, what is their tokenType?

@captainabloc
Copy link
Author

Hi,
I have 6 objects. Upon those 6, one only hasn't the algorithm property.
this is the one for ssh totp:

otp{6}
link:otpauth://totp/account?secret=supersecret&issuer=access
label:ssh@access
account:myaccounts
issuer:access
tokenType:TOTP
source:Link

and indeed, this is the only one not having

    "digits": 6,
    "counter": 0,
    "period": 30,
    "algorithm": "SHA1",

infos

@captainabloc
Copy link
Author

captainabloc commented Jan 10, 2024

and nice catch!
removing that one from the file makes it working!

thanks for the trick.

Do you, by chance, know a solution to get that one working too?

@Bubka
Copy link
Owner

Bubka commented Jan 10, 2024

This is what I'm currently looking for. For now all the exports I made with 2FAs always had these missing props.

Can you try this:

  • Edit your export and add the following properties to the ssh item:
      "digits": 6,
      "period": 30,
      "algorithm": "SHA1",
    
  • Import to 2FAuth, you shouldn't face any error
  • Generate a code for the ssh account in 2FAuth then compare it to a code generated by 2FAs.

Do you get the same code?
Is there anything special about how this ssh account was registered into 2FAs?

@captainabloc
Copy link
Author

you rock!
working perfect now, thanks and congrats for your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants