@forgesworn/moneyer 0.13.0 → 0.13.2

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.2 - 2026-09-11
4
+
5
+ - An operator name that changes owner drops the branch the previous owner
6
+ set. `MONEYER_ZAP_NAMES` re-points a name at every startup, and until now
7
+ the old owner's `cx1` survived it, so the name went on paying the previous
8
+ owner's keys. The same owner keeps their branch and its index across a
9
+ restart, as before.
10
+
11
+ ## 0.13.1 - 2026-09-11
12
+
13
+ - A name's owner can set or clear its `cx1` while self-service registration
14
+ is closed. Closing registration stops new names; it no longer stops the
15
+ owner of an existing one, an operator name included, from choosing where
16
+ it pays. A request for a new name still gets the same 404.
17
+
3
18
  ## 0.13.0 - 2026-09-11
4
19
 
5
20
  - **Names that pay to the holder's own keys.** `POST /names` takes a `cx1`,
package/README.md CHANGED
@@ -561,6 +561,9 @@ and spends with its own `ck1`. A wallet that only knows note URLs sees no
561
561
  branch.
562
562
 
563
563
  `"cx1": null` clears the branch and puts the name back on the custodial path.
564
+ This works while registration is closed too: closing it stops new names, not
565
+ the owner of one choosing where it pays, including a name the operator set up
566
+ in `MONEYER_ZAP_NAMES`.
564
567
  Sending a new branch starts it at index 0; sending the same one again keeps
565
568
  its place. Zap receipts are unchanged.
566
569
 
package/dist/names.js CHANGED
@@ -94,8 +94,6 @@ export const isRefusal = (result) => 'reason' in result;
94
94
  // the same name at once.
95
95
  export const registerName = (args) => {
96
96
  const { store, pubkey, priceMsat } = args;
97
- if (priceMsat === undefined)
98
- return refuse('This mint is not registering names.', 404);
99
97
  const raw = typeof args.body.name === 'string' ? args.body.name.trim().toLowerCase() : '';
100
98
  if (!NAME_RULE.test(raw)) {
101
99
  return refuse('A name is 3 to 32 characters of a-z, 0-9, dot, dash or underscore, starting with a letter or digit.', 400);
@@ -124,6 +122,10 @@ export const registerName = (args) => {
124
122
  }
125
123
  return refuse('That name is taken.', 409);
126
124
  }
125
+ // Checked after the owner's update above: closing registration stops new
126
+ // names, not a holder choosing where their own name pays.
127
+ if (priceMsat === undefined)
128
+ return refuse('This mint is not registering names.', 404);
127
129
  let paidMsat = 0;
128
130
  let noteId;
129
131
  if (priceMsat === 0) {
package/dist/server.js CHANGED
@@ -449,7 +449,10 @@ export const createMoneyer = async (config, deps = {}) => {
449
449
  // a POST because it creates something, and it is authenticated by
450
450
  // NIP-98 rather than by anything this mint has to store.
451
451
  if (requestUrl.pathname === '/names' && req.method === 'POST') {
452
- if (config.namePriceMsat === undefined)
452
+ // Closed registration still lets a name's owner set where it pays;
453
+ // registerName refuses a new name there. Without zaps there are no
454
+ // names at all.
455
+ if (!zap)
453
456
  return fail('This mint is not registering names.', 404);
454
457
  const body = await readBody(req);
455
458
  if (body === null)
package/dist/store.js CHANGED
@@ -531,10 +531,18 @@ export class NoteStore {
531
531
  // The operator's own names, re-applied at every startup. Idempotent, and
532
532
  // the environment wins: it is the operator's mint, and a name they put
533
533
  // in the environment is one they mean to have.
534
+ //
535
+ // A branch the owner set survives a restart, but not a change of owner:
536
+ // it is the previous owner's keys, and keeping it would go on paying the
537
+ // name to someone the operator just took it from.
534
538
  putOperatorZapName(name, pubkey) {
535
539
  this.db
536
540
  .prepare(`INSERT INTO zap_names (name, pubkey, created_at, paid_msat, source) VALUES (?, ?, ?, 0, 'env')
537
- ON CONFLICT(name) DO UPDATE SET pubkey = excluded.pubkey, source = 'env'`)
541
+ ON CONFLICT(name) DO UPDATE SET
542
+ cx1 = CASE WHEN zap_names.pubkey = excluded.pubkey THEN zap_names.cx1 ELSE NULL END,
543
+ next_index = CASE WHEN zap_names.pubkey = excluded.pubkey THEN zap_names.next_index ELSE 0 END,
544
+ pubkey = excluded.pubkey,
545
+ source = 'env'`)
538
546
  .run(name.toLowerCase(), pubkey, Date.now());
539
547
  }
540
548
  // A self-service registration: burn the note that paid for the name and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgesworn/moneyer",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "An LNURLcash (LUD-25) mint - strikes Lightning bearer notes. Independent implementation, cln/lnd funding sources, SQLite, zero HTTP framework.",
5
5
  "author": "TheCryptoDonkey",
6
6
  "license": "MIT",