Skip to content

(sdk: local_relay): Add relay_url to LocalRelayBuilderNip42 - #1476

Open
zupzup wants to merge 2 commits into
nostrdevkit:masterfrom
BitcreditProtocol:master
Open

zupzup wants to merge 2 commits into
nostrdevkit:masterfrom
BitcreditProtocol:master

Conversation

@zupzup

@zupzup zupzup commented Sep 15, 2026

Copy link
Copy Markdown

Description

Since the nip42 authentication now also checks the relay tag and defaults to self.url().await, this means it validates against the internal URL of the relay, instead of the public-facing URL.

This is fine for tests, but problematic for all other use-cases.

This PR adds an optional relay_url to LocalRelayBuilderNip42, which lets the user override this behaviour, so the validation is against their defined public URL.

Checklist

  • I followed the contribution guidelines
  • I updated the relevant CHANGELOG.md (if applicable)
  • I understand and can explain all code in this PR

Comment thread nostr-sdk/src/local_relay/builder.rs Outdated

/// Set the relay URL expected in NIP-42 authentication events.
///
/// This is useful when the local relay is embedded behind another

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would removed this extra 3 lines, I don't see them useful

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed and fixed the cargo fmt issue from CI 👍

@TheAwiteb TheAwiteb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.25000% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nostr-sdk/src/local_relay/builder.rs 14.28% 6 Missing ⚠️
nostr-sdk/src/local_relay/local/inner.rs 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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