Skip to Content
Account Recovery

Account Recovery

Comprehensive guide to recovering your Zentalk identity and data after device loss, damage, or upgrade.


Recovery Overview

Account recovery in Zentalk operates under a fundamental constraint: your private keys never leave your devices. This self-custody model means recovery depends entirely on preparation and the backup mechanisms you have in place.

What Can Be Recovered

Data TypeRecovery SourceRequirements
Identity KeyMnemonic phrase or encrypted backup24-word phrase or backup password
Wallet AddressDerived from mnemonicMnemonic phrase
Contact ListMesh storage backupIdentity Key + backup password
Profile DataMesh storage backupIdentity Key + backup password
Device KeysCannot be recoveredRegenerated on new device
Message HistoryEncrypted backup onlyBackup enabled + password
Verification StatusManual re-verificationOut-of-band confirmation

What Cannot Be Recovered

Data TypeReasonConsequence
Active SessionsEphemeral keys deletedMust re-establish with contacts
Session KeysForward secrecy designPrevious session state lost
One-Time Pre-Keys (used)Single-use by designAlready consumed
Device-Specific KeysPer-device generationNew keys created
Pending MessagesEncrypted to old keysMay be lost if undelivered
Disappearing MessagesAuto-deletedNot recoverable by design

Recovery Methods Comparison

MethodData RecoveredSecurityConvenience
Mnemonic PhraseIdentity + derived keysHighestLow
Encrypted BackupIdentity + contacts + messagesHighMedium
Multi-Device TransferEverything except sessionsHighHigh
On-Chain RecoveryIdentity verification onlyMediumLow

Mnemonic Phrase Recovery

The mnemonic phrase is the ultimate backup for your Zentalk identity. It encodes the seed from which all your keys are derived.

BIP-39 Standard

Zentalk uses the BIP-39 standard for mnemonic generation:

PropertySpecification
Word List2048 English words
Phrase Length24 words (256-bit entropy)
ChecksumLast 8 bits (final word encodes checksum)
Encoding11 bits per word (2^11 = 2048)

Word List Properties:

PropertyBenefit
No similar words”cat” and “car” not both included
Unique prefixesFirst 4 characters identify each word
Alphabetically sortedEasier to look up
Common EnglishEasier to write and remember

Entropy to Mnemonic Conversion

The 24-word phrase encodes 256 bits of entropy plus an 8-bit checksum:

Entropy Generation: 1. Generate 256 random bits from secure RNG 2. Compute checksum = SHA-256(entropy)[0:8] 3. Concatenate: entropy || checksum = 264 bits 4. Split into 24 groups of 11 bits each 5. Map each 11-bit value to word list index

Bit Allocation:

ComponentBitsPurpose
Entropy256Randomness source
Checksum8Error detection
Total26424 × 11 bits

Mnemonic to Seed Derivation

Converting the mnemonic back to a usable seed:

Seed Derivation (PBKDF2): Input: mnemonic phrase (space-separated words) Salt: "mnemonic" + optional_passphrase Iterations: 2048 Hash: HMAC-SHA512 Output: 512-bit seed seed = PBKDF2-HMAC-SHA512( password = normalize(mnemonic), salt = "mnemonic" + passphrase, iterations = 2048, output_length = 64 bytes )

Optional Passphrase:

With PassphraseWithout Passphrase
25th word protection24 words sufficient
Plausible deniabilitySimpler recovery
Different seed per passphraseSingle identity
Must remember passphraseMnemonic only needed

Seed to Identity Key Derivation

From the 512-bit seed, Zentalk derives the Identity Key using hierarchical deterministic derivation:

Key Derivation Path: Master Key = HMAC-SHA512("ed25519 seed", seed) Path: m/44'/1991'/0'/0/0 44' = BIP-44 purpose (hardened) 1991' = Zentalk coin type (hardened) 0' = Account index (hardened) 0 = Change (external) 0 = Address index Identity Key = derive_ed25519(Master Key, path)

Derivation Components:

Path ElementValueMeaning
Purpose44’BIP-44 compliant
Coin Type1991’Zentalk registered type
Account0’Primary account
Change0External chain
Index0First key

Step-by-Step Recovery Process

Phase 1: Input Validation

1. User enters 24-word phrase 2. Validate each word exists in BIP-39 list 3. Compute checksum from first 23 words + partial 24th 4. Verify checksum matches final word 5. If invalid: display specific error

Phase 2: Key Regeneration

1. Convert mnemonic to seed (PBKDF2) 2. Derive master key from seed 3. Derive wallet key: m/44'/60'/0'/0/0 (secp256k1) 4. Derive identity key: m/44'/1991'/0'/0/0 (Ed25519) 5. Compute wallet address from public key 6. Generate new device key for this device

Phase 3: Network Re-registration

1. Generate new signed pre-key 2. Generate 100 new one-time pre-keys 3. Sign pre-key bundle with identity key 4. Publish to DHT and API servers 5. Fetch existing contacts from mesh backup 6. Notify contacts of new device (key unchanged)

Phase 4: Session Re-establishment

1. For each contact: - Fetch their current key bundle - Perform X3DH key exchange - Initialize new Double Ratchet session 2. Old sessions are abandoned 3. Pending messages to old device keys are lost

Recovery Validation

CheckValidation
Word countExactly 24 words
Word validityEach word in BIP-39 list
ChecksumLast word encodes valid checksum
Address matchDerived address matches expected
Signature testCan sign test message

Encrypted Backup Recovery

Encrypted backups provide a more complete recovery option, including data that cannot be derived from the mnemonic alone.

Backup File Structure

The encrypted backup file contains multiple sections:

Backup File Format: ┌─────────────────────────────────────────────────┐ │ Header (32 bytes) │ │ Magic: "ZTBK" (4 bytes) │ │ Version: 1 (2 bytes) │ │ Timestamp: Unix epoch (8 bytes) │ │ Key derivation params (18 bytes) │ ├─────────────────────────────────────────────────┤ │ Salt (32 bytes) │ ├─────────────────────────────────────────────────┤ │ Nonce (12 bytes) │ ├─────────────────────────────────────────────────┤ │ Encrypted Payload (variable) │ │ Identity Key material │ │ Contact list │ │ Group memberships │ │ Settings │ │ Message history (optional) │ ├─────────────────────────────────────────────────┤ │ Authentication Tag (16 bytes) │ └─────────────────────────────────────────────────┘

Header Fields:

FieldSizeDescription
Magic4 bytesFile type identifier “ZTBK”
Version2 bytesBackup format version
Timestamp8 bytesCreation time (Unix epoch)
KDF ID1 byteKey derivation function (1 = PBKDF2)
Iterations4 bytesPBKDF2 iteration count
Reserved13 bytesFuture use

Password-Based Decryption

The backup is encrypted with a key derived from the user’s password:

Key Derivation: password = user_input salt = backup_file[32:64] // 32 bytes iterations = header.iterations // minimum 600,000 derived_key = PBKDF2-HMAC-SHA256( password, salt, iterations, output_length = 32 bytes ) Decryption: nonce = backup_file[64:76] // 12 bytes ciphertext = backup_file[76:-16] tag = backup_file[-16:] // last 16 bytes plaintext = AES-256-GCM-Decrypt( key = derived_key, nonce = nonce, ciphertext = ciphertext, associated_data = header, tag = tag )

Security Parameters:

ParameterValuePurpose
PBKDF2 Iterations≥ 600,000Slow brute-force attacks
Salt32 bytes randomPrevent rainbow tables
AES-256-GCM256-bit keyEncryption + authentication
Nonce12 bytes randomUnique per backup

Backup Contents

Required Components:

ComponentSize (approx)Recovery Use
Identity Key Seed32 bytesRegenerate all derived keys
Wallet Key32 bytesBlockchain operations
Contact ListVariableRestore address book
Group MembershipsVariableRejoin groups
Profile DataVariableUsername, avatar hash

Optional Components:

ComponentSizeWhen Included
Message HistoryVariableIf user enabled
Media IndexVariableIf backup media enabled
Custom Settings~1 KBAlways
Blocked UsersVariableIf any exist

Backup Validation and Integrity

Before recovery proceeds, the backup undergoes validation:

Structural Validation:

1. Check file size minimum (96 bytes header + tag) 2. Verify magic bytes = "ZTBK" 3. Check version is supported (currently 1) 4. Verify timestamp is reasonable (not future, not too old) 5. Validate KDF parameters are secure

Cryptographic Validation:

1. Derive key from password 2. Attempt AES-GCM decryption 3. Verify authentication tag - If tag invalid: wrong password or corrupted 4. Parse decrypted payload 5. Verify internal checksums

Content Validation:

1. Deserialize identity key material 2. Derive public key from private key 3. Compute wallet address 4. Compare with embedded address 5. If mismatch: backup may be for different account

Error Conditions:

ErrorCauseResolution
Invalid magicNot a Zentalk backupUse correct file
Unsupported versionNewer backup formatUpdate app
Decryption failedWrong passwordRetry password
Tag verification failedCorrupted or tamperedUse different backup
Checksum mismatchPartial corruptionTry older backup

Multi-Device Recovery

When you have another device with your Zentalk account active, recovery is simpler and more complete.

Prerequisites

RequirementDescription
Existing DevicePhone, tablet, or desktop with active Zentalk
Network ConnectionBoth devices online
Physical ProximityFor QR code scanning (recommended)
Device UnlockedBiometric or PIN required

Recovering from Existing Device

Option A: QR Code Pairing

On Existing Device: 1. Navigate to Settings → Devices → Add Device 2. Authenticate with biometric/PIN 3. Generate ephemeral X25519 keypair 4. Display QR code containing: - Ephemeral public key (32 bytes) - Session ID (16 bytes) - Timestamp (8 bytes) - Signature from Identity Key On New Device: 1. Select "Recover from existing device" 2. Scan QR code from camera 3. Parse and validate QR data 4. Generate own ephemeral keypair 5. Compute shared secret

Option B: Numeric Code Pairing

On Existing Device: 1. Navigate to Settings → Devices → Add Device 2. Select "Use numeric code" 3. Display 8-digit code + ephemeral public key 4. Code valid for 60 seconds On New Device: 1. Enter 8-digit code 2. Fetch pairing data from server using code 3. Proceed with key exchange

QR Code Pairing Flow

Detailed Protocol:

Phase 1: QR Generation (Existing Device) EK_old = generate_x25519_keypair() session_id = random(16 bytes) timestamp = current_unix_time() payload = EK_old.public || session_id || timestamp signature = Ed25519_sign(Identity_Key, payload) qr_data = Base64(payload || signature) Phase 2: QR Scan (New Device) Parse qr_data Verify timestamp not expired (60 second window) Extract EK_old_public, session_id, signature EK_new = generate_x25519_keypair() shared_secret = X25519(EK_new.private, EK_old_public) encryption_key = HKDF(shared_secret, "ZentalkDeviceLink") Phase 3: Key Request (New Device → Server → Existing Device) Generate device keypair for new device request = { session_id: session_id, ephemeral_public: EK_new.public, device_public_key: new_device_public_key, device_info: encrypted(encryption_key, device_name) } Send request to server Phase 4: Key Transfer (Existing Device) Receive request via push notification Verify session_id matches pending pairing shared_secret = X25519(EK_old.private, EK_new_public) encryption_key = HKDF(shared_secret, "ZentalkDeviceLink") transfer_data = { identity_key_seed: encrypted(encryption_key, seed), contacts: encrypted(encryption_key, contact_list), groups: encrypted(encryption_key, group_list), settings: encrypted(encryption_key, settings) } Sign transfer_data with Identity Key Send to new device via server Phase 5: Verification (Both Devices) verification_code = HKDF(shared_secret, "verify")[0:6] Convert to 6-digit number Both devices display same code User confirms codes match If match confirmed: New device finalizes setup Add new device to device list

Secure Key Transfer Between Devices

Transfer Security Properties:

PropertyMechanism
ConfidentialityAES-256-GCM encryption
AuthenticityIdentity Key signature
Forward SecrecyEphemeral X25519 keys
MITM PreventionOut-of-band verification code
Replay PreventionSingle-use session ID
Timeout60-second validity window

What Gets Transferred:

DataTransferredNotes
Identity Key SeedYesEncrypted with shared secret
Contact ListYesFull address book
Group MembershipsYesGroup IDs and metadata
Active SessionsNoMust re-establish
Message HistoryPartialRecent messages only
Device KeysNoNew device generates own

What Does NOT Transfer:

DataReason
Double Ratchet StateDevice-specific, forward secrecy
Used One-Time Pre-KeysAlready consumed
Session KeysPer-device isolation
Push TokensDevice-specific

Message History Recovery

Message recovery is the most limited aspect of account recovery due to forward secrecy design.

When Messages Can Be Recovered

ScenarioRecovery PossibleMethod
Encrypted backup enabledYesRestore from backup
Multi-device sync enabledYesSync from other device
Mesh storage backupPartialRecent messages only
No backup, single device lostNoMessages permanently lost

When Messages Are Permanently Lost

ScenarioReason
Device lost, no backupSession keys only existed on device
Backup exists, wrong passwordCannot decrypt backup
Forward secrecy window passedOld keys deleted
Disappearing messagesDeleted by design
Device wiped remotelyKeys destroyed

Message Backup Mechanics

What Message Backups Contain:

Message Backup Entry: ┌─────────────────────────────────────────────────┐ │ conversation_id: hash(participant_addresses) │ │ message_id: unique_identifier │ │ timestamp: unix_epoch_ms │ │ sender: wallet_address │ │ type: text | media | system │ │ content: encrypted_message_body │ │ media_refs: [encrypted_media_keys] │ │ read_status: boolean │ │ delivery_status: sent | delivered | read │ └─────────────────────────────────────────────────┘

Backup Encryption:

LayerKey SourceAlgorithm
Message ContentOriginal session keyAES-256-GCM
Backup EncryptionBackup passwordPBKDF2 + AES-256-GCM
Mesh StorageIdentity Key derivedAES-256-GCM

Message Recovery Process

Phase 1: Identify Available Sources Check for local encrypted backup file Check mesh storage for backup markers Check for other linked devices Phase 2: Priority-Based Recovery 1. If other device available: - Request message sync via encrypted channel - Transfer complete conversation history 2. If encrypted backup available: - Decrypt backup file - Import message database - Verify message signatures 3. If mesh backup only: - Fetch encrypted blobs from mesh - Decrypt with recovered Identity Key - May have limited history (30 days default) Phase 3: Session Reconstruction For each conversation: - Establish new session with contact - Link historical messages to new session - Mark old session keys as unrecoverable

Partial Recovery Scenarios

ScenarioMessages RecoveredMessages Lost
Multi-device, one lostAllNone
Backup from 7 days agoUp to 7 days agoLast 7 days
Mesh backup onlyLast 30 daysOlder messages
Mnemonic only recoveryNoneAll

Recovery Limitations

Understanding what cannot be recovered is crucial for setting appropriate expectations and backup strategies.

Forward Secrecy Implications

The Double Ratchet algorithm provides forward secrecy by design:

Forward Secrecy Effect: Time T-1: Message encrypted with Key(T-1) Time T: Key(T-1) deleted, Key(T) derived Time T+1: Key(T) deleted, Key(T+1) derived Attacker at T+1 cannot recover Key(T-1) or Key(T) Even with Identity Key compromise

What This Means for Recovery:

If You LoseYou Cannot Recover
Device at time TSession keys from before T
Chain KeyPrevious message keys in that chain
Root KeyPrevious chain keys
All devicesAll session state

Items That CANNOT Be Recovered

Cryptographic Limitations:

ItemWhy Unrecoverable
Session KeysDeleted after use (forward secrecy)
Used One-Time Pre-KeysSingle-use by cryptographic design
Ephemeral KeysDeleted after key exchange
Chain Keys (old)One-way derivation function
Ratchet StatePer-device, not backed up

Design Limitations:

ItemWhy Unrecoverable
Disappearing MessagesDeleted after timer expires
Verification StatusRequires out-of-band re-verification
Read Receipts (old)Ephemeral status data
Typing IndicatorsNever stored
Online Status HistoryNever stored

Session Re-establishment Requirements

After recovery, sessions with all contacts must be re-established:

Session Re-establishment Flow: 1. New device generates fresh pre-keys 2. Publishes new key bundle to network 3. For each contact attempting to message you: - They detect new key bundle - They perform fresh X3DH - New Double Ratchet session begins 4. Contacts see "safety number changed" warning 5. High-security contacts should re-verify

Impact on Contacts:

Contact ActionRequiredOptional
Accept new keysYes-
Re-verify fingerprintsRecommendedYes
Acknowledge key changeYes-
Re-send failed messagesManualYes

Security During Recovery

Recovery is a high-risk operation that requires careful security measures.

Verification of Recovered Identity

After recovery, verify that the correct identity was restored:

Self-Verification Steps:

1. Check wallet address matches expected 2. View identity fingerprint 3. Compare with recorded fingerprint (if available) 4. Verify contact list matches expectations 5. Check group memberships are correct

Technical Verification:

CheckMethod
Address DerivationRe-derive from mnemonic, compare
Signature TestSign test message, verify with known public key
Contact VerificationAsk trusted contact to confirm your fingerprint
On-Chain CheckVerify against on-chain identity (if registered)

Contact Notification of Key Change

When you recover on a new device, contacts are notified:

Automatic Notifications:

When contact sends message after your recovery: 1. They fetch your key bundle 2. Detect Identity Key unchanged but device keys new 3. System message: "User's security info changed" 4. Warning displayed: "Verify if unexpected"

Notification Levels:

ScenarioNotificationAction Required
New device, same IK”Added new device”None (trusted)
Identity Key changed”Security code changed”Verify recommended
Suspicious timing”Verify in person”Verification required

Preventing Recovery Attacks

Attack Vectors and Mitigations:

AttackDescriptionMitigation
Mnemonic TheftAttacker steals 24 wordsSecure physical storage, encryption
Backup Password GuessingBrute-force backup passwordStrong password, high PBKDF2 iterations
Social EngineeringTrick user into sharing phraseEducation, never share phrase
PhishingFake recovery interfaceVerify app signature, official sources
MITM on RecoveryIntercept device pairingQR code + verification code
Evil MaidAccess device during recoveryFull disk encryption, secure boot

Security Best Practices During Recovery:

PracticeReason
Verify app authenticityPrevent malicious recovery app
Use secure networkPrevent network interception
Private locationPrevent shoulder surfing
Clear clipboard afterMnemonic may be copied
Verify new device fingerprintConfirm correct identity restored
Re-verify critical contactsDetect potential compromise

Recovery Environment Security

Recommended Environment:

Before Recovery: ✓ Official Zentalk app from verified source ✓ Device malware scan completed ✓ Secure, private location ✓ Trusted network (home WiFi or cellular) ✓ No screen recording active ✓ Clipboard cleared During Recovery: ✓ Do not photograph mnemonic ✓ Do not read mnemonic aloud ✓ Verify each word carefully ✓ Watch for autocorrect interference ✓ Confirm address matches expected After Recovery: ✓ Clear clipboard again ✓ Lock mnemonic backup securely ✓ Verify contact fingerprints ✓ Test send/receive with trusted contact ✓ Enable device security (biometric, PIN)

Recovery Procedures Reference

Quick Reference: Recovery Options

SituationAvailable OptionsRecommended
Lost phone, have backupMnemonic or encrypted backupEncrypted backup (more complete)
Lost phone, no backupMnemonic onlyMnemonic (if stored securely)
Lost phone, other device activeMulti-device transferQR code pairing
Forgotten backup passwordMnemonic onlyMnemonic recovery
All devices lostMnemonic or encrypted backupWhichever available
Mnemonic lost, have backupEncrypted backup onlyBackup (create new mnemonic backup after)
All recovery methods lostNoneAccount unrecoverable

Recovery Time Estimates

MethodTime RequiredData Recovered
Mnemonic Recovery5-10 minutesIdentity only
Encrypted Backup5-15 minutesIdentity + contacts + messages
Multi-Device Transfer2-5 minutesNearly complete
Full Sync from Device10-30 minutesComplete (depending on history size)

Last updated on