aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-28 00:39:51 -0700
committerAdam Soltys <[email protected]>2026-10-28 00:39:51 -0700
commit3c4b0c5000c32ffab68a734959a34b2f97de1f06 (patch)
treea5037971c1098f7a35e53ed925109c73e2213ebb /src/features/messages.js
parent2302a4f0e25562c4d4977990918b86d4c6baba27 (diff)
downloadcoinosv3-3c4b0c5000c32ffab68a734959a34b2f97de1f06.tar.gz
coinosv3-3c4b0c5000c32ffab68a734959a34b2f97de1f06.zip
A gift link names its sender: the link carries the sender's nostr key, signed over the gift's code (#f=…, beside the note), so the claim screen shows "From <name>" and claiming follows them. A signature that doesn't match the code names nobody, so a link can't be passed on as someone else's gift. "Show it's from me" is ticked by default when making a gift, and unticking it is remembered; the gift's record keeps the sender, so View and Copy link again keep it too
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 6c6b48d..76d8c4f 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -18457,6 +18457,21 @@ export function messagesFeature(ctx) {
}, avatar(pk, 'chat-avatar ' + (big ? 'send-avatar' : 'mini'), false),
h('span', { class: big ? '' : 'small' }, displayName(pk)));
},
+ // a gift link names its sender: sign its template as us (gifts.js)
+ async signGiftFrom(tmpl) {
+ const id = await identity();
+ if (!id) return null;
+ return id.signer instanceof Uint8Array ? finalizeEvent(tmpl, id.signer) : id.signer.signEvent(tmpl);
+ },
+ // A claimed gift's sender: follow them, once any follow publish in
+ // flight (a fresh wallet's starter follows) has landed — followMany
+ // drops a call that arrives mid-publish.
+ async followGiftSender(pk) {
+ for (let i = 0; followsPub && i < 60; i++) await new Promise((r) => setTimeout(r, 500));
+ if (!(await identity())) return false;
+ await followMany([pk]).catch(() => {});
+ return true;
+ },
// A sign-in (Google, passkey, key) that found no wallet on its identity:
// the same start, but only the follows of an identity that follows
// nobody yet — an established nostr user keeps their own list.