Repository navigation
feat(relay): list and revoke invite links - #9680
Merged
Merged
Conversation
Add GET /api/invites (owner/admin) and POST /api/invites/revoke (by id or v2 code; owner/admin or the invite's creator, gated in the write transaction). Mint responses now include invite_id, and every reader of an invite's expiry accepts a missing value so a later release can mint links that never expire. Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Return fixed parse errors that never echo input, use a self-contained (created_at, id) list cursor, log database revoke refusals as denials, and cover the revoke writer's demotion, restriction, claim and quiescing races plus replay on the new routes. Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Signed-off-by: Will Pfleger <wpfleger@block.xyz>
This was referenced Nov 19, 2026
wpfleger96
marked this pull request as ready for review
November 19, 2026 22:41
wpfleger96
requested review from
TheSentinel454,
bradseiler,
ravarora2 and
salman1993
as code owners
November 19, 2026 22:41
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
brow
approved these changes
Nov 19, 2026
TheSentinel454
approved these changes
Nov 20, 2026
TheSentinel454
left a comment
Contributor
There was a problem hiding this comment.
🤖 LGTM. Lock order matches claim and mint, list and revoke never return a code or hash, and all new tests ran in CI at this head.
mcdickenson
added a commit
that referenced
this pull request
Nov 20, 2026
…mployee-name-sync-20261112-92c07862 * origin/main: (65 commits) fix(mobile): diagnostic reporting follow-ups (#9808) feat(relay): list and revoke invite links (#9680) fix(push-gateway): answer 429, not 404, when the delivery quota is exhausted (#9803) feat(cli): leave archived identities out of users get --name (#9752) fix(mobile): skip the emoji picker when its opener is gone (#9820) fix(push-gateway): retry, don't drop, a delivery replayed while its first attempt is in flight (#9802) fix(mobile): clear the Duo top edge in the Activity header (#9807) feat(test-client): add buzz-acceptance relay probe (#9767) feat(relay): add pinned messages (nip-pm) (#9729) Align Duo chat headers, inset Home selections, and fix received photo-stack swipes (#9795) fix(mobile): only dot channel-sent replies in the reader's threads (#9696) docs: point community invite at buzz.communities (#9797) Mobile: refine section filters and ordering in Messages (#9796) feat(push-gateway): mint FCM tokens through AWS workload identity federation (#9692) feat(mobile): report explicit diagnostic errors (#9673) fix(mobile): keep the agent poster over a failed iOS player (#9693) perf(push-gateway): evict the oldest signed-call window without scanning (#9799) Refine iOS composer and transcribe recordings into drafts (#9574) fix(mobile): recognize agents without NIP-OA in Huddles (#8545) test(relay): cover member-cache invalidation routes and refill orders (#9748) ... Signed-off-by: Matt Dickenson <mdickenson@squareup.com> # Conflicts: # crates/buzz-relay/src/router.rs
wpfleger96
added a commit
to block/buzz-app
that referenced
this pull request
Nov 20, 2026
Adds invite-link management to community Membership settings. - **Links tab** for owners and admins: each invite with its status, uses and expiry, a **Revoke** button on every row (with confirmation), paging, and a Refresh that keeps pages already loaded. A **Revoke a link** field takes a pasted invite link for this community and revokes it by its code. People who already joined stay in. - **Revoke results** come from the relay's receipt, so a revoked row shows Revoked even when a later list read fails. A failed revoke keeps the confirmation open with a readable error and Retry; after a timeout, Refresh shows what the relay holds. A revoke still in flight, success or failure, still shows when the admin goes Back to Members and Forward again. After a row is revoked, focus moves to the list. - **Links without an expiry** read "Never expires" in the list. - **Both hosts** (browser broker and native `relay_http`) support a signed `GET /api/invites`, which accepts only the relay's opaque `before` cursor, and `POST /api/invites/revoke`. Request shapes are normalized in `admin-protocol.ts`. Minting is unchanged from main. Stack: #3910 → #4120 Related: [buzz#9680](block/buzz#9680) --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Hayt <211b96e6a2b7f45fd4047988976c7bbbeeda0c15f3ae7b32eec20834b5a55118@buzz.block.builderlab.xyz>
ruvnet
added a commit
to ruvnet/ruflo
that referenced
this pull request
Nov 22, 2026
…_sync cursor (#5029, #5030) (#5057) * fix(x-gateway): single-use invites, invite revocation, ordered sync cursor (#5029, #5030) #5029 - mintInvite and federation_invite_mint default to max_uses 1 (was 25); maxUses/ttlSecs must be positive integers. - New legacy-only, admin-only federation_invite_revoke: revokes by code or id via buzz-relay POST /api/invites/revoke (block/buzz#9680). Admission is decided by the relay, so revocation lives there; a relay build without the route answers 404 and the tool reports "unsupported". Withheld from the directory profiles because it accepts an invite code. - CLI: x_federation_invite_revoke passthrough; mint/--uses text says default 1. #5030 - federation_sync returns next_cursor and accepts since_cursor. The relay exposes no receive-order sequence, so the cursor carries a window floor plus 48-bit prefixes of the ids already delivered inside it. Each call reads the whole window (full NIP-01 pages are narrowed by `until` bisection, because `limit` keeps the newest events) and delivers unseen events oldest first by (created_at, id). Same-second events and late arrivals within 300 s are delivered exactly once. A timed-out read hands the same cursor back. - The cursor is decoded as hostile input: length cap, strict shape, lookback clamped to 30 days, bound to the type filter. - No-cursor calls keep the old window read and relay filter. - CLI: since_cursor in the x_federation_sync schema; `federation sync --cursor`. Gateway package 0.9.2 -> 0.10.0, plugin 0.10.6 -> 0.11.0. Co-Authored-By: RuFlo <ruv@ruv.net> * fix(x-gateway): judge sync completeness on the raw relay page; compact cursor buzz-relay applies `limit` in SQL before it matches #t/#k in Rust (handlers/req.rs filter_fully_pushable), so a short #t-filtered page does not prove a window complete. Cursor reads now send only kinds/since/until/limit, match the swarm tag and type locally, and judge completeness on the raw count. A no-cursor read cannot prove completeness either, so its next_cursor keeps the whole requested window and remembers what was returned. The cursor encodes delivered ids as delta-coded seconds, so the largest cursor the gateway can emit (2000 ids in distinct seconds) fits the schema cap, and any type string the tool accepts round-trips. Tests: the fake relay applies limit before tag matching and carries non-swarm traffic; a property test pins the cursor size bound. Co-Authored-By: RuFlo <ruv@ruv.net> * test(ci): list the new x-gateway node:test files in the root ratchet baseline invite-admin and sync-cursor import nostr-tools, which only the plugin's own `npm test` installs (157/157 pass there), like the other x-gateway suites. Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: this PR → #9690
What this does
Adds listing and revocation for v2 invite links, and makes every reader of an invite's expiry accept a missing value.
GET /api/invites?limit=&before=lists the community's v2 invites, newest first: id, creator, created/expiry/revoked times, uses and a computedstatus(active,revoked,expired,exhausted). Owner/admin only. The NIP-98 signature covers the full URL including the query.limitdefaults to 50 (max 200).next_beforeis an opaque cursor holding the last row'screated_at(microseconds) and id, so paging doesn't depend on that row still existing.POST /api/invites/revoketakes exactly one of{"id": "<uuid>"}or{"code": "v2...."}. The code is hashed and looked up only inside the request's community. v1 and malformed codes get400 invite_not_revocable; an invite not in the community gets 404. Revoking twice returns the firstrevoked_at. Members who already joined stay.FOR SHARE→ restriction check → invite rowFOR UPDATE. Owners and admins can revoke any invite; any other member only one they created. A removed or restricted actor is refused. Mint now uses the same role-lock helper.invite_id.expires_atas "never expires". The column is stillNOT NULLhere.invite_id. A revoke the database refuses is logged as denied with its reason.Deploy order
A follow-up PR adds links that never expire (
expires_atnullable). It depends on this PR being deployed everywhere first, so every serving relay can read a missing expiry before one is written.Tests
relay_invite/manage_postgres_tests.rs): revoke by code targets exactly one of two near-identical invites, idempotent revoke, community scoping, creator demoted to member can revoke theirs, a member who didn't create it is refused, a removed creator is refused, a restricted admin is refused, a demotion holding the role row or a restriction holding the admission lock makes revoke wait and then refuse with the row unchanged, a paused claim and a revoke serialize with the member kept, revoke is refused while the community is quiescing, paging survives deleting the cursor row, and a row with no expiry is listed, claimed, kept by the reaper and revocable (on a scratch database withNOT NULLdropped).invites/postgres_tests/manage_tests.rs): list/revoke by id and code end to end, no code or hash in responses, member/non-member refusals, bad selectors, other-community lookups, query-string signature binding, malformed requests not echoing a code in responses or access logs, refused revokes logged as denied, and replayed list/revoke requests refused.