aboutsummaryrefslogtreecommitdiffstats
path: root/tools/registry-ownership-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-18 23:12:18 -0700
committerAdam Soltys <[email protected]>2026-09-18 23:12:18 -0700
commit703ee6e1281e72ec00f65768d7de7a015c242abb (patch)
tree8a643d0f1ad6d6e49db210aec45341a7b119e5ab /tools/registry-ownership-test.js
parent9e0f9528cd6726836386658c4f38ba8a42bea3ac (diff)
downloadcoinosv3-703ee6e1281e72ec00f65768d7de7a015c242abb.tar.gz
coinosv3-703ee6e1281e72ec00f65768d7de7a015c242abb.zip
Accounts from the header, snapshot-first Spending restore, name ownership grants.
Header buttons always leave the current feature screen; an account with no remembered nostr identity opens Accounts instead of nothing. Logout confirms in place. A scan finishing after logout or an account switch no longer drops the new session into offline mode (stateGeneration guards in sync + ark). Spending restores from the snapshot first. A migration grant names the identity that owns an address; its manager may register it without becoming that identity (names/ownership.js). Browser tests for account access, profile retry, spending restore, thread reply focus, custom-emoji reactions and registry ownership. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'tools/registry-ownership-test.js')
-rw-r--r--tools/registry-ownership-test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/registry-ownership-test.js b/tools/registry-ownership-test.js
new file mode 100644
index 0000000..43683a1
--- /dev/null
+++ b/tools/registry-ownership-test.js
@@ -0,0 +1,18 @@
+import assert from 'node:assert/strict';
+import { registrationIdentity } from '../names/ownership.js';
+
+const owner = 'a'.repeat(64), wallet = 'b'.repeat(64), stranger = 'c'.repeat(64);
+const grant = { pubkey: owner, manager: wallet };
+for (const signer of [owner, wallet]) {
+ assert.deepEqual(registrationIdentity({ signer, grant, granted: true }), { pubkey: owner, manager: wallet });
+}
+console.log('✓ owner and manager registrations both preserve the migration identity');
+assert.deepEqual(registrationIdentity({ signer: wallet, manager: wallet, grant, granted: true }), { pubkey: owner, manager: wallet });
+console.log('✓ the signing wallet can remain the nominated manager');
+const existing = { pubkey: owner, manager: wallet };
+assert.deepEqual(registrationIdentity({ existing, signer: wallet, grant: { pubkey: stranger }, granted: false }), existing);
+console.log('✓ later wallet updates preserve existing ownership and management');
+assert.deepEqual(registrationIdentity({ signer: wallet, grant, granted: false }), { pubkey: wallet, manager: undefined });
+assert.deepEqual(registrationIdentity({ signer: owner, manager: wallet }), existing);
+assert.deepEqual(registrationIdentity({ signer: owner, manager: owner }), { pubkey: owner, manager: undefined });
+console.log('✓ ordinary claims retain their signer and ignore unauthorized grants');