Skip to content

Latchkey 0.2.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 22:00
· 21 commits to main since this release
9ff17b9

Invites, a landing page and browser sign-in for whitelisted Paper servers. A player gets a six-character code, types it on your page with their username, and they're on the whitelist.

Needs

  • Paper 26.1 or later and Java 25.
  • online-mode=true and the whitelist on. Latchkey refuses invites and sign-in otherwise.
  • An HTTPS address in front of the page: a tunnel or a proxy. The page listens on 127.0.0.1 and refuses to run without one.
  • Optional: Usher, which checks and applies the profiles named on an invite.

New in 0.2.0

  • Invites. /latchkey invite create <player> [profiles] [lifetime] makes a single-use code for one username, lasting 14 days by default and 30 at most. Only a salted hash is stored. In game the code goes privately to the admin; on the console it goes to an owner-only file, never the log.
  • The landing page. One form, which works without JavaScript and with a keyboard and screen reader. Form tokens, refusal of posts from other sites, rate limits, the same answer for every kind of wrong code, fixed security headers.
  • Browser sessions, kept by Latchkey. /signin links now sign a browser in on Latchkey's own page. A session lasts a day by default and 30 at most, and is kept open a day at a time while the player is actually playing, at most 7 days in a row. Taking a player off the whitelist, banning them or turning the whitelist off ends their sessions.
  • Safe setup or no setup. Unsafe settings switch off only the part they affect, with one console line saying how to fix it. There's no override.
  • Commands are the API. /latchkey commands answer people in plain words, and tools with one machine-readable line when given --json <id> (the Signalbox format). /latchkey describe lists them.
  • Events for other plugins: InviteCheckEvent when an invite names profiles, InviteRedeemedEvent when one is used.

Upgrading from 0.1.0

  • sign-in-page still works while the landing page is off, so a server that serves the page elsewhere carries on as before. Once the landing page is on, links go to it instead.
  • latchkey.signin is still op-only by default. To let players sign in, grant it: lp group default permission set latchkey.signin true.
  • New permissions for the commands are op-only by default. See the README.

Tested, and not

185 unit and HTTP tests pass. A bot test with Usher passed 38/38 on throwaway Paper 26.1.2, 26.2 and 26.3 servers. It covers the safe-setup refusal, Usher's checks, redeeming on the page, codes never in the log, sign-in to a session file, activity keeping a session open, and whitelist removal, bans and whitelist-off ending sessions. Bots can't join an online-mode server, so those runs used -Dlatchkey.allowOfflineForTesting=true, for throwaway servers only.

Not tested yet: HTTPS through a real tunnel, a real browser, a real game client, or a real server. On 26.2 and 26.3 the bots can't walk, so "playing" was shown there by interaction only.

MIT licensed.