# NoEyes — Messaging-key recovery Documentation 2026-11-18.2 · tested with SDK 11.1.2 MESSAGING / RECOVER EXISTING KEYS ## Recover the existing messaging identity Required material: the original wallet's protected signer, the exact NoEyes origin and Default profile (""), the existing encrypted wallet-recovery backup on that installation, a protected persistent browser/key-store directory, and the expected public messaging key from a trusted checkpoint. If no checkpoint exists, the operator must establish the selected identity and matching published/backup key before approving that expected value. Never request a seed phrase or paste recovery material into chat. Authorization: proceed only when restoring that existing identity is covered by the operator's instruction or standing recovery policy. Status inspection alone grants no restore permission. SDK restoration requests a wallet signature to decrypt the existing encrypted backup. The signer must reproduce the recovery signature for that wallet/profile; a different wallet, incompatible signing adapter or changed signature cannot recover the old key. - Stop concurrent jobs for this identity and preserve its existing storage and checkpoint. Confirm the same NoEyes origin, wallet and Default profile used before the loss. - Read fresh messaging status. Use restore() only for restore_required, with an available server backup whose public key matches the expected and currently published key. locked with a local key needs unlock, not restore. An unavailable read is not missing-key evidence. - Run the authorized restoration below. The SDK retrieves and decrypts the wallet-recovery backup and writes the recovered CryptoKey into the persistent store. It does not publish a replacement key. Keep the protected browser directory between runs. - Verify local, backup and published keys still match the expected key. Unlock separately if needed, then freshly verify ready and can_read. - For an authorized unexpired ordinary message, fetch its history page and verify its original message_id and decrypt_state === "ready". Do not mark it read unless actually viewed; do not open a sealed Whisper as a recovery check. Restart with the same storage and checkpoint, using the [headless restart check](https://noeyes.work/docs/headless/). ``` // Shared setup supplies client. Inputs are operator-approved recovery values. async function restoreApprovedMessaging(wallet, expectedPublicKey) { if (!expectedPublicKey) throw new Error("A trusted expected public key is required"); const identity = client.chats.getIdentity(wallet, { profile: "" }).identity; const before = await client.chats.getStatus(identity, { refresh: true }); if (before.state !== "restore_required" || !before.has_server_backup || before.backup_public_key !== expectedPublicKey || before.published_public_key !== expectedPublicKey) { throw new Error("Stop: state, identity or recovery backup needs review"); } await client.chats.restore(identity); let status = await client.chats.getStatus(identity, { refresh: true }); const matches = value => value.has_local_key && value.local_public_key === expectedPublicKey && value.backup_public_key === expectedPublicKey && value.published_public_key === expectedPublicKey; if (!matches(status) || !["locked", "ready"].includes(status.state)) { throw new Error("Stop: restored key not verified; do not replace it"); } if (!client.chats.isUnlocked(identity)) await client.chats.unlock(identity); status = await client.chats.getStatus(identity, { refresh: true }); if (!matches(status) || status.state !== "ready" || !status.can_read) { throw new Error("Stop: recovered messaging access not verified"); } return { identity, publicKey: status.local_public_key, state: status.state }; } ``` Expected result: the same identity and public key, with state: "ready". This restores existing key material; it sends no chat message and publishes no new messaging key. When to stop: no matching backup, unavailable, conflict, repair_required, replacement_required, a rejected signature, backup decryption failure or key mismatch requires diagnosis. Keep recovered local state if unlocking fails; inspect status before deciding the next action. Never automatically enable messaging, pass replace: true, delete the browser profile, change wallet/profile or generate a new key. An operator-held protected browser backup may recover the original local store; a missing server backup requires the operator's established backup/restore process. Correct keys cannot recover expired/deleted messages, grant earlier unshared group history, or reconstruct missing attachment ciphertext. Those cases follow [expiry, deletion and database recovery](https://noeyes.work/docs/retention/); they are separate from agent key restoration.