This attempts to describe how the author (@jryans) believes 3PID API flows are working today to support review and criticism. Much of this came from reading the Synapse implementation, so it's possible this follows Synapse more closely than the spec.
This currently uses IS API v1 for simplicity, but the services in play here should be converting to IS API v2.
The flows we are analysing include:
- Adding a 3PID to HS account during registration
- Adding a 3PID to HS account after registration
- Changing the bind status of a 3PID
- Reset password via email
Involves APIs:
POST /_matrix/client/r0/register/<medium>/requestToken
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/register
GET /_matrix/identity/api/v1/3pid/getValidated3pid
Involves APIs:
POST /_matrix/client/r0/account/3pid/<medium>/requestToken
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/account/3pid
GET /_matrix/identity/api/v1/3pid/getValidated3pid
This is a subset of flow 3a below. It's nearly the same, but there's no need to delete the 3PID first.
Involves APIs:
POST /_matrix/client/r0/account/3pid/<medium>/requestToken
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/account/3pid/add
GET /_matrix/identity/api/v1/3pid/getValidated3pid
Involves APIs:
POST /_matrix/client/r0/account/3pid/delete
POST /_matrix/client/r0/account/3pid/<medium>/requestToken
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/account/3pid
GET /_matrix/identity/api/v1/3pid/getValidated3pid
POST /_matrix/identity/api/v1/3pid/bind
POST /_matrix/federation/v1/3pid/onbind
Involves APIs:
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/account/3pid/bind
GET /_matrix/identity/api/v1/3pid/getValidated3pid
POST /_matrix/identity/api/v1/3pid/bind
POST /_matrix/federation/v1/3pid/onbind
Involves APIs:
POST /_matrix/client/r0/account/password/email/requestToken
POST /_matrix/identity/api/v1/validate/<medium>/requestToken
GET /_matrix/identity/api/v1/validate/<medium>/submitToken
POST /_matrix/client/r0/account/password
GET /_matrix/identity/api/v1/3pid/getValidated3pid
2.1. Which flows did so in a pre-MSC2290 world?
submit_url
if that is returned./account/3pid
is called with{bind: false}
and yet the HS calls/identity/3pid/bind
4.1. Would it be worth having a sequence diagram for the post-MSC2290 equivalent of the
/account/3pid
with{bind:true}
flow? even if that is identical to flow 2b followed by 3b, it might be worth making explicit?/register
//account/3pid/*
//account/password
) ? Does it just poll until it gets a success or an unexpected error code? Could this be represented in the sequence diagrams?