@massalabs/gossip-sdk 0.0.2-dev.20260413043942 → 0.0.2-dev.20260413074528

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.
@@ -21,6 +21,7 @@ export declare enum SdkEventType {
21
21
  MESSAGE_EDITED_OPTIMISTIC = "messageEditedOptimistic",
22
22
  MESSAGE_DELETE_FAILED = "messageDeleteFailed",
23
23
  MESSAGE_EDIT_FAILED = "messageEditFailed",
24
+ MESSAGE_ACKNOWLEDGED = "messageAcknowledged",
24
25
  ERROR = "error"
25
26
  }
26
27
  export type SdkEvents = {
@@ -73,6 +74,10 @@ export type SdkEvents = {
73
74
  messageDbId: number;
74
75
  original: Message;
75
76
  };
77
+ [SdkEventType.MESSAGE_ACKNOWLEDGED]: {
78
+ contactUserId: string;
79
+ messageDbId: number;
80
+ };
76
81
  [SdkEventType.ERROR]: {
77
82
  error: Error;
78
83
  context: string;
@@ -21,6 +21,7 @@ export var SdkEventType;
21
21
  SdkEventType["MESSAGE_EDITED_OPTIMISTIC"] = "messageEditedOptimistic";
22
22
  SdkEventType["MESSAGE_DELETE_FAILED"] = "messageDeleteFailed";
23
23
  SdkEventType["MESSAGE_EDIT_FAILED"] = "messageEditFailed";
24
+ SdkEventType["MESSAGE_ACKNOWLEDGED"] = "messageAcknowledged";
24
25
  SdkEventType["ERROR"] = "error";
25
26
  })(SdkEventType || (SdkEventType = {}));
26
27
  export class SdkEventEmitter {
@@ -132,9 +132,11 @@ export declare class MessageService {
132
132
  /** Fetch and decrypt messages from the protocol (alias) */
133
133
  fetch(): Promise<MessageResult>;
134
134
  /**
135
- * Delete an outgoing message by its database ID.
135
+ * Delete a message by its database ID (outgoing or incoming in 1-to-1).
136
136
  * Marks the local message as deleted and enqueues a delete control message
137
137
  * so the peer can mark their copy as deleted as well.
138
+ *
139
+ * Both sides can delete any message for plausible deniability.
138
140
  */
139
141
  deleteMessage(id: number): Promise<boolean>;
140
142
  sendReaction(contactUserId: string, emoji: string, originalMsgId: Uint8Array): Promise<SendMessageResult>;
@@ -627,6 +627,10 @@ export class MessageService {
627
627
  seeker: null,
628
628
  whenToSend: null,
629
629
  });
630
+ this.eventEmitter.emit(SdkEventType.MESSAGE_ACKNOWLEDGED, {
631
+ contactUserId: m.contactUserId,
632
+ messageDbId: m.id,
633
+ });
630
634
  }
631
635
  // After marking as DELIVERED, clean up DELIVERED keep-alive messages
632
636
  await this.queries.messages.deleteDeliveredKeepAlive(userId);
@@ -1368,16 +1372,16 @@ export class MessageService {
1368
1372
  return this.fetchMessages();
1369
1373
  }
1370
1374
  /**
1371
- * Delete an outgoing message by its database ID.
1375
+ * Delete a message by its database ID (outgoing or incoming in 1-to-1).
1372
1376
  * Marks the local message as deleted and enqueues a delete control message
1373
1377
  * so the peer can mark their copy as deleted as well.
1378
+ *
1379
+ * Both sides can delete any message for plausible deniability.
1374
1380
  */
1375
1381
  async deleteMessage(id) {
1376
1382
  const row = await this.queries.messages.getById(id);
1377
1383
  if (!row)
1378
1384
  return false;
1379
- if (row.direction !== MessageDirection.OUTGOING)
1380
- return false;
1381
1385
  if (!row.messageId)
1382
1386
  throw new Error('Cannot delete a message that has no messageId');
1383
1387
  const original = rowToMessage(row);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/gossip-sdk",
3
- "version": "0.0.2-dev.20260413043942",
3
+ "version": "0.0.2-dev.20260413074528",
4
4
  "description": "Gossip SDK for automation, chatbot, and integration use cases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",