Files
buzz/crates
damienrj b68c4edda5 feat(cli): show and search verified identity in users get (#9647)
## Summary

`buzz users get` reads only kind:0 profiles, so the CLI can't find or
confirm a person by their verified username. This adds relay-verified
profiles (kind:30382) to `users get`.

- `--pubkey` adds a `verified` object (`username`, `display_name`,
`full_name`, `issuer_label`, `verified_at`) for subjects that have one.
A requested person with a verified profile but no kind:0 is still
returned.
- `--name` uses the relay's `POST /profiles/search` when the community
advertises verified profiles with `searchable: true`, so it matches
verified names (word prefix). Otherwise, or for queries over the
endpoint's 100-character limit, it runs the existing NIP-50 substring
search and attaches verified profiles where the community advertises
them.

Verified profiles are read only when NIP-11 advertises
`federated_identity.public_profile`. A projection is trusted only if it
is kind 30382, signed by the relay's `self` key with a valid signature,
and follows the NIP-FI projection rules the mobile client applies: empty
content, exactly the projection tags (each once with one value), `p`
equal to `d`, `active` set to `true`, a valid username, names of 1–64
characters with no surrounding whitespace or control characters (looser
than mobile, which also requires NFC and rejects more Unicode
categories), and a decimal `verified_at` no later than `created_at`. The
newest projection per subject wins (the lower id breaks a same-second
tie), so a retraction clears the verified name. Any `verified` key in
user-authored kind:0 content is dropped on every path, so only a
relay-signed projection can set it.

`users get` now makes one NIP-11 request. If that request fails, the
advertisement is malformed, or the kind:30382 lookup fails, it still
prints the kind:0 results and writes a `verified_profiles_unavailable`
warning to stderr. This applies to `--pubkey`, no args, and `--name`.

### Related issue

Related: #8745 (verified profile spec), #9624 (verified-name mentions in
workflows).

### Testing

- `cargo test -p buzz-cli` passes, with tests for trust checks,
retraction, both lookup paths, search without the advertisement, and a
forged `verified` object in kind:0 (no advertisement, impostor-only
projection, and a valid projection replacing it).
- `cargo fmt` and `cargo clippy -p buzz-cli -D warnings` are clean.
- An earlier revision of the built CLI was run against a live community
with verified profiles: `--name <verified username>` found a user whose
kind:0 name differs, and `--pubkey` returned the expected `verified`
objects.

---------

Signed-off-by: damienrj <damien@squareup.com>
2026-11-18 22:02:21 -08:00
..