nostr-bray 1.9.0 → 1.9.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/cli.js +8 -0
- package/dist/context.d.ts +3 -1
- package/dist/context.js +5 -1
- package/dist/relay/handlers.js +1 -1
- package/dist/social/handlers.js +3 -3
- package/dist/social/notifications.js +3 -1
- package/dist/zap/handlers.js +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -652,6 +652,14 @@ async function shell() {
|
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
654
654
|
const shellArgs = parseShellLine(trimmed);
|
|
655
|
+
// Per-command help in shell
|
|
656
|
+
if (shellArgs.includes('--help') && shellArgs[0]) {
|
|
657
|
+
const h = getCommandHelp(shellArgs[0]);
|
|
658
|
+
if (h) {
|
|
659
|
+
console.log(h);
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
655
663
|
try {
|
|
656
664
|
await run(shellArgs);
|
|
657
665
|
}
|
package/dist/context.d.ts
CHANGED
|
@@ -10,8 +10,10 @@ export declare class IdentityContext {
|
|
|
10
10
|
private activeEntry;
|
|
11
11
|
private maxCacheSize;
|
|
12
12
|
constructor(secretKey: string, format: 'nsec' | 'hex' | 'mnemonic', opts?: ContextOptions);
|
|
13
|
-
/** Current active identity's npub */
|
|
13
|
+
/** Current active identity's npub (bech32) */
|
|
14
14
|
get activeNpub(): string;
|
|
15
|
+
/** Current active identity's hex public key — use this in relay filters */
|
|
16
|
+
get activePublicKeyHex(): string;
|
|
15
17
|
/** Derive a child identity by purpose and index */
|
|
16
18
|
derive(purpose: string, index: number): PublicIdentity;
|
|
17
19
|
/** Derive a named persona */
|
package/dist/context.js
CHANGED
|
@@ -30,10 +30,14 @@ export class IdentityContext {
|
|
|
30
30
|
};
|
|
31
31
|
this.activeEntry = this.masterEntry;
|
|
32
32
|
}
|
|
33
|
-
/** Current active identity's npub */
|
|
33
|
+
/** Current active identity's npub (bech32) */
|
|
34
34
|
get activeNpub() {
|
|
35
35
|
return this.activeEntry.identity.npub;
|
|
36
36
|
}
|
|
37
|
+
/** Current active identity's hex public key — use this in relay filters */
|
|
38
|
+
get activePublicKeyHex() {
|
|
39
|
+
return Buffer.from(this.activeEntry.identity.publicKey).toString('hex');
|
|
40
|
+
}
|
|
37
41
|
/** Derive a child identity by purpose and index */
|
|
38
42
|
derive(purpose, index) {
|
|
39
43
|
// Return from cache if already derived
|
package/dist/relay/handlers.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function handleRelaySet(ctx, pool, args) {
|
|
|
18
18
|
// Check for existing relay list
|
|
19
19
|
const existing = await pool.query(ctx.activeNpub, {
|
|
20
20
|
kinds: [10002],
|
|
21
|
-
authors: [ctx.
|
|
21
|
+
authors: [ctx.activePublicKeyHex],
|
|
22
22
|
});
|
|
23
23
|
// Build r-tags
|
|
24
24
|
const tags = args.relays.map(r => {
|
package/dist/social/handlers.js
CHANGED
|
@@ -90,7 +90,7 @@ export async function handleSocialProfileSet(ctx, pool, args) {
|
|
|
90
90
|
// Check for existing profile
|
|
91
91
|
const existing = await pool.query(ctx.activeNpub, {
|
|
92
92
|
kinds: [0],
|
|
93
|
-
authors: [ctx.
|
|
93
|
+
authors: [ctx.activePublicKeyHex], // simplified — in production, use hex pubkey
|
|
94
94
|
});
|
|
95
95
|
if (existing.length > 0 && !args.confirm) {
|
|
96
96
|
// Build diff
|
|
@@ -154,7 +154,7 @@ export async function handleContactsFollow(ctx, pool, args) {
|
|
|
154
154
|
// Fetch existing contacts
|
|
155
155
|
const existing = await pool.query(ctx.activeNpub, {
|
|
156
156
|
kinds: [3],
|
|
157
|
-
authors: [ctx.
|
|
157
|
+
authors: [ctx.activePublicKeyHex],
|
|
158
158
|
});
|
|
159
159
|
let tags = [];
|
|
160
160
|
if (existing.length > 0) {
|
|
@@ -187,7 +187,7 @@ export async function handleContactsFollow(ctx, pool, args) {
|
|
|
187
187
|
export async function handleContactsUnfollow(ctx, pool, args) {
|
|
188
188
|
const existing = await pool.query(ctx.activeNpub, {
|
|
189
189
|
kinds: [3],
|
|
190
|
-
authors: [ctx.
|
|
190
|
+
authors: [ctx.activePublicKeyHex],
|
|
191
191
|
});
|
|
192
192
|
let tags = [];
|
|
193
193
|
if (existing.length > 0) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { decode } from 'nostr-tools/nip19';
|
|
1
2
|
/** Fetch notifications (mentions, replies, reactions, zaps) for the active identity */
|
|
2
3
|
export async function handleNotifications(ctx, pool, opts) {
|
|
4
|
+
const activeHex = decode(ctx.activeNpub).data;
|
|
3
5
|
const events = await pool.query(ctx.activeNpub, {
|
|
4
6
|
kinds: [1, 7, 9735],
|
|
5
|
-
'#p': [
|
|
7
|
+
'#p': [activeHex],
|
|
6
8
|
limit: opts?.limit ?? 50,
|
|
7
9
|
...(opts?.since ? { since: opts.since } : {}),
|
|
8
10
|
});
|
package/dist/zap/handlers.js
CHANGED
|
@@ -48,9 +48,11 @@ function decryptNwcResponse(conn, event) {
|
|
|
48
48
|
}
|
|
49
49
|
/** Parse zap receipts (kind 9735) for the active identity */
|
|
50
50
|
export async function handleZapReceipts(ctx, pool, opts) {
|
|
51
|
+
const { decode } = await import('nostr-tools/nip19');
|
|
52
|
+
const activeHex = decode(ctx.activeNpub).data;
|
|
51
53
|
const events = await pool.query(ctx.activeNpub, {
|
|
52
54
|
kinds: [9735],
|
|
53
|
-
'#p': [
|
|
55
|
+
'#p': [activeHex],
|
|
54
56
|
limit: opts?.limit ?? 20,
|
|
55
57
|
...(opts?.since ? { since: opts.since } : {}),
|
|
56
58
|
});
|
package/package.json
CHANGED