From 68df42f2539de30423d2e6f0575583d4cecf2249 Mon Sep 17 00:00:00 2001 From: Tincho Date: Tue, 2 Jun 2026 14:30:20 -0300 Subject: [PATCH] feat(nostr): migrate opportunity notifications to NIP-17 --- .../nostr-opportunity-notification/route.ts | 20 ++++++------------- components/sections/NewsletterCTA.tsx | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/api/nostr-opportunity-notification/route.ts b/app/api/nostr-opportunity-notification/route.ts index 5ca4fed..d779204 100644 --- a/app/api/nostr-opportunity-notification/route.ts +++ b/app/api/nostr-opportunity-notification/route.ts @@ -37,8 +37,8 @@ export async function POST(req: Request) { try { const secret = await getBackendSecret(); - const { finalizeEvent, getPublicKey } = await import("nostr-tools/pure"); - const { encrypt } = await import("nostr-tools/nip04"); + const { getPublicKey } = await import("nostr-tools/pure"); + const { wrapEvent } = await import("nostr-tools/nip17"); const senderPubkey = getPublicKey(secret); const handle = body.handle?.trim(); const message = [ @@ -48,19 +48,11 @@ export async function POST(req: Request) { ] .filter(Boolean) .join("\n\n"); - const content = encrypt(secret, recipientPubkey, message); - const event = finalizeEvent( - { - kind: 4, - created_at: Math.floor(Date.now() / 1000), - tags: [ - ["p", recipientPubkey], - ["t", "lacrypta-dev"], - ["t", "opportunities"], - ], - content, - }, + const event = wrapEvent( secret, + { publicKey: recipientPubkey }, + message, + "La Crypta Dev opportunities", ); return NextResponse.json({ event, senderPubkey }); diff --git a/components/sections/NewsletterCTA.tsx b/components/sections/NewsletterCTA.tsx index d1015b0..0ac1b8a 100644 --- a/components/sections/NewsletterCTA.tsx +++ b/components/sections/NewsletterCTA.tsx @@ -491,7 +491,7 @@ function ProfilePreview({

- Notificación NIP-04 + Notificación NIP-17

Firmada por La Crypta y publicada desde tu navegador.