nostr-bray 3.5.3 → 3.5.4

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.
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { BunkerSigner } from 'nostr-tools/nip46';
16
16
  import { useWebSocketImplementation, SimplePool } from 'nostr-tools/pool';
17
- import { generateSecretKey } from 'nostr-tools/pure';
17
+ import { generateSecretKey, finalizeEvent } from 'nostr-tools/pure';
18
18
  import { npubEncode } from 'nostr-tools/nip19';
19
19
  import WebSocket from 'ws';
20
20
  import { readStateFile, writeStateFile } from './state.js';
@@ -126,7 +126,10 @@ export class BunkerContext {
126
126
  static create(uri, stateDir) {
127
127
  const config = parseBunkerUri(uri);
128
128
  const clientSk = resolveClientKey(config, stateDir);
129
+ // Sign in (NIP-42) with the client key when a relay asks, so private
130
+ // relays that only let a key read messages addressed to it still work.
129
131
  const pool = new SimplePool();
132
+ pool.automaticallyAuth = () => async (template) => finalizeEvent(template, clientSk);
130
133
  const signer = BunkerSigner.fromBunker(clientSk, {
131
134
  pubkey: config.pubkey,
132
135
  relays: config.relays,
package/dist/bunker.js CHANGED
@@ -34,7 +34,10 @@ export function startBunker(opts) {
34
34
  ...cliAuthorizedKeys,
35
35
  ...bunkerApprovals,
36
36
  ]);
37
+ // Sign in (NIP-42) with the bunker key when a relay asks, so a private
38
+ // relay lets the bunker read requests addressed to it.
37
39
  const pool = new SimplePool();
40
+ pool.automaticallyAuth = () => async (template) => finalizeEvent(template, bunkerSk);
38
41
  // Subscribe to kind 24133 events addressed to us
39
42
  const sub = pool.subscribeMany(relays, { kinds: [24133], '#p': [bunkerPk] }, {
40
43
  onevent: async (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "mcpName": "dev.forgesworn/bray",
5
5
  "description": "Trust-aware Nostr MCP server, CLI and TypeScript SDK for AI agents and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
6
6
  "type": "module",
@@ -169,7 +169,7 @@
169
169
  "node": ">=24"
170
170
  },
171
171
  "dependencies": {
172
- "@forgesworn/nwc-kit": "0.1.8",
172
+ "@forgesworn/nwc-kit": "0.1.9",
173
173
  "@forgesworn/range-proof": "^2.0.1",
174
174
  "@forgesworn/ring-sig": "^3.0.0",
175
175
  "@forgesworn/shamir-words": "^1.0.4",