The SDK creates one encrypted recovery envelope for each prepared bundle deposit. Save it before asking the wallet to submit. Restoring the bundle requires both the envelope and its recovery key.
The envelope is secret-bearing recovery authority. Never place a real envelope or recovery key in logs, URLs, analytics, support tickets, tests, or source control.

What the envelope contains

The recovery key lives outside the envelope. Keep both together in your backup.

Restore through the SDK

The restore path checks the envelope schema, active runtime, pool, template set, payload hash, authenticated-encryption context, and externally anchored bundle commitment. It then recomputes the bundle and child commitments before returning spendable data.

Required order

  1. Parse the expected envelope object without coercing fields.
  2. Match its runtime identity to the active SDK runtime.
  3. Verify the payload shape and hash.
  4. Decrypt with the application-held recovery key and bound context.
  5. Recompute the bundle commitment.
  6. Resolve the bundle commitment’s onchain membership.
  7. Check each selected child nullifier before proving.
Do not write a looser compatibility parser. If a field, hash, runtime, key, or commitment differs, restoration fails and no chain action should follow.