mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-12-04 15:46:43 +00:00
The endpoint emails the invite links of registration tokens minted through the token API: to the token's own address, or to one given for a token without an address. The links are only ever mailed, so the response carries a count rather than the links. Everything is checked before anything is scheduled, so a rejected request sends no email at all: each token must exist and be valid, and an address given for a token with one must be the token's, ignoring case. A token and address given more than once, ignoring case, are emailed once. The sends are spread 100 ms apart, so a large batch doesn't burst against the SMTP server. The caller sends the room name and the inviter on the inviter's behalf, so the endpoint doesn't trust them. The room name and the inviter's display name are stripped of control characters, including the bidirectional controls `char::is_control` misses, and truncated before they are stored in the job payload. The inviter's Matrix ID is never truncated, so it can't show a server it isn't from: it is kept whole if it is valid under the historical grammar, and left out otherwise. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqDpJbETzs7DLgqpMfkYtG