Files
buzz/mobile/pubspec.yaml
Tom Brow 985de41f14 feat(mobile): show NIP-FI verified names (#8858)
Stacked on #8700. Review only the last commit until #8700 merges.

NIP-FI relays can publish a relay-signed verified name for each member
who signs in with an organization assertion (kind 30382, specified in
#8745 and implemented in the relay in #8774). Desktop shows these names
in block/buzz-app#2005. Mobile showed only self-declared kind 0 names,
so a verified Block name looked no different from one anyone could set.

This adds verified names to mobile, following the spec and the desktop
client's validation rules.

**What people see**

- A verified member's name is the issuer-verified display name wherever
mobile resolves names through identity names (message headers, threads,
DM titles, member lists).
- Message headers and the profile sheet show a verification mark. The
profile sheet also shows the full name when present, "Verified by
{issuer}", "Last verified {time ago}", and marks the record as cached
when it hasn't been reconciled with the relay on this connection.
Verification is described as historical, never as current access.
- Nothing changes on relays that don't advertise
`federated_identity.public_profile`, and marks never come from kind 0 or
NIP-05.

**How it works**

- NIP-11 discovery decides whether marks may show: a successful response
without `public_profile` hides them (cached records are kept), and a
failed or malformed response keeps the last state. Discovery refreshes
on connect and every 5 minutes while names are tracked.
- Subjects are tracked as the profile cache resolves them, and fetched
in batches of up to 128 with `{kinds:[30382], authors:[self],
#d:[...]}`. Live updates and retractions apply on the same subscription.
A full batch that omits subjects is not treated as proof they have no
record.
- Each event's id and signature are verified (in an isolate) before use,
and it must be authored by the community's NIP-11 `self` key with
exactly the specified tags (plus the optional `full_name` the relay
emits). Names follow the spec's NFC and character rules; `unorm_dart`
(MIT, pure Dart) is added for the NFC check because Dart has no built-in
normalizer.
- The cache is per community and is cleared when the relay's `self` key
changes.

**Not yet covered**

- Some surfaces still read the kind 0 name directly: the members sheet
initial, and search and inbox rows. The mark isn't shown in search rows,
inbox rows, or member tiles. (The mention picker now matches, ranks and
inserts by the verified name and shows the mark, and it also offers
cached verified people outside the channel whose kind 0 name differs.)
- NIP-FI says clients MUST show `issuer_label` beside every verified
name. Here it appears only in the mark's tooltip and accessibility label
and in the profile sheet, and verified names reaching DM titles and
member lists show no mark or issuer. Follow-up: show the issuer inline
wherever a verified name is shown.
- Live updates are coalesced to the newest per subject before signature
proof, ordered by unverified `created_at`/`id`. Only a misbehaving relay
could exploit this (the subscription is `authors:[self]`), and it could
already withhold events. Follow-up: prove first, then coalesce among
valid events.
- The verified `username` isn't shown beside the name in message headers
(the NIP-05 handle still is).
- Collision qualification relies on the existing name-disambiguation
policy rather than the spec's exact self-declared-name rule.

### Validation

Added tests:

- Validation: discovery enabled, disabled and malformed; wrong author;
mismatched or duplicate `d`/`p`; extra or duplicate tags; invalid
usernames; non-NFC and whitespace-padded names; `verified_at` after
`created_at`; bad signatures; retractions.
- Directory: discovery gating, batching, truncation, live retraction,
reconnect reconciliation, and disable hiding cached records.
- Directory failures: a pre-EOSE flood, failed proof retried on refresh,
oversized events (by total size, id or signature) dropped before proof,
live events coalesced, a retry before or after the first EOSE never
proving absence, a retry during proof not promoting records to checked,
and a newer signed malformed projection clearing the older one.
- Mention picker: a verified name finds, ranks and inserts the verified
person; the self-declared name still finds them; a verified person
outside the channel is found by verified name even when an impostor
copies that name into kind 0.
- Identity names: a verified name outranks the kind 0 name.
- UI: the mark in message headers and the profile sheet details, no mark
for a cached record, and a single accessible label.

Full `mobile-check` and `mobile-test` pass.

**Live relay (checked 2026-11-01):** not yet run end to end.

- Staging now advertises the feature: the bb-block staging relay's
NIP-11 (`buzz.block.builderlabstaging.xyz`) has
`federated_identity.public_profile` with `kind: 30382` and
`multiple_issuers: false`, bound to `self` `f7f4df94…dcf1`. So #8774 is
deployed and enabled there. The other staging relays
(`communities.public.builderlabstaging.xyz` and its `team.` host)
advertise no `federated_identity`, and the client shows nothing on them.
- I couldn't confirm that real 30382 events are served or render them.
The relay requires NIP-42 auth plus a client-attached NIP-FI assertion,
which needs an interactive Builderlab/Okta sign-in on a physical device.
SSO doesn't work in the iOS simulator. The remaining step is a device
run signed in to the staging Block community, with screenshots of a
verified name, its mark and its details.

**Shipping behind discovery gating:** this is safe. The client reads and
shows verified names only when a successful NIP-11 discovery advertises
`public_profile` bound to `self`. It accepts only kind 30382 events
signed by that key that pass id and signature verification and strict
shape checks. On every relay without the feature, which is every relay
but bb-block staging today, it shows nothing new and changes no names. A
failed or malformed discovery never turns the feature on, and it marks
cached records as unchecked, which hides their mark. The subscription
and reconciliation paths are covered by the tests above, and Carl's
review reran retry probes through the real `RelaySessionNotifier`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-01 15:51:25 -08:00

101 lines
2.6 KiB
YAML

name: buzz
description: Buzz mobile client
publish_to: 'none'
version: 0.0.0+1
environment:
sdk: ^3.11.4
flutter: ">=3.47.7"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.8
# Grapheme-cluster segmentation, for deciding whether a message body is
# nothing but emoji. Already present transitively via the Flutter SDK;
# declared here because we import it directly.
characters: ^1.4.0
hooks_riverpod: ^3.0.3
flutter_hooks: ^0.21.3
http: ^1.4.0
crypto: ^3.0.7
flutter_secure_storage: ^10.0.0
flutter_svg: ^2.2.4
mobile_scanner: ^7.0.0
shared_preferences: ^2.5.5
web_socket_channel: ^3.0.1
connectivity_plus: ^7.0.0
nostr: ^2.0.0
buzz_secp256k1:
path: packages/buzz_secp256k1
pointycastle: ^4.0.0
url_launcher: ^6.3.2
gpt_markdown: ^1.2.1
highlight: ^0.7.0
intl: ^0.20.2
uuid: ^4.5.1
file_selector: ^1.1.0
camera: ^0.12.0+2
image_picker: ^1.1.2
image: ^4.8.0
google_mlkit_selfie_segmentation: ^0.11.0
photo_manager: ^3.11.0
video_player: ^2.10.1
just_audio: ^0.10.6
record: ^6.2.1
package_info_plus: ^10.0.0
app_badge_plus: ^1.2.10
app_links: ^6.4.0
scrollable_positioned_list: ^0.3.8
open_filex: ^4.7.0
path_provider: ^2.1.6
share_plus: ^13.3.0
local_auth: ^3.0.2
unorm_dart: ^0.3.3
dev_dependencies:
leak_tracker: ^11.0.2
shared_preferences_platform_interface: ^2.4.2
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
fake_async: ^1.3.3
camera_platform_interface: ^2.13.1
custom_lint: ^0.8.0
riverpod_lint: ^3.1.0
mocktail: ^1.0.4
# Test-only platform interface fakes (depend_on_referenced_packages).
path_provider_platform_interface: ^2.1.2
plugin_platform_interface: ^2.1.8
video_player_platform_interface: ^6.6.0
flutter:
config:
enable-swift-package-manager: false
uses-material-design: true
shaders:
- shaders/toast_island.frag
- shaders/onboarding_wordmark.frag
assets:
- assets/images/welcome-bee.svg
- assets/images/buzz-icon.png
- assets/images/shell-gradient.png
- assets/images/buzz-wordmark.png
# Generated by `just mobile-emoji-data` from the same emoji-mart dataset
# desktop uses. Do not hand-edit.
- assets/emoji/emoji-data.json
fonts:
- family: BuzzTabler
fonts:
- asset: assets/fonts/TablerIcons.ttf
- family: Inter
fonts:
- asset: assets/fonts/InterVariable.ttf
- asset: assets/fonts/InterVariable-Italic.ttf
style: italic
- family: GeistMono
fonts:
- asset: assets/fonts/GeistMono-Variable.ttf
- asset: assets/fonts/GeistMono-Italic-Variable.ttf
style: italic