// BACKUP FORMAT
Open a SecondKey backup without SecondKey
Format version 1 · Last updated November 18, 2026
Your backup file uses standard, published methods, so it never depends on the app. Below is the full format, and a tool that opens a backup right here in your browser and lists every code secret, ready to move to another authenticator.
Open a backup
This page has no network access. Its security policy blocks every connection, so your file and passphrase never leave this device. For extra caution, save this page and open it with Wi-Fi off.
2FA accounts
All accounts as otpauth:// links
One link per line. Most authenticators can import these; each one can also be turned into a QR code.
Security answers
The file
A backup is one UTF-8 JSON file. The header is readable without the passphrase; everything you saved is inside data, encrypted.
{
"app": "secondkey",
"kind": "backup",
"version": 1,
"kdf": { "name": "pbkdf2-sha256", "iterations": 150000, "salt": "<base64, 16 bytes>" },
"cipher": { "name": "aes-256-gcm", "nonce": "<base64, 12 bytes>" },
"data": "<base64: ciphertext followed by the 16-byte GCM tag>"
}
All binary values use standard base64 with padding. Read iterations from the file rather than assuming 150,000: later versions of the app may raise it. SecondKey never writes more than 10,000,000, so readers can reject anything above that.
Step 1: derive the key
- Normalize the passphrase to Unicode NFC, then encode it as UTF-8.
- Run PBKDF2 with HMAC-SHA256, the file's
saltanditerations, producing 32 bytes. That is the AES-256 key.
Step 2: build the associated data
The header is bound to the ciphertext as AES-GCM associated data, so editing any header field makes decryption fail. The associated data is the UTF-8 bytes of this JSON array, written with no spaces:
JSON.stringify([app, kind, version, kdf.name, kdf.iterations, kdf.salt, cipher.name, cipher.nonce])
// for example:
["secondkey","backup",1,"pbkdf2-sha256",150000,"q1w2…==","aes-256-gcm","e3r4…=="]
Step 3: decrypt
Decrypt data with AES-256-GCM using the key, the file's nonce, the associated data and a 128-bit tag (the last 16 bytes of data). A wrong passphrase and an edited file both fail the tag check; the two can't be told apart.
Step 4: read the contents
The result is UTF-8 JSON:
{
"exportedAt": 1795000000000,
"accounts": [ Account, … ],
"recoveryEntries": [ SecurityAnswers, … ]
}
| Account field | Meaning |
|---|---|
issuer, label | Service name and account name, e.g. "GitHub" and "you@example.com". |
secret | The shared secret, base32 (RFC 4648). |
type | "totp" or "hotp". Missing means "totp". |
algorithm | "SHA1", "SHA256" or "SHA512". Missing means "SHA1". |
digits | Code length. Missing means 6. |
period | TOTP step in seconds. Missing means 30. |
counter | HOTP only: the counter value the next code will use, the same meaning as counter in an otpauth:// link. Missing means 0. |
backupCodes | Optional list of { code, usedAt }; usedAt is a timestamp or null. |
id, addedAt | Internal id and creation time (milliseconds since 1970). |
| Security answers field | Meaning |
|---|---|
issuer, label | Service name and account name. |
securityQA | List of { question, answer }. |
recoveryPin, note | Optional PIN and free-text note. |
id, addedAt | Internal id and creation time. |
Readers should ignore fields they don't recognize; later versions may add some. A file whose version is higher than 1 may change the rules above.
Source
The opener above is the whole program: view this page's source to read it. It uses only your browser's built-in Web Crypto. It is released under the MIT licence, so you can copy, run or adapt it freely. The same steps work in any language with PBKDF2 and AES-GCM.