import { KeyRound } from 'lucide-react'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useNostrLogin } from '@nostrify/react/login'; import { isInteractiveSigner } from '@/lib/signerCapabilities'; import { cn } from '@/lib/utils'; interface AmberApprovalHintProps { /** * How many separate signer approvals this action will require. When known and * > 1 it's shown to set expectations (e.g. an encrypted group message signs * once per recipient). Omit for a generic "may ask you to approve" note. */ approvals?: number; /** Short label for the action, e.g. "send this message". */ action?: string; className?: string; } /** * A tiny, honest heads-up shown ONLY to interactive-signer (Amber) users before * an action that is inherently multi-approval. * * Some flows are cryptographically obliged to hit the signer several times — a * NIP-17 DM seals + signs once per recipient (and once to self); an encrypted * crew message signs an author proof then encrypts once per member. With a * silent signer (extension / nsec / bunker) these are instant and invisible, so * there's nothing to warn about. With Amber, each op is a foreground Approve * screen, so without this the user sees Amber "pop up several times" for one * Send and reasonably assumes something is broken. * * We DON'T try to reduce the count (that would weaken the encryption/authorship * model) — we just tell the truth up front. Renders nothing for silent signers. */ export function AmberApprovalHint({ approvals, action = 'send', className }: AmberApprovalHintProps) { const { user } = useCurrentUser(); const { logins } = useNostrLogin(); if (!isInteractiveSigner(user, logins)) return null; const multi = typeof approvals === 'number' && approvals > 1; return (