sequenceDiagram
  participant C as client app
  participant A as agent
  participant P as SimpleX<br>Notification<br>Server
  participant APN as Apple<br>Push Notifications<br>Server

  note over C, APN: get device token
  C ->> APN: registerForRemoteNotifications()
  APN ->> C: device token

  note over C, P: register device token with push server
  C ->> A: registerToken
  A ->> P: TNEW
  P ->> A: ID (tokenId)
  A ->> C: registered

  note over C, APN: verify device token
  P ->> APN: E2E encrypted code<br>in background<br>notification
  APN ->> C: deliver background notification with e2ee verification token
  C ->> A: verifyToken<br>(<e2ee code>)
  A ->> P: TVFY code
  P ->> A: OK / ERR
  A ->> C: verified

  note over C, APN: now token ID can be used
  