@arbidocs/sdk 0.4.110 → 0.4.114

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.
@@ -3466,7 +3466,12 @@ type DecryptedChatMessage = ChatMessageResponse & {
3466
3466
  /** Set when the message has attachments but its manifest could not be decrypted. */
3467
3467
  attachmentsError?: string;
3468
3468
  };
3469
- /** Decrypt one message with the key of its own epoch. Never throws. */
3469
+ /**
3470
+ * A deleted message as the server keeps it: in place, `deleted`, with no content or attachments.
3471
+ * Nothing to decrypt — render it as a "Message deleted" tombstone.
3472
+ */
3473
+ declare function chatMessageTombstone<T extends ChatMessageResponse>(message: T): T;
3474
+ /** Decrypt one message with the key of its own epoch. Never throws. A tombstone is not decrypted. */
3470
3475
  declare function decryptChatMessage(ring: ChatKeyRing, message: ChatMessageResponse): Promise<DecryptedChatMessage>;
3471
3476
  declare function decryptChatMessages(ring: ChatKeyRing, messages: ChatMessageResponse[]): Promise<DecryptedChatMessage[]>;
3472
3477
  /** A group's title in plaintext; null when it has none or it does not open. */
@@ -3567,6 +3572,7 @@ type chats_DecryptedChatMessage = DecryptedChatMessage;
3567
3572
  type chats_ResolvedRecipient = ResolvedRecipient;
3568
3573
  type chats_SendChatMessageOptions = SendChatMessageOptions;
3569
3574
  declare const chats_addChatMembers: typeof addChatMembers;
3575
+ declare const chats_chatMessageTombstone: typeof chatMessageTombstone;
3570
3576
  declare const chats_checkChatAttachmentLimits: typeof checkChatAttachmentLimits;
3571
3577
  declare const chats_createChatCryptoContext: typeof createChatCryptoContext;
3572
3578
  declare const chats_createGroupChat: typeof createGroupChat;
@@ -3599,7 +3605,7 @@ declare const chats_serializeChatAttachmentManifest: typeof serializeChatAttachm
3599
3605
  declare const chats_uploadChatAttachment: typeof uploadChatAttachment;
3600
3606
  declare const chats_uploadChatAttachments: typeof uploadChatAttachments;
3601
3607
  declare namespace chats {
3602
- export { chats_CHAT_ATTACHMENT_MAX_BYTES as CHAT_ATTACHMENT_MAX_BYTES, chats_CHAT_ATTACHMENT_MAX_FILES as CHAT_ATTACHMENT_MAX_FILES, type chats_ChatAttachmentFile as ChatAttachmentFile, type chats_ChatAttachmentInput as ChatAttachmentInput, type chats_ChatCryptoContext as ChatCryptoContext, type chats_ChatKeyRing as ChatKeyRing, type chats_ChatKind as ChatKind, type chats_ChatMemberKey as ChatMemberKey, type chats_ChatMemberResponse as ChatMemberResponse, type chats_ChatMessageResponse as ChatMessageResponse, type chats_ChatResponse as ChatResponse, chats_DECRYPTION_FAILED as DECRYPTION_FAILED, type chats_DecryptedChat as DecryptedChat, type chats_DecryptedChatMessage as DecryptedChatMessage, type chats_ResolvedRecipient as ResolvedRecipient, type chats_SendChatMessageOptions as SendChatMessageOptions, chats_addChatMembers as addChatMembers, chats_checkChatAttachmentLimits as checkChatAttachmentLimits, chats_createChatCryptoContext as createChatCryptoContext, chats_createGroupChat as createGroupChat, chats_decryptChatAttachmentManifest as decryptChatAttachmentManifest, chats_decryptChatMessage as decryptChatMessage, chats_decryptChatMessages as decryptChatMessages, chats_decryptChatTitle as decryptChatTitle, chats_deleteChatMessage as deleteChatMessage, chats_directPeer as directPeer, chats_downloadChatAttachment as downloadChatAttachment, chats_encryptChatAttachmentManifest as encryptChatAttachmentManifest, chats_ensureChatKeyCurrent as ensureChatKeyCurrent, chats_getChat as getChat, chats_hasRead as hasRead, chats_isAgentExtId as isAgentExtId, chats_listChatMessages as listChatMessages, chats_listChats as listChats, chats_loadDecryptedChat as loadDecryptedChat, chats_markChatRead as markChatRead, chats_openChatKeyRing as openChatKeyRing, chats_openDirectChat as openDirectChat, chats_parseChatAttachmentManifest as parseChatAttachmentManifest, chats_removeChatMember as removeChatMember, chats_renameChat as renameChat, chats_resolveRecipient as resolveRecipient, chats_rotateChatKey as rotateChatKey, chats_sendChatMessage as sendChatMessage, chats_sendDirectMessage as sendDirectMessage, chats_serializeChatAttachmentManifest as serializeChatAttachmentManifest, chats_uploadChatAttachment as uploadChatAttachment, chats_uploadChatAttachments as uploadChatAttachments };
3608
+ export { chats_CHAT_ATTACHMENT_MAX_BYTES as CHAT_ATTACHMENT_MAX_BYTES, chats_CHAT_ATTACHMENT_MAX_FILES as CHAT_ATTACHMENT_MAX_FILES, type chats_ChatAttachmentFile as ChatAttachmentFile, type chats_ChatAttachmentInput as ChatAttachmentInput, type chats_ChatCryptoContext as ChatCryptoContext, type chats_ChatKeyRing as ChatKeyRing, type chats_ChatKind as ChatKind, type chats_ChatMemberKey as ChatMemberKey, type chats_ChatMemberResponse as ChatMemberResponse, type chats_ChatMessageResponse as ChatMessageResponse, type chats_ChatResponse as ChatResponse, chats_DECRYPTION_FAILED as DECRYPTION_FAILED, type chats_DecryptedChat as DecryptedChat, type chats_DecryptedChatMessage as DecryptedChatMessage, type chats_ResolvedRecipient as ResolvedRecipient, type chats_SendChatMessageOptions as SendChatMessageOptions, chats_addChatMembers as addChatMembers, chats_chatMessageTombstone as chatMessageTombstone, chats_checkChatAttachmentLimits as checkChatAttachmentLimits, chats_createChatCryptoContext as createChatCryptoContext, chats_createGroupChat as createGroupChat, chats_decryptChatAttachmentManifest as decryptChatAttachmentManifest, chats_decryptChatMessage as decryptChatMessage, chats_decryptChatMessages as decryptChatMessages, chats_decryptChatTitle as decryptChatTitle, chats_deleteChatMessage as deleteChatMessage, chats_directPeer as directPeer, chats_downloadChatAttachment as downloadChatAttachment, chats_encryptChatAttachmentManifest as encryptChatAttachmentManifest, chats_ensureChatKeyCurrent as ensureChatKeyCurrent, chats_getChat as getChat, chats_hasRead as hasRead, chats_isAgentExtId as isAgentExtId, chats_listChatMessages as listChatMessages, chats_listChats as listChats, chats_loadDecryptedChat as loadDecryptedChat, chats_markChatRead as markChatRead, chats_openChatKeyRing as openChatKeyRing, chats_openDirectChat as openDirectChat, chats_parseChatAttachmentManifest as parseChatAttachmentManifest, chats_removeChatMember as removeChatMember, chats_renameChat as renameChat, chats_resolveRecipient as resolveRecipient, chats_rotateChatKey as rotateChatKey, chats_sendChatMessage as sendChatMessage, chats_sendDirectMessage as sendDirectMessage, chats_serializeChatAttachmentManifest as serializeChatAttachmentManifest, chats_uploadChatAttachment as uploadChatAttachment, chats_uploadChatAttachments as uploadChatAttachments };
3603
3609
  }
3604
3610
 
3605
3611
  /**
@@ -3466,7 +3466,12 @@ type DecryptedChatMessage = ChatMessageResponse & {
3466
3466
  /** Set when the message has attachments but its manifest could not be decrypted. */
3467
3467
  attachmentsError?: string;
3468
3468
  };
3469
- /** Decrypt one message with the key of its own epoch. Never throws. */
3469
+ /**
3470
+ * A deleted message as the server keeps it: in place, `deleted`, with no content or attachments.
3471
+ * Nothing to decrypt — render it as a "Message deleted" tombstone.
3472
+ */
3473
+ declare function chatMessageTombstone<T extends ChatMessageResponse>(message: T): T;
3474
+ /** Decrypt one message with the key of its own epoch. Never throws. A tombstone is not decrypted. */
3470
3475
  declare function decryptChatMessage(ring: ChatKeyRing, message: ChatMessageResponse): Promise<DecryptedChatMessage>;
3471
3476
  declare function decryptChatMessages(ring: ChatKeyRing, messages: ChatMessageResponse[]): Promise<DecryptedChatMessage[]>;
3472
3477
  /** A group's title in plaintext; null when it has none or it does not open. */
@@ -3567,6 +3572,7 @@ type chats_DecryptedChatMessage = DecryptedChatMessage;
3567
3572
  type chats_ResolvedRecipient = ResolvedRecipient;
3568
3573
  type chats_SendChatMessageOptions = SendChatMessageOptions;
3569
3574
  declare const chats_addChatMembers: typeof addChatMembers;
3575
+ declare const chats_chatMessageTombstone: typeof chatMessageTombstone;
3570
3576
  declare const chats_checkChatAttachmentLimits: typeof checkChatAttachmentLimits;
3571
3577
  declare const chats_createChatCryptoContext: typeof createChatCryptoContext;
3572
3578
  declare const chats_createGroupChat: typeof createGroupChat;
@@ -3599,7 +3605,7 @@ declare const chats_serializeChatAttachmentManifest: typeof serializeChatAttachm
3599
3605
  declare const chats_uploadChatAttachment: typeof uploadChatAttachment;
3600
3606
  declare const chats_uploadChatAttachments: typeof uploadChatAttachments;
3601
3607
  declare namespace chats {
3602
- export { chats_CHAT_ATTACHMENT_MAX_BYTES as CHAT_ATTACHMENT_MAX_BYTES, chats_CHAT_ATTACHMENT_MAX_FILES as CHAT_ATTACHMENT_MAX_FILES, type chats_ChatAttachmentFile as ChatAttachmentFile, type chats_ChatAttachmentInput as ChatAttachmentInput, type chats_ChatCryptoContext as ChatCryptoContext, type chats_ChatKeyRing as ChatKeyRing, type chats_ChatKind as ChatKind, type chats_ChatMemberKey as ChatMemberKey, type chats_ChatMemberResponse as ChatMemberResponse, type chats_ChatMessageResponse as ChatMessageResponse, type chats_ChatResponse as ChatResponse, chats_DECRYPTION_FAILED as DECRYPTION_FAILED, type chats_DecryptedChat as DecryptedChat, type chats_DecryptedChatMessage as DecryptedChatMessage, type chats_ResolvedRecipient as ResolvedRecipient, type chats_SendChatMessageOptions as SendChatMessageOptions, chats_addChatMembers as addChatMembers, chats_checkChatAttachmentLimits as checkChatAttachmentLimits, chats_createChatCryptoContext as createChatCryptoContext, chats_createGroupChat as createGroupChat, chats_decryptChatAttachmentManifest as decryptChatAttachmentManifest, chats_decryptChatMessage as decryptChatMessage, chats_decryptChatMessages as decryptChatMessages, chats_decryptChatTitle as decryptChatTitle, chats_deleteChatMessage as deleteChatMessage, chats_directPeer as directPeer, chats_downloadChatAttachment as downloadChatAttachment, chats_encryptChatAttachmentManifest as encryptChatAttachmentManifest, chats_ensureChatKeyCurrent as ensureChatKeyCurrent, chats_getChat as getChat, chats_hasRead as hasRead, chats_isAgentExtId as isAgentExtId, chats_listChatMessages as listChatMessages, chats_listChats as listChats, chats_loadDecryptedChat as loadDecryptedChat, chats_markChatRead as markChatRead, chats_openChatKeyRing as openChatKeyRing, chats_openDirectChat as openDirectChat, chats_parseChatAttachmentManifest as parseChatAttachmentManifest, chats_removeChatMember as removeChatMember, chats_renameChat as renameChat, chats_resolveRecipient as resolveRecipient, chats_rotateChatKey as rotateChatKey, chats_sendChatMessage as sendChatMessage, chats_sendDirectMessage as sendDirectMessage, chats_serializeChatAttachmentManifest as serializeChatAttachmentManifest, chats_uploadChatAttachment as uploadChatAttachment, chats_uploadChatAttachments as uploadChatAttachments };
3608
+ export { chats_CHAT_ATTACHMENT_MAX_BYTES as CHAT_ATTACHMENT_MAX_BYTES, chats_CHAT_ATTACHMENT_MAX_FILES as CHAT_ATTACHMENT_MAX_FILES, type chats_ChatAttachmentFile as ChatAttachmentFile, type chats_ChatAttachmentInput as ChatAttachmentInput, type chats_ChatCryptoContext as ChatCryptoContext, type chats_ChatKeyRing as ChatKeyRing, type chats_ChatKind as ChatKind, type chats_ChatMemberKey as ChatMemberKey, type chats_ChatMemberResponse as ChatMemberResponse, type chats_ChatMessageResponse as ChatMessageResponse, type chats_ChatResponse as ChatResponse, chats_DECRYPTION_FAILED as DECRYPTION_FAILED, type chats_DecryptedChat as DecryptedChat, type chats_DecryptedChatMessage as DecryptedChatMessage, type chats_ResolvedRecipient as ResolvedRecipient, type chats_SendChatMessageOptions as SendChatMessageOptions, chats_addChatMembers as addChatMembers, chats_chatMessageTombstone as chatMessageTombstone, chats_checkChatAttachmentLimits as checkChatAttachmentLimits, chats_createChatCryptoContext as createChatCryptoContext, chats_createGroupChat as createGroupChat, chats_decryptChatAttachmentManifest as decryptChatAttachmentManifest, chats_decryptChatMessage as decryptChatMessage, chats_decryptChatMessages as decryptChatMessages, chats_decryptChatTitle as decryptChatTitle, chats_deleteChatMessage as deleteChatMessage, chats_directPeer as directPeer, chats_downloadChatAttachment as downloadChatAttachment, chats_encryptChatAttachmentManifest as encryptChatAttachmentManifest, chats_ensureChatKeyCurrent as ensureChatKeyCurrent, chats_getChat as getChat, chats_hasRead as hasRead, chats_isAgentExtId as isAgentExtId, chats_listChatMessages as listChatMessages, chats_listChats as listChats, chats_loadDecryptedChat as loadDecryptedChat, chats_markChatRead as markChatRead, chats_openChatKeyRing as openChatKeyRing, chats_openDirectChat as openDirectChat, chats_parseChatAttachmentManifest as parseChatAttachmentManifest, chats_removeChatMember as removeChatMember, chats_renameChat as renameChat, chats_resolveRecipient as resolveRecipient, chats_rotateChatKey as rotateChatKey, chats_sendChatMessage as sendChatMessage, chats_sendDirectMessage as sendDirectMessage, chats_serializeChatAttachmentManifest as serializeChatAttachmentManifest, chats_uploadChatAttachment as uploadChatAttachment, chats_uploadChatAttachments as uploadChatAttachments };
3603
3609
  }
3604
3610
 
3605
3611
  /**
package/dist/browser.cjs CHANGED
@@ -5516,6 +5516,7 @@ __export(chats_exports, {
5516
5516
  CHAT_ATTACHMENT_MAX_FILES: () => CHAT_ATTACHMENT_MAX_FILES,
5517
5517
  DECRYPTION_FAILED: () => DECRYPTION_FAILED,
5518
5518
  addChatMembers: () => addChatMembers,
5519
+ chatMessageTombstone: () => chatMessageTombstone,
5519
5520
  checkChatAttachmentLimits: () => checkChatAttachmentLimits,
5520
5521
  createChatCryptoContext: () => createChatCryptoContext,
5521
5522
  createGroupChat: () => createGroupChat,
@@ -5799,7 +5800,21 @@ function keyFor(ring, version) {
5799
5800
  return key;
5800
5801
  }
5801
5802
  var DECRYPTION_FAILED = "[Decryption failed]";
5803
+ function chatMessageTombstone(message) {
5804
+ const row = {
5805
+ ...message,
5806
+ deleted: true,
5807
+ content: null,
5808
+ attachments: null,
5809
+ dedupe_key: null
5810
+ };
5811
+ delete row.decryptFailed;
5812
+ delete row.attachmentFiles;
5813
+ delete row.attachmentsError;
5814
+ return row;
5815
+ }
5802
5816
  async function decryptChatMessage(ring, message) {
5817
+ if (message.deleted) return chatMessageTombstone(message);
5803
5818
  const key = ring.keys.get(message.key_version);
5804
5819
  const row = { ...message };
5805
5820
  if (message.content) {