diff --git a/package.json b/package.json index 18de607..ba99631 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.19", + "version": "1.2.20", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/components/AmberApprovalHint.tsx b/src/components/AmberApprovalHint.tsx new file mode 100644 index 0000000..225f28f --- /dev/null +++ b/src/components/AmberApprovalHint.tsx @@ -0,0 +1,64 @@ +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 ( +
+
Messages are end-to-end encrypted using NIP-17
+ {/* A 1:1 NIP-17 DM encrypts + signs to the recipient AND to yourself + (so you keep a copy) = up to 4 signer approvals. Warn Amber users. */} +