nostr-bray 1.25.0 → 1.25.1
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-context.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { PublicIdentity, SignFn } from './types.js';
|
|
|
15
15
|
import type { SigningContext } from './signing-context.js';
|
|
16
16
|
export interface BunkerConfig {
|
|
17
17
|
pubkey: string;
|
|
18
|
-
|
|
18
|
+
relays: string[];
|
|
19
19
|
secret?: string;
|
|
20
20
|
}
|
|
21
21
|
/** Parse a bunker:// URI */
|
package/dist/bunker-context.js
CHANGED
|
@@ -17,15 +17,15 @@ import WebSocket from 'ws';
|
|
|
17
17
|
useWebSocketImplementation(WebSocket);
|
|
18
18
|
/** Parse a bunker:// URI */
|
|
19
19
|
export function parseBunkerUri(uri) {
|
|
20
|
-
// bunker://<pubkey>?relay=<url>&secret=<hex>
|
|
20
|
+
// bunker://<pubkey>?relay=<url>&relay=<url>&secret=<hex>
|
|
21
21
|
const url = new URL(uri);
|
|
22
22
|
const pubkey = url.hostname || url.pathname.replace('//', '');
|
|
23
|
-
const
|
|
23
|
+
const relays = url.searchParams.getAll('relay');
|
|
24
24
|
const secret = url.searchParams.get('secret') ?? undefined;
|
|
25
|
-
if (!pubkey ||
|
|
25
|
+
if (!pubkey || relays.length === 0) {
|
|
26
26
|
throw new Error('Invalid bunker URI: missing pubkey or relay');
|
|
27
27
|
}
|
|
28
|
-
return { pubkey,
|
|
28
|
+
return { pubkey, relays, secret };
|
|
29
29
|
}
|
|
30
30
|
export class BunkerContext {
|
|
31
31
|
signer;
|
|
@@ -44,7 +44,7 @@ export class BunkerContext {
|
|
|
44
44
|
? Buffer.from(config.secret, 'hex')
|
|
45
45
|
: generateSecretKey();
|
|
46
46
|
const pool = new SimplePool();
|
|
47
|
-
const signer = BunkerSigner.fromBunker(clientSk, { pubkey: config.pubkey, relays:
|
|
47
|
+
const signer = BunkerSigner.fromBunker(clientSk, { pubkey: config.pubkey, relays: config.relays, secret: null }, { pool });
|
|
48
48
|
// Connect and verify
|
|
49
49
|
await signer.connect();
|
|
50
50
|
await signer.ping();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nostr-bray",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.1",
|
|
4
4
|
"description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|