aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/gifts-wallet.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-01 23:07:02 -0700
committerAdam Soltys <[email protected]>2026-08-01 23:07:02 -0700
commit83ad00a39863bb6a61e15977202fe2feea2ca696 (patch)
tree251325b582093cdcaf08ba52981ee9905e018e9c /src/features/gifts-wallet.js
parent88d93de66b9ba713c5cc1a8fc5b1528ea1d74fb8 (diff)
downloadcoinosv3-83ad00a39863bb6a61e15977202fe2feea2ca696.tar.gz
coinosv3-83ad00a39863bb6a61e15977202fe2feea2ca696.zip
Drop npub-locked gifts; collapse Nostr login behind a button
Gifts are plain bearer links again: the recipient-npub field, the one-time claim code, the DM delivery, the /lg/ claim route and the NIP-07 in-place decrypt are all gone, along with the crypto that only they used. Unclaimed gifts remain reclaimable by the sender, so nothing can be stranded by the removal. The unlock screen shows a single 'Sign in with Nostr' button that reveals the login options when tapped, instead of the full card competing with create/import. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features/gifts-wallet.js')
-rw-r--r--src/features/gifts-wallet.js18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/features/gifts-wallet.js b/src/features/gifts-wallet.js
index 96e4978..93ef268 100644
--- a/src/features/gifts-wallet.js
+++ b/src/features/gifts-wallet.js
@@ -6,7 +6,6 @@
import * as btc from '@scure/btc-signer';
import { hex, base64urlnopad, base32nopad } from '@scure/base';
import { utxoId } from '../wallet.js';
-import { encryptGiftPayload } from '../nostr.js';
import { p2wpkh } from '@scure/btc-signer/payment';
import { concatBytes } from '@noble/hashes/utils';
@@ -447,20 +446,3 @@ export function buildClaimTx(code, toAddress, feeRate, net) {
// public (anyone can see what it is and who it's for), but the claim payload (the
// gift code) is NIP-44-encrypted to the recipient via an ephemeral key — so the
// link can be shared openly yet only the recipient's nostr key can claim it.
-const LOCKED_GIFT_VERSION = 1;
-// Encrypt the gift's claim payload under a one-time code. The code is delivered
-// to the recipient via a nostr DM; the public link carries only the ciphertext.
-// Returns { blob (for the /lg/ link), claimCode (to DM) }.
-export function lockGift(code, amount, recipientPkHex) {
- const { code: claimCode, ctCode, eph, ctKey } = encryptGiftPayload(code, recipientPkHex);
- const blob = base64urlnopad.encode(new TextEncoder().encode(JSON.stringify({ v: LOCKED_GIFT_VERSION, amount, to: recipientPkHex, ct: ctCode, eph, ctKey })));
- return { blob, claimCode };
-}
-// The public fields of a locked-gift blob (or null). Decryption needs the code.
-export function previewLockedGift(blob) {
- try {
- const o = JSON.parse(new TextDecoder().decode(base64urlnopad.decode(blob)));
- if (o.v === LOCKED_GIFT_VERSION && typeof o.amount === 'number' && o.to && o.ct) return o;
- } catch {}
- return null;
-}