fix: honor target relay in profile sync with NIP-42 auth and fallback#4
Merged
Merged
Conversation
Include kind 10063 (BUD-03 user server list) in profile sync operations. Users' preferred Blossom media servers are now fetched, displayed, and synced alongside other profile metadata. Closes derekross#1
- Previously, useSyncProfile attempted to publish via the global nostr pool first, ignoring the user-selected target relay. - Updated to exclusively use a dedicated NPool configured with an eventRouter targeting the selected relay. - Implemented NIP-42 AUTH callback support in NRelay1 to automatically authenticate with paid/protected relays. - Added fallback logic to the default relay if the target relay fails. - Added comprehensive unit tests for successful sync, fallback, failure, NIP-42 auth, and input validation. - Enhanced logging to clearly indicate which relay is receiving each event.
|
@advorzhak is attempting to deploy a commit to the derekross' projects Team on Vercel. A member of the Team first needs to authorize it. |
- Added early user validation to prevent errors for read-only logins. - Moved NPool creation outside the event loop to reuse connections. - Replaced sequential event publishing with Promise.allSettled for concurrent execution. - Fixed unused parameter warning in test mock.
d395b64 to
ad88381
Compare
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.
Fixes #3
Summary
This PR fixes a critical bug where the "Target Relay" selected by the user in the Profile Sync interface was being completely ignored. Events were instead being published to the app's default relay.
Changes Made
useSyncProfileto exclusively use a dedicatedNPoolconfigured with aneventRouterthat explicitly targets the user-selectedtargetRelay.authcallback into theNRelay1instantiation. This automatically responds toAUTHchallenges (kind 22242) using the current user's signer, enabling successful sync to paid or protected relays.📤 Publishing...,✅ Successfully published...,⚠️ TARGET relay failed...) to explicitly show which relay is receiving each event.useSyncProfile.test.tsx) covering:Validation
tsc --noEmit) passesnpm run build) succeeds