import { useQuery } from '@tanstack/react-query'; import { verifyNip05, type Nip05Result } from '@/lib/nip05'; export type { Nip05Status } from '@/lib/nip05'; /** * Verify a crew's optional NIP-05 identifier against its founder pubkey. * * The crew profile is authored by the founder, so a NIP-05 is legitimate only if * the domain's `.well-known/nostr.json` maps the name to that same founder key. * This works with ANY domain the crew controls (fully decentralized) — SkateSpots * does not gatekeep the handle. */ export function useCrewNip05(nip05: string | undefined, founderPubkey: string | undefined) { return useQuery({ queryKey: ['crew-nip05', nip05, founderPubkey], queryFn: (c) => { const signal = AbortSignal.any([c.signal, AbortSignal.timeout(6000)]); return verifyNip05(nip05, founderPubkey, signal); }, enabled: !!nip05 && !!founderPubkey, staleTime: 10 * 60 * 1000, // 10 min gcTime: 30 * 60 * 1000, retry: 1, }); }