Skip to content

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

Description

@jurgenhaas

Problem

Every --pubkey flag in buzz-cli validates with validate_hex64 (crates/buzz-cli/src/validate.rs:29), so it only accepts 64-char hex. But messages send --mention normalizes with nostr::PublicKey::parse (crates/buzz-cli/src/commands/messages.rs:231-232), which accepts hex and bech32 npub1….

The result is an inconsistent surface, and it bites during the most common onboarding path: Buzz Desktop and chat both surface an npub, so adding a new member requires a manual bech32 decode before this works:

buzz channels add-member --channel <uuid> --pubkey <64-char-hex> --role member

Passing the npub fails with must be a 64-character hex string: npub1…, and there is no npub↔hex conversion subcommand in the CLI.

Proposal

Add a normalize_pubkey helper that accepts either form and returns lowercase hex, and use it for user-identity flags: channels add-member/remove-member, users get/presence, dms open/add-member, moderation ban/unban/timeout/untimeout, agents archive/unarchive.

Git-protocol pubkey fields (repo owner, patch/PR/issue author and recipient) are copied from CLI output rather than typed by hand, so those can stay hex-only for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions