Skip to content

feat: add NIP-70 protected event detection util#643

Open
Anshumancanrock wants to merge 2 commits into
cameri:mainfrom
Anshumancanrock:nip70-protected-event-util
Open

feat: add NIP-70 protected event detection util#643
Anshumancanrock wants to merge 2 commits into
cameri:mainfrom
Anshumancanrock:nip70-protected-event-util

Conversation

@Anshumancanrock

Copy link
Copy Markdown
Collaborator

Description

nostream doesn't handle ["-"] tags right now. Per NIP-70, when an event has this tag it means the author wants it to only be accepted from them directly (after auth). Relays should either reject these outright or check NIP-42 auth first.

Just laying the groundwork in this PR:

  • add EventTags.Protected = '-' to constants/base.ts
  • add isProtectedEvent() helper to utils/event.ts
  • 6 unit tests covering the tag detection

The handler-side enforcement comes in the next PR.

@changeset-bot

changeset-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73dfdd8

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

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

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

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 66.995% (+0.02%) from 66.977% — Anshumancanrock:nip70-protected-event-util into cameri:main

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