Skip to content

fix(nip46): kind:0 profile + NIP-98 auth via signer trait#107

Merged
dmnyc merged 1 commit into
masterfrom
fix/nip46-profile-and-nip98
Apr 27, 2026
Merged

fix(nip46): kind:0 profile + NIP-98 auth via signer trait#107
dmnyc merged 1 commit into
masterfrom
fix/nip46-profile-and-nip98

Conversation

@dmnyc

@dmnyc dmnyc commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two commands were stuck on `get_keys_and_client` (which errors out for non-local signers), so remote-signer users couldn't:

  • Update their kind:0 profile metadata — `publish_nostr_profile` failed with "this operation requires local keys".
  • Authenticate image uploads via NIP-98 — `create_nip98_auth` failed identically, breaking image hosts that rely on it (e.g. blossom).

Both commands now route through `get_signer_and_client` and sign via `NostrSigner::sign_event` on an unsigned-event builder, matching the pattern `publish_market_comment` and the social commands already use. Local nsec users are unaffected; NIP-46 users now get the round-trip prompt to their bunker app like every other signed action.

`discovery::publish_profile` signature changes from `(keys: &Keys, ...)` → `(signer: &Arc, ...)`. The kind:0 merge step fetches the author pubkey through the signer instead of dereffing keys directly.

Out of scope

This is a surgical fix for the two commands the user just hit. The broader NIP-46 cleanup (logout button for remote signers, session detection / heartbeat / online flag) is tracked in memory and ships in a follow-up branch.

Test plan

  • Local nsec user updates profile → succeeds (existing behaviour).
  • NIP-46 remote-signer user updates profile → bunker app prompts → kind:0 published.
  • NIP-46 user uploads an image (any flow that goes through `create_nip98_auth`) → bunker prompt → upload authenticated.
  • cargo check, cargo fmt --check, cargo clippy --all-targets -- -D warnings all pass.

Two commands hardcoded \`get_keys_and_client\` (which errors out for
non-local signers), so remote-signer users couldn't:

- Update their kind:0 profile metadata (display name, picture,
  bio, lud16, etc.) — \`publish_nostr_profile\` failed with "this
  operation requires local keys."
- Authenticate image uploads via NIP-98 — \`create_nip98_auth\`
  failed with the same error, breaking image hosts (e.g. blossom)
  that rely on it.

Both now route through \`get_signer_and_client\` and use
\`NostrSigner::sign_event\` on an unsigned-event builder, the same
pattern \`publish_market_comment\` and friends already use. Local
nsec users are unaffected (the trait dispatches to local-keys
sign); NIP-46 users now get the round-trip prompt to their bunker
app like every other signed action.

\`discovery::publish_profile\` signature changes from
\`(keys: &Keys, ...)\` to \`(signer: &Arc<dyn NostrSigner>, ...)\`,
fetching the author's pubkey through the signer for the kind:0
merge step.

Smaller scope of the larger NIP-46 cleanup tracked in memory; the
remaining items (logout-button-for-remote-signer, session
detection) ship in a follow-up branch.
@dmnyc
dmnyc merged commit 069f29a into master Apr 27, 2026
3 checks passed
@dmnyc
dmnyc deleted the fix/nip46-profile-and-nip98 branch April 27, 2026 20:02
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.

1 participant