Sync Updates Sequence

Interaction Type: ☁️ REMOTE (Via Relay)

Contact card changes propagate automatically to contacts via the relay network. All data is end-to-end encrypted - relays only see encrypted blobs.

Participants

  • Alice - User updating their contact card
  • Alice's Device - Device where change is made
  • Alice's Other Device - Another linked device
  • Relay - WebSocket relay server
  • Bob's Device - Contact receiving the update
  • Bob - Contact who will see the update

Sequence Diagram

 ┌───────┐                             ┌────────────────┐  ┌────────────────┐                 ┌───────┐                ┌──────────────┐                                     ┌─────┐   
 │ Alice │                             │ Alice Device 1 │  │ Alice Device 2 │                 │ Relay │                │ Bob's Device │                                     │ Bob │   
 └───┬───┘                             └────────┬───────┘  └────────┬───────┘                 └───┬───┘                └───────┬──────┘                                     └──┬──┘   
     │                                          │                   │                             │                            │                                               │      
     │  Update phone: "555-1111" → "555-2222"   │                   │                             │                            │                                               │      
     │──────────────────────────────────────────▶                   │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Update local contact card                   │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Increment card version                      │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Sign card with identity key                 │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │             ┌─────────────────────┐             │                            │                                               │      
     │                                          │             │ PUSH TO OWN DEVICES │             │                            │                                               │      
     │                                          │             └─────────────────────┘             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Encrypt update for Device 2                 │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │         Push encrypted update (for AD2)         │                            │                                               │      
     │                                          │─────────────────────────────────────────────────▶                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   │  Forward encrypted update   │                            │                                               │      
     │                                          │                   ◀╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   ├───┐                         │                            │                                               │      
     │                                          │                   │   │ Decrypt update          │                            │                                               │      
     │                                          │                   ◀───┘                         │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   ├───┐                         │                            │                                               │      
     │                                          │                   │   │ Apply change locally    │                            │                                               │      
     │                                          │                   ◀───┘                         │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   ├───┐                         │                            │                                               │      
     │                                          │                   │   │ Verify signature        │                            │                                               │      
     │                                          │                   ◀───┘                         │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │              ┌──────────────────┐               │                            │                                               │      
     │                                          │              │ PUSH TO CONTACTS │               │                            │                                               │      
     │                                          │              └──────────────────┘               │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Check visibility rules                      │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │ ┌─────────────────────┐                         │                            │                                               │      
     │                                          │ │ Phone visible to:   │                         │                            │                                               │      
     │                                          │ │ - Bob           │   │                         │                            │                                               │      
     │                                          │ │ - Carol         │   │                         │                            │                                               │      
     │                                          │ │ - Dave (restricted) │                         │                            │                                               │      
     │                                          │ └─────────────────────┘                         │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          ├───┐               │                             │                            │                                               │      
     │                                          │   │ Encrypt delta for Bob (shared key)          │                            │                                               │      
     │                                          ◀───┘               │                             │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │ ┌────────────────────────────────────────────┐  │                            │                                               │      
     │                                          │ │ Delta: {field: "phone", value: "555-2222"} │  │                            │                                               │      
     │                                          │ └────────────────────────────────────────────┘  │                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │         Push encrypted delta (for Bob)          │                            │                                               │      
     │                                          │─────────────────────────────────────────────────▶                            │                                               │      
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   │                         ┌alt [Bob is Online]─────────────────────────────────────────────────────────────────┐  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │  Forward encrypted delta   │                                               │   │  
     │                                          │                   │                         │   │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                                               │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            ├───┐                                           │   │  
     │                                          │                   │                         │   │                            │   │ Decrypt with Alice-Bob shared key         │   │  
     │                                          │                   │                         │   │                            ◀───┘                                           │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            ├───┐                                           │   │  
     │                                          │                   │                         │   │                            │   │ Verify signature                          │   │  
     │                                          │                   │                         │   │                            ◀───┘                                           │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            ├───┐                                           │   │  
     │                                          │                   │                         │   │                            │   │ Update Alice's contact card locally       │   │  
     │                                          │                   │                         │   │                            ◀───┘                                           │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            │  Notification: "Alice updated contact info"   │   │  
     │                                          │                   │                         │   │                            │───────────────────────────────────────────────▶   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         ├[Bob is Offline]╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   ├───┐                        │                                               │   │  
     │                                          │                   │                         │   │   │ Queue message for Bob  │                                               │   │  
     │                                          │                   │                         │   ◀───┘                        │                                               │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │ ┌───────────────────────────┐                                              │   │  
     │                                          │                   │                         │   │ │ Queued until Bob connects││                                              │   │  
     │                                          │                   │                         │   │ └───────────────────────────┘                                              │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         └────────────────────────────────────────────────────────────────────────────────────┘  
     │                                          │                   │                             │                            │                                               │      
     │                                          │                   │                         ┌opt [Bob was Offline]───────────────────────────────────────────────────────────────┐  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │     Connect to relay       │                                               │   │  
     │                                          │                   │                         │   ◀────────────────────────────│                                               │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │  Deliver queued messages   │                                               │   │  
     │                                          │                   │                         │   │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                                               │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            ├───┐                                           │   │  
     │                                          │                   │                         │   │                            │   │ Process Alice's update                    │   │  
     │                                          │                   │                         │   │                            ◀───┘                                           │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            ├───┐                                           │   │  
     │                                          │                   │                         │   │                            │   │ Update local contact card                 │   │  
     │                                          │                   │                         │   │                            ◀───┘                                           │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         │   │                            │          Alice updated contact info           │   │  
     │                                          │                   │                         │   │                            │───────────────────────────────────────────────▶   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │ ┌───────────────────────────────────────┐                │                                               │   │  
     │                                          │                   │ │ Bob now sees Alice's new phone number │                │                                               │   │  
     │                                          │                   │ └───────────────────────────────────────┘                │                                               │   │  
     │                                          │                   │                         │   │                            │                                               │   │  
     │                                          │                   │                         └────────────────────────────────────────────────────────────────────────────────────┘  
     │                                          │                   │                             │                            │                                               │      
 ┌───┴───┐                             ┌────────┴───────┐  ┌────────┴───────┐                 ┌───┴───┐                ┌───────┴──────┐                                     ┌──┴──┐   
 │ Alice │                             │ Alice Device 1 │  │ Alice Device 2 │                 │ Relay │                │ Bob's Device │                                     │ Bob │   
 └───────┘                             └────────────────┘  └────────────────┘                 └───────┘                └──────────────┘                                     └─────┘   

Visibility-Aware Sync

┌────────────────┐                    ┌───────┐                    ┌──────────────┐  ┌────────────────┐   ┌───────────────┐   
│ Alice's Device │                    │ Relay │                    │ Bob's Device │  │ Carol's Device │   │ Dave's Device │   
└────────┬───────┘                    └───┬───┘                    └───────┬──────┘  └────────┬───────┘   └───────┬───────┘   
         │                                │                                │                  │                   │           
         ├───┐                            │                                │                  │                   │           
         │   │ Check visibility rules     │                                │                  │                   │           
         ◀───┘                            │                                │                  │                   │           
         │                                │                                │                  │                   │           
         │ ┌───────────────────────────┐  │                                │                  │                   │           
         │ │ Visibility:               │  │                                │                  │                   │           
         │ │ Bob: [name, phone, email] │  │                                │                  │                   │           
         │ │ Carol: [name, email]      │  │                                │                  │                   │           
         │ │ Dave: [name only]         │  │                                │                  │                   │           
         │ └───────────────────────────┘  │                                │                  │                   │           
         │                                │                                │                  │                   │           
     ┌par [Send to contacts based on visibility]──────────────────────────────────────────────────────────────────────┐       
     │   │                                │                                │                  │                   │   │       
     │   │  To Bob: {phone: "555-2222"}   │                                │                  │                   │   │       
     │   │────────────────────────────────▶                                │                  │                   │   │       
     │   │                                │                                │                  │                   │   │       
     │   │                                │  Forward (Bob can see phone)   │                  │                   │   │       
     │   │                                │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                  │                   │   │       
     │   │                                │                                │                  │                   │   │       
     │   │                         ┌──────────────────────────────┐        │                  │                   │   │       
     │   │                         │ Carol cannot see phone field │        │                  │                   │   │       
     │   │                         └──────────────────────────────┘        │                  │                   │   │       
     │   │                                │                                │                  │                   │   │       
     ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤       
     │   │                                │                                │                  │                   │   │       
     │   │                        No update sent (field not visible)       │                  │                   │   │       
     │   │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                   │   │       
     │   │                                │                                │                  │                   │   │       
     │   │                                │   ┌─────────────────────────────┐                 │                   │   │       
     │   │                                │   │ Dave cannot see phone field││                 │                   │   │       
     │   │                                │   └─────────────────────────────┘                 │                   │   │       
     │   │                                │                                │                  │                   │   │       
     ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤       
     │   │                                │                                │                  │                   │   │       
     │   │                                │ No update sent (field not visible)                │                   │   │       
     │   │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶   │       
     │   │                                │                                │                  │                   │   │       
     └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘       
         │                                │                                │                  │                   │           
┌────────┴───────┐                    ┌───┴───┐                    ┌───────┴──────┐  ┌────────┴───────┐   ┌───────┴───────┐   
│ Alice's Device │                    │ Relay │                    │ Bob's Device │  │ Carol's Device │   │ Dave's Device │   
└────────────────┘                    └───────┘                    └──────────────┘  └────────────────┘   └───────────────┘   

Offline Queue Handling

┌────────────────┐      ┌───────┐              ┌──────────────┐                            
│ Alice's Device │      │ Relay │              │ Bob's Device │                            
└────────┬───────┘      └───┬───┘              └───────┬──────┘                            
         │                  │                          │                                   
         ├───┐              │                          │                                   
         │   │ Update 1: Change phone                  │                                   
         ◀───┘              │                          │                                   
         │                  │                          │                                   
         │  Queue for Bob   │                          │                                   
         │──────────────────▶                          │                                   
         │                  │                          │                                   
         │                  ├───┐                      │                                   
         │                  │   │ Store encrypted message                                  
         │                  ◀───┘                      │                                   
         │                  │                          │                                   
         ├───┐              │                          │                                   
         │   │ Update 2: Change email                  │                                   
         ◀───┘              │                          │                                   
         │                  │                          │                                   
         │  Queue for Bob   │                          │                                   
         │──────────────────▶                          │                                   
         │                  │                          │                                   
         │                  ├───┐                      │                                   
         │                  │   │ Store encrypted message                                  
         │                  ◀───┘                      │                                   
         │                  │                          │                                   
         ├───┐              │                          │                                   
         │   │ Update 3: Change phone again            │                                   
         ◀───┘              │                          │                                   
         │                  │                          │                                   
         │  Queue for Bob   │                          │                                   
         │──────────────────▶                          │                                   
         │                  │                          │                                   
         │                  ├───┐                      │                                   
         │                  │   │ Store encrypted message                                  
         │                  ◀───┘                      │                                   
         │                  │                          │                                   
         │                  │  Connect (back online)   │                                   
         │                  ◀──────────────────────────│                                   
         │                  │                          │                                   
         │                  │    Deliver update 1      │                                   
         │                  │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                                   
         │                  │                          │                                   
         │                  │    Deliver update 2      │                                   
         │                  │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                                   
         │                  │                          │                                   
         │                  │    Deliver update 3      │                                   
         │                  │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▶                                   
         │                  │                          │                                   
         │                  │                          ├───┐                               
         │                  │                          │   │ Apply all updates in order    
         │                  │                          ◀───┘                               
         │                  │                          │                                   
         │                  │┌───────────────────────────────────────────────────┐         
         │                  ││ Bob sees latest values after applying all updates │         
         │                  │└───────────────────────────────────────────────────┘         
         │                  │                          │                                   
┌────────┴───────┐      ┌───┴───┐              ┌───────┴──────┐                            
│ Alice's Device │      │ Relay │              │ Bob's Device │                            
└────────────────┘      └───────┘              └──────────────┘                            

Data Exchanged

Update Delta (Encrypted)

{
  "type": "card_update",
  "from": "Alice's public key",
  "version": 6,
  "timestamp": "2026-01-21T12:00:00Z",
  "changes": [
    {
      "op": "update",
      "path": "/fields/phone",
      "value": "555-2222"
    }
  ],
  "signature": "Ed25519 signature"
}

Security Properties

PropertyMechanism
End-to-End EncryptionUpdates encrypted with per-contact shared keys
Relay BlindnessRelay sees only encrypted blobs, no metadata
Update AuthenticityEd25519 signature on all updates
Replay PreventionMonotonic version numbers + timestamps
Visibility EnforcementOnly visible fields sent to each contact