Skip to content

feat: add nip-25 support#589

Merged
cameri merged 8 commits intocameri:mainfrom
CKodidela:feat/nip-25
May 3, 2026
Merged

feat: add nip-25 support#589
cameri merged 8 commits intocameri:mainfrom
CKodidela:feat/nip-25

Conversation

@CKodidela
Copy link
Copy Markdown
Collaborator

Description

Implements NIP-25 (Reactions) support for kind 7 (nostr event reactions) and kind 17 (external content reactions).

  • Added EXTERNAL_CONTENT_REACTION = 17 to EventKinds and new tags (Address, Index, Emoji) to EventTags
  • Added ReactionEntry type to @types/event
  • Created src/utils/nip25.ts with isReactionEvent, isExternalContentReactionEvent, isLikeReaction,
    isDislikeReaction, and parseReaction helpers
  • Schema validation: kind 7 must include at least one e tag; kind 17 must include k and i tags
  • Wired reaction event types into event-strategy-factory

Related Issue

Closes #578

Motivation and Context

NIP-25 defines how clients express reactions (likes, dislikes, emoji) to notes and external content. This adds
relay-side support for storing, validating, and querying reaction events.

How Has This Been Tested?

  • Unit tests for all utility functions (isReactionEvent, isLikeReaction, isDislikeReaction, parseReaction,
    etc.)
  • Unit tests for schema validation (valid/invalid kind 7 and kind 17 events)
  • Unit tests for event strategy factory routing
  • Integration tests covering like, dislike, and emoji reaction scenarios
  • All existing tests continue to pass

Screenshots (if appropriate):

N/A

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

🦋 Changeset detected

Latest commit: f476e60

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

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 28, 2026

Coverage Status

coverage: 65.082% (+0.3%) from 64.786% — CKodidela:feat/nip-25 into cameri:main

@CKodidela
Copy link
Copy Markdown
Collaborator Author

@copilot can you add changeset and upadte readme with nip 25 and also add 25 to package.json

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds relay-side support for NIP-25 reactions by introducing reaction kinds/tags, validation rules, and helper utilities, along with unit + integration coverage.

Changes:

  • Added NIP-25 constants/types (EXTERNAL_CONTENT_REACTION, reaction-related EventTags, ReactionEntry).
  • Implemented src/utils/nip25.ts helpers for identifying/parsing reaction events.
  • Extended eventSchema with NIP-25-specific validation and added unit/integration tests for reaction flows.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/constants/base.ts Adds kind 17 and reaction-related tag constants.
src/@types/event.ts Introduces ReactionEntry for parsed reaction targets.
src/utils/nip25.ts Implements NIP-25 reaction detection/parsing helpers.
src/schemas/event-schema.ts Adds schema refinement enforcing reaction tag requirements.
src/factories/event-strategy-factory.ts Wires reaction kinds into strategy routing (currently default).
test/unit/utils/nip25.spec.ts Unit tests for NIP-25 utility helpers.
test/unit/schemas/event-schema.spec.ts Unit tests for new NIP-25 schema constraints.
test/unit/factories/event-strategy-factory.spec.ts Tests factory routing for reaction kinds.
test/integration/features/nip-25/nip-25.feature Cucumber feature scenarios for like/dislike/emoji reactions.
test/integration/features/nip-25/nip-25.feature.ts Step definitions implementing the NIP-25 feature scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/schemas/event-schema.ts Outdated
Comment thread src/schemas/event-schema.ts Outdated
Comment thread src/utils/nip25.ts Outdated
Comment thread src/factories/event-strategy-factory.ts Outdated
@CKodidela
Copy link
Copy Markdown
Collaborator Author

The commit merge: integrate NIP-65 relay list metadata from main was failing the commitlint check because merge isn't a valid conventional commit type. I amended the message to chore: and force pushed to fix the CI check. No code changes were made to that commit, only the message.

@CKodidela
Copy link
Copy Markdown
Collaborator Author

@cameri This PR is up for review

Comment thread src/schemas/event-schema.ts Outdated
Comment thread src/utils/nip25.ts Outdated
@CKodidela
Copy link
Copy Markdown
Collaborator Author

Will resolve these by EOD tmrw

@CKodidela
Copy link
Copy Markdown
Collaborator Author

@cameri up for review

@cameri cameri merged commit 25d5405 into cameri:main May 3, 2026
15 of 16 checks passed
@CKodidela CKodidela deleted the feat/nip-25 branch May 3, 2026 20:01
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.

feat: add NIP-25 (Reactions) support

4 participants