Skip to content

fix(cli): accept npub on --pubkey identity flags - #5174

Open
nawazish2 wants to merge 1 commit into
block:mainfrom
nawazish2:fix/cli-pubkey-accept-npub
Open

fix(cli): accept npub on --pubkey identity flags#5174
nawazish2 wants to merge 1 commit into
block:mainfrom
nawazish2:fix/cli-pubkey-accept-npub

Conversation

@nawazish2

Copy link
Copy Markdown

Summary

--mention already accepts hex or npub, but every --pubkey flag only took 64-char hex via validate_hex64. That bites when you copy an npub out of the desktop UI (the usual onboarding path for channels add-member).

Fixes #5167

What changed

  • Added normalize_pubkey in buzz-cli — parses with nostr::PublicKey::parse, returns lowercase hex
  • Wired it up for identity flags on:
    • channels add-member / remove-member
    • users get / presence
    • dms open / add-member
    • moderation ban / unban / timeout / untimeout
    • agents archive / unarchive (and --replaced-by)
  • Left git-protocol pubkeys alone (repo owner, patch/PR author, etc.) — those still expect hex from CLI output
  • Updated help text so the flags say "hex or npub"

Test plan

  • cargo test -p buzz-cli --lib validate:: (includes hex, uppercase hex, npub, trim, bad input)
  • cargo clippy -p buzz-cli --all-targets -- -D warnings
  • Manual: buzz channels add-member --channel <uuid> --pubkey npub1... --role member should no longer reject the npub at validation

Desktop and chat show npubs, but flags like channels add-member only
took hex and failed with a vague error. --mention already accepted both.

Add normalize_pubkey (hex or npub -> lowercase hex) and use it for
user-identity commands: channels, users, dms, moderation, agents.
Git-protocol fields stay hex-only.

Signed-off-by: Nawazish Khan <175596916+nawazish2@users.noreply.github.com>
@nawazish2
nawazish2 requested a review from a team as a code owner August 7, 2026 10:59
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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.

buzz-cli: --pubkey flags reject npub while --mention accepts it

1 participant