lnurlcash-kit 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 - 2026-09-11
4
+
5
+ **A Part 2 branch rooted in a Nostr key.**
6
+
7
+ - `deriveNostrCashSeed(secretKey)` and `deriveNostrAddressNode(secretKey,
8
+ host)`: a Part 2 address branch rooted in a Nostr identity key, for a holder
9
+ with no BIP-39 words. The seed is `HMAC-SHA256(key, "LNURLcash/nostr-seed")`
10
+ and the path from it is the reference wallet's. heartwood-esp32 derives the
11
+ same branch on the device, and `test/vectors/nostr-seed.json` is the file
12
+ both grade against.
13
+ - `deriveCashMaster(seed)`: the BIP-32 master node, exported beside
14
+ `deriveCashChild` for walking a path the kit does not name, such as
15
+ nsec-tree's `m/44'/1237'/727'/0'/0'`.
16
+
3
17
  ## 0.11.0 - 2026-09-11
4
18
 
5
19
  **The wire calls take LUD-25 Part 2 notes.**
package/README.md CHANGED
@@ -425,6 +425,16 @@ Three things worth knowing:
425
425
  `test/vectors/part2.json` was generated from lnurl-wallet and checked against
426
426
  lnurl-mint. It moves into lnurlcash-conformance next.
427
427
 
428
+ **A branch rooted in a Nostr key.** A holder with no BIP-39 words, such as a
429
+ hardware signer that keeps only its identity key, or a wallet that never made
430
+ any, can still be paid to keys of its own. `deriveNostrAddressNode(secretKey,
431
+ host)` takes the branch from the key that owns the lightning address:
432
+ `HMAC-SHA256(key = secret key, msg = "LNURLcash/nostr-seed")`, then the path
433
+ above unchanged. heartwood-esp32 derives exactly this on the device, graded
434
+ against the same `test/vectors/nostr-seed.json`, so its notes come back from
435
+ its nsec (or the phrase the nsec came from) without the device. This is ours,
436
+ not LUD-25's; a mint sees an ordinary `cx1` either way.
437
+
428
438
  ## Minting a note you named yourself
429
439
 
430
440
  By default the secret of a freshly minted note is the invoice's payment
package/dist/index.d.ts CHANGED
@@ -262,6 +262,7 @@ type CashNode = {
262
262
  chainCode: Uint8Array;
263
263
  };
264
264
  declare const deriveCashChild: (node: CashNode, index: number) => CashNode;
265
+ declare const deriveCashMaster: (seed: Uint8Array) => CashNode;
265
266
  declare const deriveCashRoot: (seed: Uint8Array) => CashNode;
266
267
  declare const cashDomainIndices: (root: CashNode, host: string) => number[];
267
268
  declare const deriveCashDomainNode: (root: CashNode, host: string) => CashNode;
@@ -297,6 +298,9 @@ declare const noteIdOf: (k1: string) => string | null;
297
298
  declare const noteLookupOf: (k1: string) => string | null;
298
299
  declare const deriveCashAddressNode: (root: CashNode, host: string) => CashNode;
299
300
  declare const cashNodeToCx1: (node: CashNode) => Cx1;
301
+ declare const NOSTR_CASH_SEED_LABEL = "LNURLcash/nostr-seed";
302
+ declare const deriveNostrCashSeed: (secretKey: Uint8Array) => Uint8Array;
303
+ declare const deriveNostrAddressNode: (secretKey: Uint8Array, host: string) => CashNode;
300
304
 
301
305
  declare const PAYMENT_REQUEST_PREFIX = "lnurlcashreq1";
302
306
  type PaymentRequestMethodDetails = {
@@ -405,4 +409,4 @@ declare const createClient: (options?: LnurlcashOptions) => {
405
409
  };
406
410
  type LnurlcashClient = ReturnType<typeof createClient>;
407
411
 
408
- export { AmbiguousMintError, AmbiguousMutationError, type BoundMintCommitment, type CashNode, type Cx1, type DecodeOptions, HashLookupUnsupportedError, type HashedMutationResult, type HashedSplitResult, InsufficientValueError, type InvoiceRequestOptions, type InvoiceResult, type LnurlcashClient, LnurlcashError, type LnurlcashOptions, type MeltResult, type MintAddressInfo, type MintClaim, type MintContact, type MintFee, type MintFeeBand, type NoteInfoByHash, type NoteScheme, NoteSpentError, NoteUnknownError, PAYMENT_REQUEST_PREFIX, type PayRequestInfo, type PaymentRequest, type PaymentRequestMethodDetails, PendingNoteError, ProtocolError, type RandomSecret, RequestRefusedError, type RestoreOptions, type RestoreResult, type RestoredNote, type RotateResult, type SeedRestoreOptions, type SeedRestoreResult, ServiceRejectedError, type SettleForValueOptions, type SettledForValue, type SettledNote, type SignatureCheck, type SplitResult, type UnresolvedIndex, UnverifiableNoteError, type ValidatedBoundMintReceipt, type VerifyResult, type WithdrawRequestInfo, type WithdrawSuccessResponse, applyMintFee, buildNoteInfoUrlByHash, buildNoteUrl, cashDomainIndices, cashNodeFromHex, cashNodeToCx1, cashNodeToHex, cashSecretAt, cashSecretSource, claimMintedNote, classifyNoteError, createClient, decodeBolt11AmountMsat, decodeCk1, decodeCp1, decodeCs1, decodeCx1, decodePaymentRequest, defaultRandomSecret, deriveCashAddressNode, deriveCashChild, deriveCashDomainNode, deriveCashRoot, deriveCashSecret, deriveNotePubkey, deriveNoteRoot, deriveNoteSecret, deriveNoteSecretKey, derivedSecretSource, describeMintFee, encodeCk1, encodeCp1, encodeCs1, encodeCx1, encodePaymentRequest, fetchInvoiceVerification, fetchMintAddress, fetchNoteInfo, fetchNoteInfoByHash, fetchPayRequest, formatFeePercent, fromBech32Lnurl, fromLud17, grossUpForMintFee, hashK1, isAllowedServiceUrl, isBech32Lnurl, isBolt11Invoice, isCk1, isCp1, isCs1, isCx1, isLightningAddress, isPaymentRequest, isPreimage, isValidNoteInput, lightningAddressUsername, meltNote, mergeBatches, mergeNotes, mergeNotesWithHash, mintAddressUrl, mintFeeBand, namesMintOutput, newSecretsOf, noteDeclaredAmount, noteIdOf, noteK1, noteLookupOf, noteSignature, noteSignatureDigest, noteSignatureDigestForHash, noteSignatureMessage, noteSignatureMessageForHash, parseMintFee, paymentRequestAmountMsat, probeBurnedNote, recoverNoteOwnershipPubkey, requestInvoice, requireBoundMintQuote, requireNoteK1, resolveLnurlInput, resolveMintInput, resolveNoteInput, restoreFromSeed, restoreNotes, rotateNote, rotateNoteWithHash, sameInvoice, serverOf, settleNote, settleNoteForValue, signNoteOwnership, splitNote, splitNoteWithHash, toBech32Lnurl, toLud17w, validateBoundMintReceipt, verifyNoteSignature, verifyNoteSignatureAgainst, verifyNoteSignatureHash, verifyNoteSignatureHashAgainst, withNewK1, withinMintFeeBand, withoutK1 };
412
+ export { AmbiguousMintError, AmbiguousMutationError, type BoundMintCommitment, type CashNode, type Cx1, type DecodeOptions, HashLookupUnsupportedError, type HashedMutationResult, type HashedSplitResult, InsufficientValueError, type InvoiceRequestOptions, type InvoiceResult, type LnurlcashClient, LnurlcashError, type LnurlcashOptions, type MeltResult, type MintAddressInfo, type MintClaim, type MintContact, type MintFee, type MintFeeBand, NOSTR_CASH_SEED_LABEL, type NoteInfoByHash, type NoteScheme, NoteSpentError, NoteUnknownError, PAYMENT_REQUEST_PREFIX, type PayRequestInfo, type PaymentRequest, type PaymentRequestMethodDetails, PendingNoteError, ProtocolError, type RandomSecret, RequestRefusedError, type RestoreOptions, type RestoreResult, type RestoredNote, type RotateResult, type SeedRestoreOptions, type SeedRestoreResult, ServiceRejectedError, type SettleForValueOptions, type SettledForValue, type SettledNote, type SignatureCheck, type SplitResult, type UnresolvedIndex, UnverifiableNoteError, type ValidatedBoundMintReceipt, type VerifyResult, type WithdrawRequestInfo, type WithdrawSuccessResponse, applyMintFee, buildNoteInfoUrlByHash, buildNoteUrl, cashDomainIndices, cashNodeFromHex, cashNodeToCx1, cashNodeToHex, cashSecretAt, cashSecretSource, claimMintedNote, classifyNoteError, createClient, decodeBolt11AmountMsat, decodeCk1, decodeCp1, decodeCs1, decodeCx1, decodePaymentRequest, defaultRandomSecret, deriveCashAddressNode, deriveCashChild, deriveCashDomainNode, deriveCashMaster, deriveCashRoot, deriveCashSecret, deriveNostrAddressNode, deriveNostrCashSeed, deriveNotePubkey, deriveNoteRoot, deriveNoteSecret, deriveNoteSecretKey, derivedSecretSource, describeMintFee, encodeCk1, encodeCp1, encodeCs1, encodeCx1, encodePaymentRequest, fetchInvoiceVerification, fetchMintAddress, fetchNoteInfo, fetchNoteInfoByHash, fetchPayRequest, formatFeePercent, fromBech32Lnurl, fromLud17, grossUpForMintFee, hashK1, isAllowedServiceUrl, isBech32Lnurl, isBolt11Invoice, isCk1, isCp1, isCs1, isCx1, isLightningAddress, isPaymentRequest, isPreimage, isValidNoteInput, lightningAddressUsername, meltNote, mergeBatches, mergeNotes, mergeNotesWithHash, mintAddressUrl, mintFeeBand, namesMintOutput, newSecretsOf, noteDeclaredAmount, noteIdOf, noteK1, noteLookupOf, noteSignature, noteSignatureDigest, noteSignatureDigestForHash, noteSignatureMessage, noteSignatureMessageForHash, parseMintFee, paymentRequestAmountMsat, probeBurnedNote, recoverNoteOwnershipPubkey, requestInvoice, requireBoundMintQuote, requireNoteK1, resolveLnurlInput, resolveMintInput, resolveNoteInput, restoreFromSeed, restoreNotes, rotateNote, rotateNoteWithHash, sameInvoice, serverOf, settleNote, settleNoteForValue, signNoteOwnership, splitNote, splitNoteWithHash, toBech32Lnurl, toLud17w, validateBoundMintReceipt, verifyNoteSignature, verifyNoteSignatureAgainst, verifyNoteSignatureHash, verifyNoteSignatureHashAgainst, withNewK1, withinMintFeeBand, withoutK1 };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { bech32, base64urlnopad, bech32m } from '@scure/base';
2
2
  import { secp256k1 } from '@noble/curves/secp256k1.js';
3
+ import { hmac } from '@noble/hashes/hmac.js';
3
4
  import { sha256, sha512 } from '@noble/hashes/sha2.js';
4
5
  import { utf8ToBytes, bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
5
- import { hmac } from '@noble/hashes/hmac.js';
6
6
 
7
7
  // src/urls.ts
8
8
  var isBech32Lnurl = (data) => data.trim().toUpperCase().startsWith("LNURL1");
@@ -154,6 +154,7 @@ var deriveCashChild = (node, index) => {
154
154
  }
155
155
  return { privateKey: to32Bytes(key), chainCode: material.slice(32) };
156
156
  };
157
+ var deriveCashMaster = (seed) => masterFrom(seed);
157
158
  var masterFrom = (seed) => {
158
159
  if (seed.length < 16 || seed.length > 64) {
159
160
  throw new RangeError(
@@ -346,6 +347,14 @@ var cashNodeToCx1 = (node) => ({
346
347
  pubkeyXOnly: secp256k1.getPublicKey(node.privateKey, true).slice(1),
347
348
  chainCode: node.chainCode.slice()
348
349
  });
350
+ var NOSTR_CASH_SEED_LABEL = "LNURLcash/nostr-seed";
351
+ var deriveNostrCashSeed = (secretKey) => {
352
+ if (!(secretKey instanceof Uint8Array) || secretKey.length !== 32) {
353
+ throw new RangeError("A Nostr secret key is 32 bytes.");
354
+ }
355
+ return hmac(sha256, secretKey, utf8ToBytes(NOSTR_CASH_SEED_LABEL));
356
+ };
357
+ var deriveNostrAddressNode = (secretKey, host) => deriveCashAddressNode(deriveCashRoot(deriveNostrCashSeed(secretKey)), host);
349
358
 
350
359
  // src/note.ts
351
360
  var noteK1 = (url) => {
@@ -1738,4 +1747,4 @@ var createClient = (options = {}) => ({
1738
1747
  settleNoteForValue: (noteUrl, terms) => settleNoteForValue(noteUrl, terms, options)
1739
1748
  });
1740
1749
 
1741
- export { AmbiguousMintError, AmbiguousMutationError, HashLookupUnsupportedError, InsufficientValueError, LnurlcashError, NoteSpentError, NoteUnknownError, PAYMENT_REQUEST_PREFIX, PendingNoteError, ProtocolError, RequestRefusedError, ServiceRejectedError, UnverifiableNoteError, applyMintFee, buildNoteInfoUrlByHash, buildNoteUrl, cashDomainIndices, cashNodeFromHex, cashNodeToCx1, cashNodeToHex, cashSecretAt, cashSecretSource, claimMintedNote, classifyNoteError, createClient, decodeBolt11AmountMsat, decodeCk1, decodeCp1, decodeCs1, decodeCx1, decodePaymentRequest, defaultRandomSecret, deriveCashAddressNode, deriveCashChild, deriveCashDomainNode, deriveCashRoot, deriveCashSecret, deriveNotePubkey, deriveNoteRoot, deriveNoteSecret, deriveNoteSecretKey, derivedSecretSource, describeMintFee, encodeCk1, encodeCp1, encodeCs1, encodeCx1, encodePaymentRequest, fetchInvoiceVerification, fetchMintAddress, fetchNoteInfo, fetchNoteInfoByHash, fetchPayRequest, formatFeePercent, fromBech32Lnurl, fromLud17, grossUpForMintFee, hashK1, isAllowedServiceUrl, isBech32Lnurl, isBolt11Invoice, isCk1, isCp1, isCs1, isCx1, isLightningAddress, isPaymentRequest, isPreimage, isValidNoteInput, lightningAddressUsername, meltNote, mergeBatches, mergeNotes, mergeNotesWithHash, mintAddressUrl, mintFeeBand, namesMintOutput, newSecretsOf, noteDeclaredAmount, noteIdOf, noteK1, noteLookupOf, noteSignature, noteSignatureDigest, noteSignatureDigestForHash, noteSignatureMessage, noteSignatureMessageForHash, parseMintFee, paymentRequestAmountMsat, probeBurnedNote, recoverNoteOwnershipPubkey, requestInvoice, requireBoundMintQuote, requireNoteK1, resolveLnurlInput, resolveMintInput, resolveNoteInput, restoreFromSeed, restoreNotes, rotateNote, rotateNoteWithHash, sameInvoice, serverOf, settleNote, settleNoteForValue, signNoteOwnership, splitNote, splitNoteWithHash, toBech32Lnurl, toLud17w, validateBoundMintReceipt, verifyNoteSignature, verifyNoteSignatureAgainst, verifyNoteSignatureHash, verifyNoteSignatureHashAgainst, withNewK1, withinMintFeeBand, withoutK1 };
1750
+ export { AmbiguousMintError, AmbiguousMutationError, HashLookupUnsupportedError, InsufficientValueError, LnurlcashError, NOSTR_CASH_SEED_LABEL, NoteSpentError, NoteUnknownError, PAYMENT_REQUEST_PREFIX, PendingNoteError, ProtocolError, RequestRefusedError, ServiceRejectedError, UnverifiableNoteError, applyMintFee, buildNoteInfoUrlByHash, buildNoteUrl, cashDomainIndices, cashNodeFromHex, cashNodeToCx1, cashNodeToHex, cashSecretAt, cashSecretSource, claimMintedNote, classifyNoteError, createClient, decodeBolt11AmountMsat, decodeCk1, decodeCp1, decodeCs1, decodeCx1, decodePaymentRequest, defaultRandomSecret, deriveCashAddressNode, deriveCashChild, deriveCashDomainNode, deriveCashMaster, deriveCashRoot, deriveCashSecret, deriveNostrAddressNode, deriveNostrCashSeed, deriveNotePubkey, deriveNoteRoot, deriveNoteSecret, deriveNoteSecretKey, derivedSecretSource, describeMintFee, encodeCk1, encodeCp1, encodeCs1, encodeCx1, encodePaymentRequest, fetchInvoiceVerification, fetchMintAddress, fetchNoteInfo, fetchNoteInfoByHash, fetchPayRequest, formatFeePercent, fromBech32Lnurl, fromLud17, grossUpForMintFee, hashK1, isAllowedServiceUrl, isBech32Lnurl, isBolt11Invoice, isCk1, isCp1, isCs1, isCx1, isLightningAddress, isPaymentRequest, isPreimage, isValidNoteInput, lightningAddressUsername, meltNote, mergeBatches, mergeNotes, mergeNotesWithHash, mintAddressUrl, mintFeeBand, namesMintOutput, newSecretsOf, noteDeclaredAmount, noteIdOf, noteK1, noteLookupOf, noteSignature, noteSignatureDigest, noteSignatureDigestForHash, noteSignatureMessage, noteSignatureMessageForHash, parseMintFee, paymentRequestAmountMsat, probeBurnedNote, recoverNoteOwnershipPubkey, requestInvoice, requireBoundMintQuote, requireNoteK1, resolveLnurlInput, resolveMintInput, resolveNoteInput, restoreFromSeed, restoreNotes, rotateNote, rotateNoteWithHash, sameInvoice, serverOf, settleNote, settleNoteForValue, signNoteOwnership, splitNote, splitNoteWithHash, toBech32Lnurl, toLud17w, validateBoundMintReceipt, verifyNoteSignature, verifyNoteSignatureAgainst, verifyNoteSignatureHash, verifyNoteSignatureHashAgainst, withNewK1, withinMintFeeBand, withoutK1 };
package/llms.txt CHANGED
@@ -64,6 +64,10 @@ deriveNoteSecretKey(p, chainCode, i) -> sk negates p first when P has odd y
64
64
  signNoteOwnership(sk) -> 65 bytes RFC6979 over fixed "LNURLcash"
65
65
  recoverNoteOwnershipPubkey(sig) -> pk | null
66
66
  verifyNoteSignature also takes a ck1 as k1 and a cs1 as the signature
67
+ deriveCashMaster(seed) -> CashNode the BIP-32 master, for walking a path the kit does not name
68
+ deriveNostrCashSeed(secretKey) -> 32-byte seed HMAC-SHA256(key, "LNURLcash/nostr-seed")
69
+ deriveNostrAddressNode(secretKey, host) -> CashNode the address path from that seed;
70
+ a branch for a holder with no BIP-39 words (heartwood-esp32 derives the same)
67
71
  noteIdOf(k1) -> id | null sha256(k1) for a secret, the recovered key for a
68
72
  ck1. One note has many valid ck1 strings: compare notes by this, not by k1
69
73
  noteLookupOf(k1) -> string hash, or cp1 for a ck1; for fetchNoteInfoByHash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lnurlcash-kit",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "LNURLcash (LUD-25) bearer note client for TypeScript - mint, rotate, split, merge, melt, and verify offline",
5
5
  "author": "TheCryptoDonkey",
6
6
  "license": "MIT",