Skip to content
CliprWiki

Sharing internals

Groups, pairs, packets and their life cycle – how a ticket safely reaches another account.

Every account has its own encrypted store. A shared ticket therefore has to travel from one store to another – even if one of them is a locked vault. An intermediate storage with packets handles this.

Code: services/groups.py, services/shares.py, services/exchange.py, api/groups.py.

Groups

  • Per account at most CLIPR_GROUP_MAX_OWNED groups founded (default 3), per group at most CLIPR_GROUP_MAX_MEMBERS people (default 6). Open invitations count.
  • Inviting only by the founder, always bound to a particular person:
    • by email address: the answer is the same whether an account exists or not. Existing accounts get a request in the app and a notice email without a code; addresses without an account get a registration link (code stored only as a hash, bound to the address).
    • by name search: only accounts that made themselves findable, only on an exact match, email address only shortened (a…@g….de), at most 30 searches per hour.
  • Joining only after confirmation. Invitations expire after CLIPR_GROUP_INVITE_DAYS.
  • Members of all shared groups appear as suggestions under “Who is the ticket for?”.

Pairs and packets

flowchart LR
  A[("Store A")] -- "packet, encrypted<br/>with pair key" --> X[("exchange.db<br/>pair A–B")]
  X -- "when B is opened" --> B[("Store B")]
  B -- "accept / decline / return" --> X
  X --> A
  • A pair (pairs, user_lo < user_hi) connects exactly two accounts. A database trigger enforces that sender and recipient of a packet are exactly these two.
  • Every pair has its own AES-GCM key, wrapped with server:pair-wrap.
  • Packets contain ticket data, file and code image – encrypted with the pair key.

Life cycle

stateDiagram-v2
  [*] --> pending: offer
  pending --> active: accept
  pending --> declined: decline
  pending --> expired: deadline passed / no shared group
  active --> active: update
  active --> [*]: revoke (uploader)
  active --> returned: return (recipient)
  1. offer: the uploader assigns a ticket to a member. Their ticket gets share.state = pending.
  2. accept / decline: the recipient accepts (the ticket is copied into their store, the packet deleted) or declines. Offers always need their consent.
  3. update: if the uploader changes shared details, an update goes out; a pending one is replaced. The recipient's notes and status stay untouched. Critical changes (code, date, time, venue, journey) create a notice.
  4. revoke: if the uploader deletes the ticket or gives it to someone else, the copy is removed.
  5. return: the recipient returns the ticket; only the uploader can delete it for good.

Control packets (accept, decline, update, revoke, return) are applied automatically as soon as the target store is open – immediately for standard stores, on unlock for vaults. If an update waits for a locked vault for more than seven days, it lapses; the uploader can send it again.

Recipient rights

Received tickets are managed by someone else (shares.managed_by): only notes, status (“Attended”) and the recipient's own use of journeys can be changed. Passing on is not possible. Price and booking date stay with the uploader.

Special cases

  • If two people no longer share a group, open offers expire; accepted tickets stay connected.
  • If an account is deleted, its packets are deleted. Copies with others remain as independent tickets (“orphaned”).