One person, many accounts
This page is for owners and mods who want to know how the site recognises one person across platforms. After reading it you can explain how a chat message finds its person, why the site joins accounts only with proof, and why the link between accounts is kept private.
A regular viewer may chat as casey on Twitch, casey_tv on Kick, and as a signed-in member of your site. To the platforms these are three strangers. Your site tries to know they are one person, so that their points, badges, votes, the chat bot's memory of them and your moderation follow the person rather than one account.
How a viewer links their accounts is in Linking your platforms. How site accounts work is in Sign-in and accounts.
The person id
Inside the platform, each person has one person id: twelve random hexadecimal characters, such as 3f9a0c12b7de. Chat, payments, votes and memory all point at this id, never at a platform name.
These records connect accounts to a person id:
| Record | One row says | Written when |
|---|---|---|
Platform links (stream.links) |
"This account on this platform belongs to this person" | The first time an account chats or pays, and when a site account is made (with the platform native and the Matrix ID) |
Linked accounts (site.accounts) |
"This site account has linked this platform account", with the encrypted sign-in token | A viewer links a platform on your site |
The name index (stream.nameidx) |
"This lower-case name was first used by this person" | The first time a name is seen |
How a message finds its person
When a message arrives (see How chat flows), stream-api looks for its sender in this order:
- Recently seen. A platform account seen a short while ago is remembered in memory, so a busy chat costs no database lookups.
- A known account. A platform link for this platform and this platform user id names the person.
- A linked account that has not chatted yet. If a site member linked this platform account but never chatted from it, the linked accounts say whose it is. The message joins that member's person id, and a platform link is written so step 2 finds it next time.
- Nobody. A new person id is made, with a platform link for the account.
A matching name is never enough. If casey on Kick is a different human from casey on Twitch, giving the Kick account the Twitch account's person would hand a stranger the original's points, badges, standing and bans. Handles collide across platforms all the time, so the site needs proof: an earlier link, or a viewer who linked the account by signing in to it.
The name index: a name's first owner
The name index maps each lower-case name to the first person who used it. A second person who later uses the same name gets their own person id, and the name stays with the first. Nothing is ever joined because of it.
It is used where a name is all there is to go on: looking up a profile by name, and, when someone asks for their data to be deleted, deciding which names really belong to them. A display name is self-chosen, so deleting by display name would let someone erase another person's lines by renaming themselves. A name someone owns in the index is one only they hold.
Payments that come with only a name
Ko-fi tips, Streamlabs donations and YouTube Super Chats arrive with a name but no user id. Without care, each one would make a new person, and a regular donor's history would be split across dozens of one-off ids. For these, the name stands in for the user id, on that platform only: a Ko-fi donor named "casey" is always the same person on Ko-fi, and is never joined to a Twitch "casey" by name. An "Anonymous" donation gets no stand-in, so all anonymous donors are not lumped into one fake person.
Linking: joining accounts with proof
When a viewer links a platform on your site, they sign in to that platform with OAuth. That sign-in is the proof. The website then:
- checks that no other site account already holds that platform account (a platform account can belong to one site account only; a second claim is refused and changes nothing);
- stores the link and the encrypted token;
- asks stream-api to merge every person id reachable from that site account into one.
A merge picks a survivor (the person id with the most chat, and on a tie the oldest), moves every chat line, payment, link, name and open moderation mark onto it, combines what the chat bot remembers about them, and deletes the others. It all happens in one database transaction: if any step fails, nothing changes.
Mods can also join two people by hand in the Mod Panel under Identity links, for a viewer who cannot link a platform themselves. A merge made there cannot be undone.
Unlinking
When a viewer unlinks a platform account (Linked accounts → Unlink), the site removes the stored sign-in and gives that one platform account a fresh person id of its own. Only that account's link moves. The person's chat history, payments and other links stay with the site account, because a merge mixed them together and they cannot be told apart again.
Unlinking is never a way out of a restriction. An open moderation mark, an active ban, or a ban carried from a deleted account goes with the platform account to its fresh person id, as an open mark for your mods.
What unlinking also changes is showing: see Showing links is the person's choice.
A deleted account under a ban
When someone deletes their site account while it is banned or has an open moderation case (an unresolved report, a held message, a mark), the ban or case follows their platform ids, in a private record kept for that purpose. If a message later arrives from one of those ids, it starts a fresh person with an open, mods-only mark saying it was carried from a deleted account. That person cannot be merged, and a new site account cannot link the platform account (linking answers "already linked"). Deleting an account is therefore no way to shed a ban.
Why links are private
The link between someone's accounts is personal information. It says that this Twitch name, that YouTube channel and this site account are the same human, which a person may not want strangers to know. So the site keeps it out of every public view unless the person shows it themselves.
Public ids
Every public chat message carries a public id for its sender instead of the person id. The public id is made from the person id and the platform, so the same person has one public id for their Twitch lines and a different one for their YouTube lines. Nobody outside your server can tell the two belong together. Within one platform the id stays the same, so ignoring, highlighting, jumping to replies and opening a profile card still work.
How it is made: the person id and platform are encrypted with a key derived from your install's own secret, by a method that always gives the same result for the same input (deterministic authenticated encryption). The id starts with p, so it never looks like a person id or a Matrix ID. Your server can decrypt it back to the person, which is how a profile card or a mod's lookup finds the right person. A changed or made-up id fails its check and finds nothing.
The person id itself travels only on the internal connections of the website's server and stream-ingest. It is removed from every message a browser or overlay receives.
Showing links is the person's choice
A person's profile shows their linked platforms only if they switch that on, in Linked accounts on their profile card. It is off by default for everyone. The same choice covers every place a link could leak: the profile card, the boards on Home, and the credit line that names supporters, which names a platform donation by the name it was made under, not by the site account behind it.
There is one case where a person shows the link themselves: when they post from your site to several platforms at once, their one site line visibly went to those platforms.
Mods, and the person themselves, always see the links, whatever the setting, because moderation has to act on the person everywhere.
A link is shown only while each platform account on that person is still linked. Once someone unlinks a platform account, that account's name stops carrying their site identity on profile cards, the boards and supporter credit.
When a person has more than one site account on the same person id, any one of them with showing switched off keeps the link hidden. One rule decides this everywhere a link could show, in the website and in stream-api, so no page can show what another hides.
Next: How money flows