feat(nip42): add session tracking and optional authRequired - #716
Open
Anshumancanrock wants to merge 5 commits into
Open
feat(nip42): add session tracking and optional authRequired#716Anshumancanrock wants to merge 5 commits into
Anshumancanrock wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: dcf8f6b 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/nip42-session
branch
from
August 5, 2026 07:38
4be9d12 to
b0c8ad0
Compare
There was a problem hiding this comment.
Pull request overview
Adds per-socket NIP-42 session tracking, optional session expiry, and configurable publish authentication.
Changes:
- Introduces
Nip42SessionManagerwith TTL support. - Enforces optional authentication for event publishing.
- Updates NIP-11 metadata, configuration, documentation, and tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.changeset/nip42-session-manager.md |
Records the minor feature release. |
CONFIGURATION.md |
Documents the new NIP-42 settings. |
resources/default-settings.yaml |
Adds disabled-by-default configuration. |
src/@types/settings.ts |
Types the new settings. |
src/adapters/web-socket-adapter.ts |
Integrates per-socket sessions and expiry. |
src/handlers/event-message-handler.ts |
Enforces publish authentication. |
src/handlers/request-handlers/root-request-handler.ts |
Advertises authentication in NIP-11. |
src/routes/index.ts |
Adds CodeQL annotations for public routes. |
src/utils/nip42-session.ts |
Implements session and challenge management. |
src/utils/nip42.ts |
Adds the authentication-setting helper. |
test/unit/adapters/web-socket-adapter.spec.ts |
Tests adapter session behavior. |
test/unit/handlers/event-message-handler.spec.ts |
Tests publish-auth decisions. |
test/unit/handlers/request-handlers/root-request-handler.spec.ts |
Tests NIP-11 metadata. |
test/unit/utils/nip42-session.spec.ts |
Tests session management and expiry. |
test/unit/utils/nip42.spec.ts |
Tests authentication configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
This PR tightens NIP-42 session handling without changing default relay behavior.
sessionTtl)nip42.authRequiredso relays can require AUTH before publisheslimitation.auth_required)Defaults stay off (
authRequired: false,sessionTtl: 0), so existing open relays behave the same.