Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
Last active December 19, 2020 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TrueBrain/c9d0e547e59f14bb035fa5e6767cdea3 to your computer and use it in GitHub Desktop.
Save TrueBrain/c9d0e547e59f14bb035fa5e6767cdea3 to your computer and use it in GitHub Desktop.
OpenTTD multiplayer

Decentralized local authentication

Use a public key (pubkey) / secret key (secret) to authenticate yourself with the server. At login, you authenticate yourself to the server. If you protect your company, this is done based on your pubkey. This means that only you with the correct secret can still join that company.

A server stores this pubkey in the savegame, to make company protections survive restarts.

Server sharing pubkeys

A server allows to query which pubkeys are currently playing on a server. The server shares when joining which other pubkeys are on the server. This allows several things:

  • You can whitelist other people to join your company based on pubkey
  • You can have a friendslist on which you can see where your friends are playing

Privacy mode

Optionally, if you want, a new pubkey / secret can be generated for every server you join. This means friends can no longer see on which server you are playing (as you have a new identity on every server). This also means you cannot be tracked over multiple servers.

Pros and cons

Pros

  • Lightweight implementation.
  • All information is local; no central entity is required.
  • No need for any signup; this is fully transparent.

Cons

  • If you lose your secret, you lose your identity (no way to recover).
  • You cannot "login" as yourself on another device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment