Skip to content

feat(nip43): issue kind 28935 invite codes on request - #738

Open
Anshumancanrock wants to merge 3 commits into
cameri:mainfrom
Anshumancanrock:feat/nip43-invite-requests
Open

feat(nip43): issue kind 28935 invite codes on request#738
Anshumancanrock wants to merge 3 commits into
cameri:mainfrom
Anshumancanrock:feat/nip43-invite-requests

Conversation

@Anshumancanrock

@Anshumancanrock Anshumancanrock commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Description

The relay now answers a REQ for kind 28935 by minting an invite code and returning it as a relay-signed ephemeral event on that subscription only, carrying claim, - and expiration tags. Completes the NIP-43 flow: ask for a claim, join with 28934, publish.

Off by default. Needs nip43.enabled, the new nip43.allowInviteRequests, a NIP-42 authenticated requester, and a per-pubkey budget under the new limits.invite.rateLimits (5/hour). The claim tag is a bearer secret, so the event is never persisted and never broadcast. Also makes the previously inert nip43.inviteRequestWhitelist take effect.

Two fixes that flow needed:

  • info.self was 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 when info.self is unset or unparseable, nostream info prints it, and minting refuses on a mismatch.
  • A client-published 28935 fell through to EphemeralEventStrategy and got broadcast to every 28935 subscriber, so anyone could inject a forged claim into 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, self mismatch), the rejection strategy, and NIP-11 self resolution.

Ran it in Docker on an isolated stack: NIP-11 serves the derived signing pubkey instead of the placeholder.

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b4288d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Minor

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

@Anshumancanrock Anshumancanrock changed the title Feat/nip43 invite requests feat: nip43 invite requests Aug 21, 2026
@Anshumancanrock Anshumancanrock changed the title feat: nip43 invite requests feat(nip43): issue kind 28935 invite codes on request Aug 21, 2026
@coveralls

coveralls commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 71.296% (+0.3%) from 70.993% — Anshumancanrock:feat/nip43-invite-requests into cameri:main

@Anshumancanrock
Anshumancanrock force-pushed the feat/nip43-invite-requests branch from 276ce05 to b4288d0 Compare August 22, 2026 09:57
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