buzz-cli: --pubkey flags reject npub while --mention accepts it
- Lingua principale
- Rust
- Stelle
- 33.7k
- Fork
- 4.4k
- Merge medio
- 1g 13h
- PR unite (30g)
- 253
Descrizione
### 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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da crates/buzz-cli/src/validate.rs:29 e dalla normalizzazione utilizzata in crates/buzz-cli/src/commands/messages.rs:231-232. Segui i flag di identità utente elencati attraverso i comandi channels, users, dms, moderation e agents, mantenendo i campi pubkey di git-protocol esclusivamente esadecimali. Il lavoro è completato quando questi flag di identità accettano input hex e npub e restituiscono coerentemente valori esadecimali in minuscolo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 72/100