SkateSpots/src/components/CrewNip05Badge.tsx
SkateSpots 127819e3da feat(nip05): multiple handles for profiles, crews and shops
A NIP-05 name maps to one key, so "who owns it" decides where it lives:
- Crew: repeatable nip05 tags (up to 5), verified against the founder key.
- Shop: same on kind 30017, verified against the owner key (new field).
- Profile: kind-0 has ONE standard nip05; extra personal handles live in a
  separate NIP-78 record (kind 30078, d=skatespots:profile-handles) so another
  client re-saving the profile can't wipe them.

Shared pieces:
- components/Nip05Badges.tsx — generic verify-and-render chip row (any owner).
- components/Nip05HandlesEditor.tsx — shared add/remove editor with live
  verified/mismatch status; used by profile, crew and shop forms.
- CrewNip05Badge now delegates to Nip05Badges; CrewForm uses the shared editor.
- Profile page shows primary + extra handles, and each crew/shop chips its own
  verified handle.
- lib/profileHandles.ts + hooks/useProfileHandles.ts (read/publish the record).
- types: SkateShop gains nip05/nip05s; parseSkateShop parses repeatable nip05s.
- NIP.md + AGENTS.md + i18n (EN/ES) updated.
2026-10-03 17:26:59 +07:00

20 lines
810 B
TypeScript

import { Nip05Badges } from '@/components/Nip05Badges';
interface CrewNip05BadgeProps {
/** A single handle (back-compat). */
nip05?: string;
/** All crew handles. Takes precedence over `nip05` when present. */
nip05s?: string[];
founderPubkey?: string;
className?: string;
}
/**
* Verified handle badge(s) for a crew's optional NIP-05. A crew may carry several
* handles (our own tag convention — unlike the single kind-0 `nip05`), each
* verified against the founder key. Thin wrapper over the shared `Nip05Badges`.
*/
export function CrewNip05Badge({ nip05, nip05s, founderPubkey, className }: CrewNip05BadgeProps) {
const handles = nip05s && nip05s.length > 0 ? nip05s : nip05 ? [nip05] : [];
return <Nip05Badges handles={handles} pubkey={founderPubkey} className={className} />;
}