-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
The on_threepid_bind
module API is called when a 3PID is *added* (associated locally), not when it is *bound* #14955
Description
Confusing terminology strikes again. Generally, if you "add" a third-party ID (3PID) to your account in Matrix, you are making an association between your Matrix ID and a 3PID that is scoped to your homeserver. You can allow your Matrix ID to be discovered by remote users who have your 3PID by "binding" the 3PID to your Matrix ID on an identity server.
This terminology is reflected in the endpoints, and was coined during the privacy sprint.
Associating your 3PID with your Matrix ID on your homeserver
POST /_matrix/client/v3/account/3pid/add
POST /_matrix/client/v3/account/3pid/delete
- This may trigger an unbind automatically if any bindings are known to your homeserver.
Binding a 3PID to your Matrix ID on an identity server
POST /_matrix/client/v3/account/3pid/bind
POST /_matrix/client/v3/account/3pid/unbind
- Removes the association from an Identity Server, but preserves the association local to your homeserver.
We have a on_threepid_bind
module callback which fires when you add an association between a 3PID and your Matrix ID on your local homeserver. It specifically does not fire when you perform a bind against and identity server.
I think the ideal scenario would be to have 2 module callback methods:
async def on_update_user_third_party_identifier(user_id: str, medium: str, address: str)
- called before a user adds or removes a 3PID to their account at the homeserver scope.async def on_update_identity_server_binding(id_server: str, user_id: str, medium: str, address: str)
- called before a user adds or removes a binding of their 3PID and Matrix to a given identity server.
It may also be advantageous to allow these methods to block the action. When a module decides to block a local association, this could result in a 400/M_UNKNOWN
(?) response to the client. If blocking a bind against an identity server, this could instead result in a response of 200, {"id_server_unbind_result": "no-support"}
being sent to the client. This would allow you to prevent a user from making a binding of non-company email addresses, or to identity servers other than those that are authorised.