block / block/buzz

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

Open
#5,167 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

### 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 --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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.