Skip to main content

Module identities

Module identities 

Source
Expand description

Nick + domain identities of this messenger server.

The server keeps no user database: it knows a nick, the Matrix localpart derived from it (lowercase nick at FIRST CONTACT, frozen from then on), the first-contact time, and the devices of the credentials a product vouches for. Who a person is, how they log in and which nick rules apply are the product server’s business; the product tells this server by signed assertion (m4a_seam) and by lifecycle events.

Remote federated users are NOT identities: they stay negative-id proxy rows in matrix_users.

Structs§

Identity
ReconcileOutcome
What a reconcile pass changed.
Resolved
What a valid assertion resolved to.

Constants§

NICK_MAX
Longest nick the server will turn into a localpart.

Functions§

apply_account_deleted
Event account.deleted{nick}: devices gone, localpart tombstoned forever, the nick string freed. Returns whether an identity was retired.
apply_credential_revoked
Event credential.revoked{cred_ref}: the device is removed. Returns the user id to wake.
apply_nick_changed
Event nick.changed{old,new}. Ok(Some(id)) when applied.
create_identities_schema
identity_by_id
identity_by_nick
legal_localpart
The only nick check the server makes itself: the nick must be a legal, predictable Matrix localpart. Product nick rules are the product’s.
name_taken
Is lower unavailable as a nick or localpart for anyone but except_id?
nick_of_user
Current nick of an identity, for display labels.
reconcile
Apply the product’s snapshot of live credentials. Devices of a listed nick whose credential is not in its list are removed; with complete, identities whose nick is not listed at all are retired exactly as account.deleted would.
resolve_assertion
Resolve a verified assertion: find the identity by nick, else by the credential’s device (the product renamed the nick; follow it softly), else create it. Creation IS first contact: the Matrix user is made and the localpart frozen in the same transaction. Then the credential’s device.