feat(nip43): issue kind 28935 invite codes on request - #738
Open
Anshumancanrock wants to merge 3 commits into
Open
feat(nip43): issue kind 28935 invite codes on request#738Anshumancanrock wants to merge 3 commits into
Anshumancanrock wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: b4288d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
Anshumancanrock
force-pushed
the
feat/nip43-invite-requests
branch
from
August 22, 2026 09:57
276ce05 to
b4288d0
Compare
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.
Description
The relay now answers a
REQfor kind 28935 by minting an invite code and returning it as a relay-signed ephemeral event on that subscription only, carryingclaim,-andexpirationtags. Completes the NIP-43 flow: ask for a claim, join with 28934, publish.Off by default. Needs
nip43.enabled, the newnip43.allowInviteRequests, a NIP-42 authenticated requester, and a per-pubkey budget under the newlimits.invite.rateLimits(5/hour). The claim tag is a bearer secret, so the event is never persisted and never broadcast. Also makes the previously inertnip43.inviteRequestWhitelisttake effect.Two fixes that flow needed:
info.selfwas unvalidated and defaulted to a placeholder that is not a pubkey, so out of the box every relay-signed event was unverifiable. NIP-11 now advertises the derived signing key wheninfo.selfis unset or unparseable,nostream infoprints it, and minting refuses on a mismatch.EphemeralEventStrategyand got broadcast to every 28935 subscriber, so anyone could inject a forgedclaiminto the subscription people wait for invites on. Now rejected.Motivation and Context
Invite codes could only be minted by an operator running
nostream invite create. NIP-43 lets a client ask the relay directly, for relays that opt in.How Has This Been Tested?
1756 unit tests passing. Covers the mint path (auth required, whitelist, rate limiter failing closed,
selfmismatch), the rejection strategy, and NIP-11selfresolution.Ran it in Docker on an isolated stack: NIP-11 serves the derived signing pubkey instead of the placeholder.