Recover Royal ID
Digital identity recovery presents a fundamental challenge: how do we balance security with the reality that people sometimes lose access to their accounts? The Royal Protocol approaches this challenge through an optional but powerful recovery system that maintains security while providing a path back when custody access is lost.
Core Concept: Recovery as a Design Choice
Think of a Royal ID’s recovery system like designating a trusted emergency contact who can help you regain access to your home if you lose your keys. Just as you might give a spare key to a family member or close friend, Royal ID owners can designate a recovery address that has the specific and limited power to transfer custody of the ID to a new address if access is lost.
This recovery system is:
- Optional: Users choose whether to enable recovery when creating their ID
- Limited: Recovery addresses can only transfer custody, not perform other actions
- Immutable: Recovery addresses can only be set or changed by the custody address
- Two-Party: Recovery requires cooperation between the recovery address and the new custody address
How Recovery Works
The recovery process involves three key players:
- The Recovery Address: Previously designated by the ID owner
- The New Custody Address: Where control of the ID will be transferred
- The Protocol: Which validates and executes the recovery
When recovery is needed, it follows this flow:
- The recovery address initiates the process by calling
recover()
or signing a message forrecoverFor()
- The new custody address must also approve the transfer through a signature
- The protocol verifies both parties have approved and executes the transfer
This two-signature requirement ensures that recovery can’t be executed unilaterally - both the recovery address and the new custody must actively participate in the process.
Implementation Methods
The protocol supports two recovery approaches:
Direct Recovery
Used when the recovery address directly submits the transaction. They must:
- Pay the recovery fee in ETH
- Provide the new custody address
- Include a signature from the new custody address approving the transfer
Sponsored Recovery
Enables third-party submission of the recovery transaction. Requires:
- A signature from the recovery address
- A signature from the new custody address
- Payment of the recovery fee
Both methods achieve the same result but offer flexibility in who submits and pays for the transaction.
Best Practices for Recovery
Setting Up Recovery
- Choose a recovery address that is:
- Highly secure
- Controlled by a trusted party
- Likely to remain accessible long-term
- Document recovery information securely:
- Store recovery address details safely
- Record the process for initiating recovery
- Keep instructions for proving identity to recovery address holder
Recovery Address Selection
Consider these options for recovery addresses:
- Hardware wallet in secure storage
- Multi-signature wallet
- Professional custody service
- Trusted family member or advisor’s address
- Corporate security team’s wallet
Managing Recovery Changes
When changing recovery addresses:
- Ensure the new recovery address is fully set up first
- Use the
changeRecovery()
function from the custody address - Verify the change through
recoveryOf()
- Update all documented recovery information
Technical Implementation
The recovery system is implemented through a series of smart contract functions that enforce these security properties:
Key security checks include:
- Validation of recovery address authorization
- Verification of signatures and deadlines
- Atomic execution of custody transfer
Error Handling and Edge Cases
The recovery system handles several important edge cases:
- No Recovery Address. If an ID was created without a recovery address (or the recovery address was cleared), recovery is impossible. This is by design - you cannot recover an ID that wasn’t set up for recovery.
- Invalid Recovery Address. If the recovery address is no longer valid (e.g., an EOA whose private key is no longer available), the ID may become unrecoverable. This emphasizes the importance of careful recovery address selection.
- Signature Timing. Recovery signatures have deadlines to prevent replay attacks. If signatures expire before submission, new signatures must be obtained.