nostr-bray 1.29.4 → 1.31.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/dist/cli.js CHANGED
@@ -521,12 +521,14 @@ async function run(cmdArgs) {
521
521
  break;
522
522
  }
523
523
  case 'claim': {
524
- const type = req(1, 'claim <type> [--subject <hex>] [--identifier <string>] [--summary <text>]');
524
+ const type = req(1, 'claim <type> [--subject <hex>] [--identifier <string>] [--summary <text>] [--assertion-address kind:pubkey:d-tag]');
525
525
  out(await handleTrustAttest(ctx, pool, {
526
526
  type,
527
527
  subject: flag('subject'),
528
528
  identifier: flag('identifier'),
529
529
  summary: flag('summary'),
530
+ assertionAddress: flag('assertion-address'),
531
+ assertionRelay: flag('relay'),
530
532
  }));
531
533
  break;
532
534
  }
package/dist/context.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { fromNsec, fromMnemonic, derive, zeroise } from 'nsec-tree';
2
- import { derivePersona } from 'nsec-tree/persona';
3
2
  import { createBlindProof, createFullProof } from 'nsec-tree/proof';
4
3
  import { finalizeEvent, getPublicKey } from 'nostr-tools/pure';
5
4
  import { decode, npubEncode, nsecEncode } from 'nostr-tools/nip19';
@@ -88,21 +87,17 @@ export class IdentityContext {
88
87
  return { npub, purpose: entry.purpose, index: entry.index, personaName: name };
89
88
  }
90
89
  }
91
- const persona = derivePersona(this.root, name, index);
90
+ const purpose = `persona/${name}`;
91
+ const identity = derive(this.root, purpose, index);
92
92
  const entry = {
93
- identity: persona.identity,
94
- purpose: persona.identity.purpose,
95
- index: persona.index,
93
+ identity,
94
+ purpose,
95
+ index,
96
96
  personaName: name,
97
97
  lastUsed: Date.now(),
98
98
  };
99
- this.putCache(persona.identity.npub, entry);
100
- return {
101
- npub: persona.identity.npub,
102
- purpose: persona.identity.purpose,
103
- index: persona.index,
104
- personaName: name,
105
- };
99
+ this.putCache(identity.npub, entry);
100
+ return { npub: identity.npub, purpose, index, personaName: name };
106
101
  }
107
102
  /** Switch active identity by purpose+index, persona name, or "master" */
108
103
  async switch(purposeOrName, index) {
@@ -128,9 +123,8 @@ export class IdentityContext {
128
123
  let purpose;
129
124
  let personaName;
130
125
  if (isPersonaName) {
131
- const persona = derivePersona(this.root, purposeOrName, index ?? 0);
132
- identity = persona.identity;
133
- purpose = persona.identity.purpose;
126
+ purpose = `persona/${purposeOrName}`;
127
+ identity = derive(this.root, purpose, index ?? 0);
134
128
  personaName = purposeOrName;
135
129
  }
136
130
  else {
@@ -13,6 +13,7 @@ export declare function handleTrustAttest(ctx: SigningContext, pool: RelayPool,
13
13
  identifier?: string;
14
14
  subject?: string;
15
15
  assertionId?: string;
16
+ assertionAddress?: string;
16
17
  assertionRelay?: string;
17
18
  summary?: string;
18
19
  content?: string;
@@ -7,17 +7,22 @@ import { hasExtendedIdentity } from '../signing-context.js';
7
7
  import { wrapEventAsync } from '../nip17-wrap.js';
8
8
  /** Create and publish a kind 31000 attestation */
9
9
  export async function handleTrustAttest(ctx, pool, args) {
10
- if (!args.type && !args.assertionId) {
11
- throw new Error('at least one of type or assertionId must be provided');
10
+ if (!args.type && !args.assertionId && !args.assertionAddress) {
11
+ throw new Error('at least one of type, assertionId, or assertionAddress must be provided');
12
12
  }
13
+ if (args.assertionId && args.assertionAddress) {
14
+ throw new Error('cannot supply both assertionId and assertionAddress');
15
+ }
16
+ const assertion = args.assertionId
17
+ ? { id: args.assertionId, relay: args.assertionRelay }
18
+ : args.assertionAddress
19
+ ? { address: args.assertionAddress, relay: args.assertionRelay }
20
+ : undefined;
13
21
  const template = createAttestation({
14
22
  type: args.type,
15
23
  identifier: args.identifier,
16
24
  subject: args.subject,
17
- assertion: args.assertionId ? {
18
- id: args.assertionId,
19
- relay: args.assertionRelay,
20
- } : undefined,
25
+ assertion,
21
26
  summary: args.summary,
22
27
  content: args.content,
23
28
  expiration: args.expiration,
@@ -44,12 +44,14 @@ export function registerTrustTools(server, deps) {
44
44
  summary: z.string().optional().describe('Human-readable summary'),
45
45
  content: z.string().optional().describe('Event content (text or JSON)'),
46
46
  expiration: z.number().optional().describe('Unix timestamp for attestation expiry'),
47
+ assertionAddress: z.string().optional().describe('Addressable event coordinate kind:pubkey:d-tag (produces an a-tag with "assertion" marker, e.g. for attesting authorship of a kind 30817 community NIP)'),
48
+ assertionRelay: z.string().optional().describe('Relay hint for the assertion address'),
47
49
  },
48
50
  annotations: { readOnlyHint: false },
49
- }, async ({ type, subject, identifier, summary, content, expiration }) => {
51
+ }, async ({ type, subject, identifier, summary, content, expiration, assertionAddress, assertionRelay }) => {
50
52
  const resolvedSubject = subject ? (await resolveRecipient(subject)).pubkeyHex : undefined;
51
53
  const result = await handleTrustAttest(deps.ctx, deps.pool, {
52
- type, subject: resolvedSubject, identifier, summary, content, expiration,
54
+ type, subject: resolvedSubject, identifier, summary, content, expiration, assertionAddress, assertionRelay,
53
55
  });
54
56
  const response = {
55
57
  id: result.event.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.29.4",
3
+ "version": "1.31.0",
4
4
  "mcpName": "dev.forgesworn/bray",
5
5
  "description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
6
6
  "type": "module",
@@ -69,12 +69,12 @@
69
69
  "@modelcontextprotocol/ext-apps": "^1.3.1",
70
70
  "@modelcontextprotocol/sdk": "^1.27.1",
71
71
  "canary-kit": "^2.6.2",
72
- "dominion-protocol": "^0.1.0",
73
- "nostr-attestations": "^2.2.0",
72
+ "dominion-protocol": "^1.0.0",
73
+ "nostr-attestations": "^2.5.4",
74
74
  "nostr-tools": "^2.23.3",
75
75
  "nostr-veil": "^0.1.0",
76
76
  "nsec-tree": "^1.4.2",
77
- "signet-protocol": "^0.1.0",
77
+ "signet-protocol": "^1.1.0",
78
78
  "socks-proxy-agent": "^9.0.0",
79
79
  "spoken-token": "^2.0.3",
80
80
  "ws": "^8.20.0",