@unicitylabs/sphere-sdk 0.5.7 → 0.6.0-dev.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.
@@ -91,16 +91,6 @@ interface TransportProvider extends BaseProvider {
91
91
  * @returns true if successful, false if nametag is taken by another pubkey
92
92
  */
93
93
  publishIdentityBinding?(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
94
- /**
95
- * @deprecated Use publishIdentityBinding instead
96
- * Register a nametag for this identity
97
- */
98
- registerNametag?(nametag: string, chainPubkey: string, directAddress: string): Promise<boolean>;
99
- /**
100
- * @deprecated Use publishIdentityBinding instead
101
- * Publish nametag binding
102
- */
103
- publishNametag?(nametag: string, address: string): Promise<void>;
104
94
  /**
105
95
  * Subscribe to broadcast messages (global/channel)
106
96
  */
@@ -556,10 +546,14 @@ declare class NostrTransportProvider implements TransportProvider {
556
546
  resolveNametagInfo(nametag: string): Promise<PeerInfo | null>;
557
547
  /**
558
548
  * Resolve a DIRECT://, PROXY://, or L1 address to full peer info.
559
- * Performs reverse lookup: hash(address) query '#t' tag → parse binding event.
560
- * Works with both new identity binding events and legacy nametag binding events.
549
+ * Performs reverse lookup via nostr-js-sdk with first-seen-wins anti-hijacking.
561
550
  */
562
551
  resolveAddressInfo(address: string): Promise<PeerInfo | null>;
552
+ /**
553
+ * Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
554
+ * Computes PROXY address from nametag if available.
555
+ */
556
+ private bindingInfoToPeerInfo;
563
557
  /**
564
558
  * Resolve transport pubkey (Nostr pubkey) to full peer info.
565
559
  * Queries binding events authored by the given pubkey.
@@ -578,18 +572,14 @@ declare class NostrTransportProvider implements TransportProvider {
578
572
  recoverNametag(): Promise<string | null>;
579
573
  /**
580
574
  * Publish identity binding event on Nostr.
581
- * Without nametag: publishes base binding (chainPubkey, l1Address, directAddress).
582
- * With nametag: also publishes nametag hash, proxy address, encrypted nametag for recovery.
583
- *
584
- * Uses kind 30078 parameterized replaceable event with d=SHA256('unicity:identity:' + nostrPubkey).
585
- * Each HD address index has its own Nostr key → its own binding event.
575
+ * Without nametag: publishes base binding (chainPubkey, l1Address, directAddress)
576
+ * using a per-identity d-tag for address discovery.
577
+ * With nametag: delegates to nostr-js-sdk's publishNametagBinding which handles
578
+ * conflict detection (first-seen-wins), encryption, and indexed tags.
586
579
  *
587
580
  * @returns true if successful, false if nametag is taken by another pubkey
588
581
  */
589
582
  publishIdentityBinding(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
590
- /** @deprecated Use publishIdentityBinding instead */
591
- publishNametag(nametag: string, address: string): Promise<void>;
592
- registerNametag(nametag: string, _publicKey: string, directAddress?: string): Promise<boolean>;
593
583
  private broadcastSubscriptions;
594
584
  subscribeToBroadcast(tags: string[], handler: BroadcastHandler): () => void;
595
585
  publishBroadcast(content: string, tags?: string[]): Promise<string>;
@@ -91,16 +91,6 @@ interface TransportProvider extends BaseProvider {
91
91
  * @returns true if successful, false if nametag is taken by another pubkey
92
92
  */
93
93
  publishIdentityBinding?(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
94
- /**
95
- * @deprecated Use publishIdentityBinding instead
96
- * Register a nametag for this identity
97
- */
98
- registerNametag?(nametag: string, chainPubkey: string, directAddress: string): Promise<boolean>;
99
- /**
100
- * @deprecated Use publishIdentityBinding instead
101
- * Publish nametag binding
102
- */
103
- publishNametag?(nametag: string, address: string): Promise<void>;
104
94
  /**
105
95
  * Subscribe to broadcast messages (global/channel)
106
96
  */
@@ -556,10 +546,14 @@ declare class NostrTransportProvider implements TransportProvider {
556
546
  resolveNametagInfo(nametag: string): Promise<PeerInfo | null>;
557
547
  /**
558
548
  * Resolve a DIRECT://, PROXY://, or L1 address to full peer info.
559
- * Performs reverse lookup: hash(address) query '#t' tag → parse binding event.
560
- * Works with both new identity binding events and legacy nametag binding events.
549
+ * Performs reverse lookup via nostr-js-sdk with first-seen-wins anti-hijacking.
561
550
  */
562
551
  resolveAddressInfo(address: string): Promise<PeerInfo | null>;
552
+ /**
553
+ * Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
554
+ * Computes PROXY address from nametag if available.
555
+ */
556
+ private bindingInfoToPeerInfo;
563
557
  /**
564
558
  * Resolve transport pubkey (Nostr pubkey) to full peer info.
565
559
  * Queries binding events authored by the given pubkey.
@@ -578,18 +572,14 @@ declare class NostrTransportProvider implements TransportProvider {
578
572
  recoverNametag(): Promise<string | null>;
579
573
  /**
580
574
  * Publish identity binding event on Nostr.
581
- * Without nametag: publishes base binding (chainPubkey, l1Address, directAddress).
582
- * With nametag: also publishes nametag hash, proxy address, encrypted nametag for recovery.
583
- *
584
- * Uses kind 30078 parameterized replaceable event with d=SHA256('unicity:identity:' + nostrPubkey).
585
- * Each HD address index has its own Nostr key → its own binding event.
575
+ * Without nametag: publishes base binding (chainPubkey, l1Address, directAddress)
576
+ * using a per-identity d-tag for address discovery.
577
+ * With nametag: delegates to nostr-js-sdk's publishNametagBinding which handles
578
+ * conflict detection (first-seen-wins), encryption, and indexed tags.
586
579
  *
587
580
  * @returns true if successful, false if nametag is taken by another pubkey
588
581
  */
589
582
  publishIdentityBinding(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
590
- /** @deprecated Use publishIdentityBinding instead */
591
- publishNametag(nametag: string, address: string): Promise<void>;
592
- registerNametag(nametag: string, _publicKey: string, directAddress?: string): Promise<boolean>;
593
583
  private broadcastSubscriptions;
594
584
  subscribeToBroadcast(tags: string[], handler: BroadcastHandler): () => void;
595
585
  publishBroadcast(content: string, tags?: string[]): Promise<string>;