nostr-bray 1.16.1 → 1.17.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/bunker.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface BunkerOptions {
14
14
  ctx: IdentityContext;
15
15
  relays: string[];
16
16
  authorizedKeys?: string[];
17
+ bunkerKeyHex?: string;
17
18
  quiet?: boolean;
18
19
  }
19
20
  export interface BunkerInstance {
package/dist/bunker.js CHANGED
@@ -19,8 +19,10 @@ export function startBunker(opts) {
19
19
  const { ctx, relays, quiet } = opts;
20
20
  const authorizedKeys = new Set(opts.authorizedKeys ?? []);
21
21
  const log = quiet ? () => { } : (...args) => console.error('[bunker]', ...args);
22
- // Generate a bunker-specific keypair for NIP-46 communication
23
- const bunkerSk = generateSecretKey();
22
+ // Use persistent key if provided, otherwise generate ephemeral
23
+ const bunkerSk = opts.bunkerKeyHex
24
+ ? Buffer.from(opts.bunkerKeyHex, 'hex')
25
+ : generateSecretKey();
24
26
  const bunkerPk = getPublicKey(bunkerSk);
25
27
  const bunkerNpub = npubEncode(bunkerPk);
26
28
  const pool = new SimplePool();
package/dist/cli.js CHANGED
@@ -39,10 +39,20 @@ if (command === 'bunker' && !args.includes('--help')) {
39
39
  const authorizedKeys = args.includes('--authorized-keys')
40
40
  ? args[args.indexOf('--authorized-keys') + 1].split(',')
41
41
  : undefined;
42
+ // Persistent bunker key — read from file or flag
43
+ let bunkerKeyHex;
44
+ if (args.includes('--bunker-key-file')) {
45
+ const { readFileSync } = await import('node:fs');
46
+ bunkerKeyHex = readFileSync(args[args.indexOf('--bunker-key-file') + 1], 'utf-8').trim();
47
+ }
48
+ else if (args.includes('--bunker-key')) {
49
+ bunkerKeyHex = args[args.indexOf('--bunker-key') + 1];
50
+ }
42
51
  const bunker = startBunker({
43
52
  ctx: bCtx,
44
53
  relays: config.relays,
45
54
  authorizedKeys,
55
+ bunkerKeyHex,
46
56
  quiet: args.includes('--quiet'),
47
57
  });
48
58
  console.error(`nostr-bray bunker running`);
@@ -216,7 +226,15 @@ const pool = new RelayPool({
216
226
  defaultRelays: config.relays,
217
227
  });
218
228
  const nip65 = new Nip65Manager(pool, config.relays);
219
- const ctx = new IdentityContext(config.secretKey, config.secretFormat);
229
+ let ctx;
230
+ if (config.bunkerUri) {
231
+ const { BunkerContext } = await import('./bunker-context.js');
232
+ ctx = await BunkerContext.connect(config.bunkerUri);
233
+ console.error(`Connected to bunker — signing as ${ctx.activeNpub}`);
234
+ }
235
+ else {
236
+ ctx = new IdentityContext(config.secretKey, config.secretFormat);
237
+ }
220
238
  const nwcUri = config.nwcUri;
221
239
  config.secretKey = '';
222
240
  config.nwcUri = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "description": "MCP server giving AI agents sovereign Nostr identities — key derivation, personas, attestations, duress detection, zaps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",