Friend Request Flow
sequenceDiagram
participant A as User A (Sender)
participant S as Ecall Server
participant Trust as Trust Cache
participant B as User B (Receiver)
Note over A,B: User A initiates add friend...
alt Using Contact History
A->>S: POST /app/api/friend-request/by-id {targetUserId: participantId}
else Using QR/Share Token
A->>S: POST /app/api/friend-request/by-token {token: token}
end
rect rgb(239, 246, 255)
Note over S: Validate request limits & store pending request
end
S-->>A: publicKeyHashs?
A->>Trust: Verify and cache peer key hashes
S->>B: Push Notification: .newFriendRequested
Note right of B: User B opens app, goes to Friend Requests
B->>S: POST /app/api/friend-request/accept
S-->>B: publicKeyHashs?
B->>Trust: Verify and cache peer key hashes
rect rgb(209, 250, 229)
Note over S: Create bidirectional contact link (A <-> B)
end
S->>A: Push Notification: .acceptFriendRequested
Note over A,B: Contact lists and request badges refresh
Note over A,B: Both users' contact lists & badge counts reload automatically