From 17be8730f55e4908f6e921be7224ab699ef14de9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 9 Jul 2026 12:26:03 -0500 Subject: [PATCH] Skip redundant Schnorr verify on gift-wrap ingest The outer signature on a NIP-59 gift-wrap (1059/21059) is cryptographically meaningless to the client: wraps are signed by a single-use ephemeral key (direct invites) or, in Concord V2, by a group-shared derived stream key any member can sign with, so the outer sig establishes no sender identity. Authenticity comes from NIP-44 authenticated encryption plus the inner seal signature check and rumor-pubkey/id bindings in the decrypt path. Pass a kind-scoped verifyEvent to NRelay1 that skips the Schnorr verify for wrap kinds only while keeping full verification for every other kind, whose identity does rest on its outer signature. --- src/components/NostrProvider.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/NostrProvider.tsx b/src/components/NostrProvider.tsx index b057cf7..32b8a43 100644 --- a/src/components/NostrProvider.tsx +++ b/src/components/NostrProvider.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { type NostrSigner, NostrEvent, NostrFilter, NPool, NRelay1 } from '@nostrify/nostrify'; +import { verifyEvent } from 'nostr-tools'; import { NostrContext } from '@nostrify/react'; import { NUser, useNostrLogin } from '@nostrify/react/login'; import { useQueryClient } from '@tanstack/react-query'; @@ -34,6 +35,13 @@ const NostrProvider: React.FC = (props) => { const [pool] = useState(() => new NPool({ open(url: string) { return new NRelay1(url, { + // Gift-wrap (1059/21059) outer signatures are redundant on the client + // skip them, verify everything else. + verifyEvent: (event: NostrEvent): boolean => { + if (event.kind === 1059 || event.kind === 21059) return true; + return verifyEvent(event); + }, + // NIP-42: Respond to relay AUTH challenges by signing a kind // 22242 ephemeral event with the current user's signer. auth: async (challenge: string) => {