Skip to content

Commit 9466833

Browse files
clokepanoadragon453uhoreg
authored
MSC4009: Expanding the Matrix ID grammar to enable E.164 IDs (#4009)
* E.164 Matrix IDs. * Fix typo. * small typo fixes * Expand examples. Another reasonable way around this is to use a prefix, instead of character mapping. The downsides are essentially the same. * Updates from feedback. * Fix typos. Co-authored-by: Hubert Chathi <hubertc@matrix.org> * Add note about re-using IDs. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Hubert Chathi <hubertc@matrix.org>
1 parent a3778b3 commit 9466833

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

proposals/4009-e.164-matrix-ids.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# MSC4009: Expanding the Matrix ID grammar to enable E.164 IDs
2+
3+
[E.164](https://www.itu.int/rec/T-REC-E.164) is a set of international standards
4+
for telephone numbering. This defines a phone number as a `+` followed by a country
5+
code (e.g. `1` for the US, `44` for the UK) followed by a local phone number.
6+
For example, a E.164 phone number would look like: `+15558675309`.
7+
8+
It is somewhat common[^1] for social networks or messaging applications to use phone
9+
numbers as identifiers instead of relying on users remembering separate usernames
10+
(and needing to tell other users how to find them).
11+
12+
[Matrix user identifiers](https://spec.matrix.org/v1.6/appendices/#user-identifiers)
13+
are *almost* compatible with E.164:
14+
15+
> The `localpart` of a user ID is an opaque identifier for that user. It MUST NOT
16+
> be empty, and MUST contain only the characters `a-z`, `0-9`, `.`, `_`, `=`, `-`,
17+
> and `/`.
18+
19+
## Proposal
20+
21+
Add `+` to the list of allowed characters in a Matrix user identifier. This would
22+
allow a full E.164 phone number as a user's username on a server, which is common
23+
practice for many applications. This should hopefully ease bridging of those
24+
services to Matrix or help them natively speak Matrix in the future. Users would
25+
not need to learn a new Matrix ID, but can continue using their phone number, as
26+
today.
27+
28+
Although E.164 IDs are meant to be globally unique they are still namespaced under
29+
a domain under this proposal, e.g. `@+15558675309:example.com`, as the same user may
30+
already be registered on multiple service providers.
31+
32+
## Potential issues
33+
34+
Homeservers and clients must already be
35+
[more tolerant of Matrix user IDs](https://spec.matrix.org/v1.6/appendices/#historical-user-ids):
36+
37+
> Older versions of this specification were more tolerant of the characters
38+
> permitted in user ID localparts. [...] clients and servers MUST accept user IDs
39+
> with localparts from the expanded character set:
40+
>
41+
> `extended_user_id_char = %x21-39 / %x3B-7E ; all ASCII printing chars except :`
42+
43+
Thus, it is expected to not cause any issues, although clients will need to identify
44+
that the `+` character is valid for a homeserver. This could be from the supported
45+
Matrix versions which the homeserver advertises.
46+
47+
----
48+
49+
A user having two accounts with the same identifier on different services is not
50+
ideal, but is not different than today where a user may log into both WhatsApp
51+
and Signal with their phone number. This MSC does *not* attempt to help with mapping
52+
of an E.164 identifier to an actual Matrix ID, that's best left to the current
53+
[identity service `/lookup` endpoint](https://spec.matrix.org/v1.6/identity-service-api/#post_matrixidentityv2lookup)
54+
or future discovery services.
55+
56+
----
57+
58+
If a service uses E.164 identifiers as Matrix IDs then it must be careful to avoid
59+
leaking history when reassigning IDs to new users. This is related to [#234](https://github.com/matrix-org/matrix-spec/issues/234),
60+
but only applies to the localpart of the Matrix ID, not the entire domain. The
61+
solution remains the same: using portable identifiers ([MSC1228](https://github.com/matrix-org/matrix-spec-proposals/pull/1228)
62+
or [MSC4014](https://github.com/matrix-org/matrix-spec-proposals/pull/4014)).
63+
64+
## Alternatives
65+
66+
The `+` could continue to be disallowed and left off the beginning of the Matrix
67+
IDs. Note that Synapse reserves digit-only usernames for guest users, although this
68+
seems to be an implementation detail and not mandated by the specification.
69+
70+
Another option would be to [map from other character sets](https://spec.matrix.org/v1.6/appendices/#mapping-from-other-character-sets)
71+
or prefix the Matrix ID with something (e.g. `msisdn`).
72+
This would generate a Matrix ID like `@=2b15558675309:example.com` or
73+
`@msisdn_5558675309:example.com`, which would dramatically impact usability
74+
for the users on homeservers which use phone numbers as identifiers.
75+
76+
----
77+
78+
Although E.164 limits the `+` character to the initial character there seems to
79+
be no reason to limit that for Matrix identifiers.
80+
81+
## Security considerations
82+
83+
E.164 IDs are globally unique, but the proposed change only enforces per-homeserver
84+
uniqueness. If a homeserver does not diligently check that the phone number belongs
85+
to a user then this may allow additional spoofing attacks. The author does not consider
86+
this to be much worse than today's situation:
87+
88+
1. Many current applications need to verify that a phone number truly is owned
89+
by an account. Any current best practices should be followed by a service
90+
taking advantage of this MSC.
91+
2. It is already quite easy today to spoof a user's ID by registering the same
92+
user localpart on a different homeserver. The same issue occurs with email or
93+
other distributed system (Mastodon, etc.).
94+
95+
## Unstable prefix
96+
97+
N/A
98+
99+
## Dependencies
100+
101+
N/A
102+
103+
[^1]: E.g. Signal, WhatsApp, etc.

0 commit comments

Comments
 (0)