Levminer / authme

Simple cross-platform two-factor (2FA) authenticator app for desktop.
https://authme.levminer.com
GNU General Public License v3.0
340 stars 29 forks source link

2FAS Import Issue - Failed to construct 'URL': Invalid URL #318

Open SakulFlee opened 3 days ago

SakulFlee commented 3 days ago

Before the bug report.

Authme/System information

Authme 5.3.0 release.240910.164148

Authme log

[AUTHME LOG] (2024. 09. 17. 21:27:01) Authme 5.3.0 release.240910.164148 [AUTHME LOG] (2024. 09. 17. 21:27:26) Path changed: /import [AUTHME ERROR] (2024. 09. 17. 21:27:31) Unknown runtime error occurred: TypeError: Failed to construct 'URL': Invalid URL

Describe the bug

Just tried to import my 2FAS Backup (no password set, freshly exported) into AuthMe and it gives me the error Unknown runtime error occurred: TypeError: Failed to construct 'URL': Invalid URL. I've found https://github.com/Levminer/authme/issues/288#issuecomment-2116261849, but that seems to be referring to a completely different format. I think 2FAS may have changed the export format again.

To reproduce

  1. Have a 2FAS account or make one with at least one TOTP Token
  2. Export 2FAS Backup (passwordless)
  3. Import 2FAS Backup into AuthMe
  4. Observe Error

Additional information

I'll include a sanitized 2FAS Backup file below. The mentioned "link": "otpauth://totp/ path is no where to be found.

// 2fas-backup.2fas
 {
    "services": [
        {
            "name": "LABEL",
            "secret": "SECRET_KEY",
            "updatedAt": UNIX_TIMESTAMP,
            "serviceTypeID": "UUID",
            "otp": {
                "label": "LABEL",
                "account": "LABEL",
                "issuer": "LABEL",
                "digits": 6,
                "period": 30,
                "algorithm": "SHA1",
                "tokenType": "TOTP",
                "source": "Link"
            },
            "order": {
                "position": 0
            },
            "icon": {
                "selected": "IconCollection",
                "iconCollection": {
                    "id": "UUID"
                }
            }
        },
        ...
    ]
}
Levminer commented 2 days ago

Can you check the bottom of the file? Should be something like this:

    "appVersionName": "5.3.5",
    "appVersionCode": 50305,
    "appOrigin": "ios",
    "schemaVersion": 4,
    "groups": []
SakulFlee commented 2 days ago

I totally missed the bottom of that file! Sorry about that, here you go:

{
    "services": [
        { ... as above ... },
    ],
    "groups": [],
    "updatedAt": 1726667557361,
    "schemaVersion": 4,
    "appVersionCode": 5000025,
    "appVersionName": "5.4.6",
    "appOrigin": "android"
 }