nostr-bray 3.4.0 → 3.4.2

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.
@@ -116,7 +116,7 @@ export class TrustContext {
116
116
  this.signet = new SignetAssessor(pool, { ttl: opts.cacheTtl, maxEntries: opts.cacheMax });
117
117
  this.vault = new VaultResolver(pool, { ttl: opts.cacheTtl, maxEntries: opts.cacheMax });
118
118
  this.veilCache = new TrustCache({ ttl: opts.cacheTtl, maxEntries: opts.cacheMax });
119
- this.veil = new VeilScoring(pool, this.veilCache, ctx.activeNpub);
119
+ this.veil = new VeilScoring(pool, this.veilCache, () => ctx.activeNpub);
120
120
  }
121
121
  /** Assess trust for a target pubkey across all three dimensions in parallel. */
122
122
  async assess(targetPubkeyHex) {
@@ -12,7 +12,8 @@ export declare class VeilScoring {
12
12
  private readonly pool;
13
13
  private readonly cache;
14
14
  private readonly npub;
15
- constructor(pool: RelayPool, cache: TrustCache, npub: string);
15
+ constructor(pool: RelayPool, cache: TrustCache, npub: string | (() => string));
16
+ private get selfNpub();
16
17
  scorePubkey(pubkey: string): Promise<TrustScoreResult>;
17
18
  scoreEvents(events: NostrEvent[]): Promise<ScoredEvent[]>;
18
19
  }
@@ -4,11 +4,18 @@ export class VeilScoring {
4
4
  pool;
5
5
  cache;
6
6
  npub;
7
- constructor(pool, cache, npub) {
7
+ constructor(pool, cache,
8
+ // A string is captured now; a function is read on every query, which is
9
+ // what a bunker-backed identity needs: its npub is not known until the
10
+ // bunker has answered, and the trust layer is built before that.
11
+ npub) {
8
12
  this.pool = pool;
9
13
  this.cache = cache;
10
14
  this.npub = npub;
11
15
  }
16
+ get selfNpub() {
17
+ return typeof this.npub === 'function' ? this.npub() : this.npub;
18
+ }
12
19
  async scorePubkey(pubkey) {
13
20
  // 1. Check cache first
14
21
  const cached = this.cache.get(pubkey);
@@ -16,7 +23,7 @@ export class VeilScoring {
16
23
  return { pubkey, ...cached, flags: [] };
17
24
  }
18
25
  // 2. Query kind 30382 (NIP-85) assertions from relays
19
- const events = await this.pool.query(this.npub, {
26
+ const events = await this.pool.query(this.selfNpub, {
20
27
  kinds: [30382],
21
28
  '#d': [pubkey],
22
29
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
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",