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

Keys backup tutorial #445

Open
pashky opened this issue Dec 4, 2024 · 0 comments
Open

Keys backup tutorial #445

pashky opened this issue Dec 4, 2024 · 0 comments

Comments

@pashky
Copy link

pashky commented Dec 4, 2024

Hello stranger.

So I'm assuming you lurking here in the same situation as I was - trying to find out a way to backup or port your one time tokens from iOS app.

Thanks to the clues left by @Esgariot in #412 I was able to figure the process out. I'm not going to go into too many details for each step, if something doesn't make sense you'll have to google it.

  1. Make an encrypted backup keeping note of the password you set
  2. Run go install github.com/dunhamsteve/ios/cmd/irestore@latest. Install golang first if you don't have it.
  3. Run irestore it should display a list with your backup like iphone 00000000-0000000000000000
  4. Run irestore 00000000-0000000000000000 dumpkeys keys.json entering the password from step1
  5. Run this python script. Obviously you'll need python installed.
#!/usr/bin/env python3
import json
from base64 import b64decode, b32encode

with open('keys.json') as file:
    j = json.load(file)
    for c in j['General']:
        if 'svce' in c and c['svce'] == 'me.mattrubin.onetimepassword.token':
            url = b64decode(c['gena']).decode('utf-8')
            secret = b32encode(b64decode(c['v_Data'])).decode('utf-8')
            print("{0}&secret={1}".format(url, secret))

The script will print a bunch of URLs in the form of otpauth://totp/... complete with secrets.

You can now open them in Safari one by one to add to iOS or OSX built-in keychain which now has code generator integrated. Or use just a secret string to import items into your other token app.

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

1 participant