metamask-mobile
                                
                                
                                
                                    metamask-mobile copied to clipboard
                            
                            
                            
                        feat(identity): enable contact backup-and-sync
Description
The current implementation of MetaMask's address book (contacts) lacks the ability to synchronize between devices. While we recently implemented this capability for accounts using encrypted user storage, the address book remained local to each device. This PR implements backup-and-sync functionality for the address book controller, similar to what was already implemented for the accounts controller.
Related issues
Depends on: https://github.com/MetaMask/core/pull/5776 Relates to: https://github.com/MetaMask/metamask-extension/pull/32632
Manual testing steps
Happy flow:
- Setup at least two instances of MetaMask, of which at least one mobile app. Let's assume they're called A and B for next steps.
 - Start fresh with an empty address book (contact syncing is enabled by default)
 - Add a contact 
Aliceon A - Unlock B: 
Aliceshould be found in the address book - On B: edit 
Alicememo (and-or its name) - Lock/Unlock A : find the 
Aliceupdates in address book - Add another contact 
Bobon B - Lock/unlock A and find 
Bobin address book - Now, delete 
Aliceon A, lock/unlock B and check thatAliceis no longer in address book - Do the opposite test: delete 
Bobon B and check for its absence on A 
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
 - [x] I've completed the PR template to the best of my ability
 - [x] I’ve included tests if applicable
 - [x] I’ve documented my code using JSDoc format if applicable
 - [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
 
Pre-merge reviewer checklist
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
 - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.