@unicitylabs/openclaw-unicity 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/channel.ts +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unicitylabs/openclaw-unicity",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Unicity wallet identity and encrypted DMs for OpenClaw agents — powered by Sphere SDK",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/channel.ts CHANGED
@@ -13,6 +13,7 @@ const DEFAULT_ACCOUNT_ID = "default";
13
13
  /** How long (ms) to wait after the last group message before declaring backfill complete. */
14
14
  export const GROUP_BACKFILL_DEBOUNCE_MS = 3_000;
15
15
 
16
+
16
17
  interface GroupBackfillState {
17
18
  phase: "buffering" | "live";
18
19
  latestMsg: {
@@ -508,14 +509,20 @@ export const unicityChannelPlugin = {
508
509
  });
509
510
  }
510
511
 
512
+ // Nostr pubkey for self-message detection. Group messages use the 32-byte
513
+ // x-only Nostr pubkey (event.pubkey), NOT the 33-byte compressed chainPubkey.
514
+ // sphere.groupChat.getMyPublicKey() returns the correct Nostr-format key.
515
+ const myNostrPubkey = sphere.groupChat?.getMyPublicKey?.() ?? null;
516
+
511
517
  // Per-group backfill state: buffer messages during the initial burst, then
512
518
  // switch to live dispatch once the burst settles.
513
519
  const groupBackfillStates = new Map<string, GroupBackfillState>();
514
520
 
515
521
  // Subscribe to incoming group messages
516
522
  const unsubGroupMessage = sphere.groupChat?.onMessage?.((msg: GroupMsg) => {
517
- // Skip messages from self
518
- if (msg.senderPubkey === sphere.identity?.chainPubkey) return;
523
+ // Skip messages from self (echoed back by the relay).
524
+ // Compare against the Nostr x-only pubkey, not chainPubkey.
525
+ if (myNostrPubkey && msg.senderPubkey === myNostrPubkey) return;
519
526
 
520
527
  // Lookup or create per-group backfill state
521
528
  let state = groupBackfillStates.get(msg.groupId);