Skip to content

Keys backup tutorial #445

@pashky

Description

@pashky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions