Skip to content

Add the rotating invite-only ticket core - #1

Open
instilllive wants to merge 1 commit into
mainfrom
cursor/rotating-ticket-core-23bb
Open

instilllive wants to merge 1 commit into
mainfrom
cursor/rotating-ticket-core-23bb

Conversation

@instilllive

Copy link
Copy Markdown
Owner

Step 1 of a private, invite-only ticketing app. No payments, resale, guest messaging, or production deploy.

A host token from the environment creates events and issues named tickets. Each ticket has a server-side 32-byte secret. The guest page shows a QR whose payload is ticket_id, the 5-second step, and a truncated HMAC-SHA256. The door accepts the current step and one step of clock skew, rejects a code from 3 steps ago (~15s), rejects a tampered tag, a revoked ticket, and the wrong event, and checks the ticket in once. A transfer does nothing until the host approves it; approval replaces the secret and the guest link.

Tests

npm run typecheck passed (tsc --noEmit, no errors).

npm test (vitest 3.2.7):

 RUN  v3.2.7 /workspace

 ✓ tests/concurrent.test.ts (2 tests) 498ms
   ✓ concurrent scans > admits only once when several scanners race the same code  314ms
 ✓ tests/http.test.ts (5 tests) 137ms
 ✓ tests/transfer.test.ts (2 tests) 49ms
 ✓ tests/door.test.ts (9 tests) 17ms
 ✓ tests/constant-time.test.ts (1 test) 6ms
 ✓ tests/codes.test.ts (5 tests) 4ms

 Test Files  6 passed (6)
      Tests  24 passed (24)
   Start at  17:35:32
   Duration  1.71s (transform 101ms, setup 0ms, collect 286ms, tests 711ms, environment 1ms, prepare 220ms)

Coverage includes rotation each step (injected clock and fake timers), one-time admit, replay, a code from 3+ steps ago, a tampered HMAC, revoked tickets, the wrong event, a transfer that changes nothing until approval, old codes dying after approval, and a real multi-connection double-scan.

Demo

npm run demo:

Private tickets demo

event: Listening room at June hall
guest: Ada Lovelace

live code:  pt1.d54599ab-2451-408b-bc2b-eb715f41258b.356000000.82547a6b6e9a6dfea296defb03ff1eb9
stale code: pt1.d54599ab-2451-408b-bc2b-eb715f41258b.355999997.85890a28f052075afe3072345f5bc265  (minted 15000ms earlier)

scan live:  ADMIT Ada Lovelace
replay:     REJECTED: already used
scan stale: REJECTED: expired

UI check

In Chrome: create an event, issue a ticket, watch the guest QR rotate to a new payload after one step, request a transfer (name and code unchanged), approve it (old link 404s, new guest gets a new code), scan that code (ADMIT), scan it again (REJECTED / already used), and revoke from the guest list. The door camera reports permission denied in headless Chrome and the paste field still works. The guest page does not overflow at 390px wide.

Open in Web Open in Cursor 

Named guest tickets, host-approved transfers, and a 5-second HMAC door code that admits once. Includes the host, guest, and door pages, vitest coverage, a local demo, and CI for typecheck and tests.

Co-authored-by: instilllive <instilllive@users.noreply.github.com>
@instilllive
instilllive added this pull request to stack #3 November 10, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants