Skip to content

Commit 0463084

Browse files
committed
Spec 3PID unbind API
As per [MSC1915](#1915) Implementation proof: * matrix-org/synapse#4982 * matrix-org/sydent#160 The only alteration made which differs from the proposal is clarity on how to handle homeservers not knowing the `id_server`. All other differences are unintentional.
1 parent 76829ad commit 0463084

File tree

6 files changed

+142
-4
lines changed

6 files changed

+142
-4
lines changed

api/client-server/administrative_contact.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ paths:
163163
schema:
164164
type: object
165165
properties:
166+
id_server:
167+
type: string
168+
description: |-
169+
The identity server to unbind from. If not provided, the homeserver
170+
MUST use the ``id_server`` the identifier was added through. If the
171+
homeserver does not know the original ``id_server``, it MUST return
172+
a ``id_server_unbind_result`` of ``no-support``.
173+
example: "example.org"
166174
medium:
167175
type: string
168176
description: The medium of the third party identifier being removed.
@@ -180,7 +188,24 @@ paths:
180188
user.
181189
schema:
182190
type: object
183-
properties: {}
191+
properties:
192+
id_server_unbind_result:
193+
type: string
194+
enum:
195+
# XXX: I don't know why, but the order matters here so that "no-support"
196+
# doesn't become "no- support" by the renderer.
197+
- "no-support"
198+
- "success"
199+
description: |-
200+
An indicator as to whether or not the homeserver was able to unbind
201+
the 3PID from the identity server. ``success`` indicates that the
202+
indentity server has unbound the identifier whereas ``no-support``
203+
indicates that the identity server refuses to support the request
204+
or the homeserver was not able to determine an identity server to
205+
unbind from.
206+
example: "success"
207+
required:
208+
- id_server_unbind_result
184209
tags:
185210
- User data
186211
"/account/3pid/email/requestToken":

api/client-server/registration.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,39 @@ paths:
524524
description: |-
525525
Additional authentication information for the user-interactive authentication API.
526526
"$ref": "definitions/auth_data.yaml"
527+
id_server:
528+
type: string
529+
description: |-
530+
The identity server to unbind all of the user's 3PIDs from.
531+
If not provided, the homeserver MUST use the ``id_server``
532+
that was originally use to bind each identifier. If the
533+
homeserver does not know which ``id_server`` that was,
534+
it must return an ``id_server_unbind_result`` of
535+
``no-support``.
536+
example: "example.org"
527537
responses:
528538
200:
529539
description: The account has been deactivated.
530-
examples:
531-
application/json: {}
532540
schema:
533541
type: object
542+
properties:
543+
id_server_unbind_result:
544+
type: string
545+
enum:
546+
- "success"
547+
- "no-support"
548+
description: |-
549+
An indicator as to whether or not the homeserver was able to unbind
550+
the user's 3PIDs from the identity server(s). ``success`` indicates
551+
that all identifiers have been unbound from the identity server while
552+
``no-support`` indicates that one or more identifiers failed to unbind
553+
due to the identity server refusing the request or the homeserver
554+
being unable to determine an identity server to unbind from. This
555+
must be ``success`` if the homeserver has no identifiers to unbind
556+
for the user.
557+
example: "success"
558+
required:
559+
- id_server_unbind_result
534560
401:
535561
description: |-
536562
The homeserver requires additional authentication information.

api/identity/associations.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,86 @@ paths:
201201
}
202202
schema:
203203
$ref: "../client-server/definitions/errors/error.yaml"
204+
"/3pid/unbind":
205+
post:
206+
summary: Remove an association between a session and a Matrix user ID.
207+
description: |-
208+
Remove an association between a session and a Matrix user ID.
209+
210+
Future calls to ``/lookup`` for any of the session's 3pids will not
211+
return the removed association.
212+
213+
The identity server should authenticate the request in one of two
214+
ways:
215+
216+
1. The request is signed by the homeserver which controls the ``user_id``.
217+
2. The request includes the ``sid`` and ``client_secret`` parameters,
218+
as per ``/3pid/bind``, which proves ownership of the 3PID.
219+
220+
If this endpoint returns a JSON Matrix error, that error should be passed
221+
through to the client requesting an unbind through a homeserver, if the
222+
homeserver is acting on behalf of a client.
223+
operationId: unbind
224+
parameters:
225+
- in: body
226+
name: body
227+
schema:
228+
type: object
229+
example: {
230+
"sid": "1234",
231+
"client_secret": "monkeys_are_GREAT",
232+
"mxid": "@ears:example.org",
233+
"threepid": {
234+
"medium": "email",
235+
"address": "[email protected]"
236+
}
237+
}
238+
properties:
239+
sid:
240+
type: string
241+
description: The Session ID generated by the ``requestToken`` call.
242+
client_secret:
243+
type: string
244+
description: The client secret passed to the ``requestToken`` call.
245+
mxid:
246+
type: string
247+
description: The Matrix user ID to remove from the 3pids.
248+
threepid:
249+
type: object
250+
title: 3PID
251+
description: |-
252+
The 3PID to remove. Must match the 3PID used to generate the session
253+
if using ``sid`` and ``client_secret`` to authenticate this request.
254+
properties:
255+
medium:
256+
type: string
257+
description: |-
258+
A medium from the `3PID Types`_ Appendix, matching the medium
259+
of the identifier to unbind.
260+
address:
261+
type: string
262+
description: The 3PID address to remove.
263+
required: ['medium', 'address']
264+
required: ["threepid", "mxid"]
265+
responses:
266+
200:
267+
description: The association was successfully removed.
268+
examples:
269+
application/json: {}
270+
schema:
271+
type: object
272+
400:
273+
description: |-
274+
If the response body is not a JSON Matrix error, the identity server
275+
does not support unbinds. If a JSON Matrix error is in the response
276+
body, the requesting party should respect the error.
277+
404:
278+
description: |-
279+
If the response body is not a JSON Matrix error, the identity server
280+
does not support unbinds. If a JSON Matrix error is in the response
281+
body, the requesting party should respect the error.
282+
501:
283+
description: |-
284+
If the response body is not a JSON Matrix error, the identity server
285+
does not support unbinds. If a JSON Matrix error is in the response
286+
body, the requesting party should respect the error.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``id_server`` to ``/deactivate`` and ``/3pid/delete`` endpoints to unbind from a specific identity server.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``/3pid/unbind`` for removing 3PIDs.

proposals/1915-unbind-identity-server-param.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ known by the homeserver).
2727
The 200 response is a JSON object with an `id_server_unbind_result` field whose
2828
value is either `success` or `no-support`, where the latter indicates that the
2929
identity server (IS) does not support unbinding 3PIDs directly. If the identity
30-
server returns an error then that should be returned to the client.
30+
server returns an error then that should be returned to the client. If the homeserver
31+
is unable to determine an `id_server` to use, it should return `no-support` for
32+
the `id_server_unbind_result`.
3133

3234
Example:
3335

0 commit comments

Comments
 (0)