@msssystems/mss-link-sdk 0.2.11 → 0.2.15

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.
@@ -1,12 +1,15 @@
1
1
  import type { WasmMssClient } from '@msssystems/mss-crypto-wasm';
2
2
  import type { WasmEncryptedMediaBytes } from '../modules/media/media-crypto.contracts';
3
+ import type { SenderKeyDistribution } from '../modules/messages/message.contracts';
3
4
  export interface MssLinkWasmClient extends WasmMssClient {
4
5
  sendMediaMessage(chatId: string, targetUserId: string, metadataJson: string, mediaAssetIds: string[]): Promise<string>;
5
6
  healSession(chatId: string, targetUserId: string): Promise<string>;
6
7
  deleteSession(targetUserId: string): Promise<void>;
7
- getSenderKeyDistribution(groupId: string): Promise<any>;
8
- storeReceivedSenderKeyDistribution(distJson: any): Promise<void>;
9
- rotateGroupSenderKey(groupId: string): Promise<any>;
8
+ getSenderKeyDistribution(groupId: string): Promise<SenderKeyDistribution | undefined>;
9
+ storeReceivedSenderKeyDistribution(distJson: SenderKeyDistribution): Promise<void>;
10
+ rotateGroupSenderKey(groupId: string): Promise<SenderKeyDistribution>;
11
+ encryptSenderKeyDistribution(recipientId: string, distJson: SenderKeyDistribution): Promise<string>;
12
+ decryptSenderKeyDistribution(senderId: string, encryptedBlob: string): Promise<SenderKeyDistribution>;
10
13
  }
11
14
  export type WasmMssClientConstructor = new (userId: string, deviceId: number, apiBaseUrl: string) => MssLinkWasmClient;
12
15
  export interface MssCryptoWasmModule {
@@ -46,6 +46,11 @@ export interface Chat {
46
46
  createdAt: string;
47
47
  updatedAt: string;
48
48
  }
49
+ export interface MessageReaction {
50
+ id: string;
51
+ emoji: string;
52
+ userId: string;
53
+ }
49
54
  export interface Message {
50
55
  id: string;
51
56
  type: string;
@@ -61,7 +66,13 @@ export interface Message {
61
66
  displayName: string;
62
67
  avatarUrl?: string | null;
63
68
  };
69
+ forwardedFrom?: {
70
+ id: string;
71
+ displayName: string;
72
+ avatarUrl?: string | null;
73
+ } | null;
64
74
  media: MessageMediaAttachment[];
75
+ reactions: MessageReaction[];
65
76
  createdAt: string;
66
77
  updatedAt: string;
67
78
  }
@@ -99,7 +110,7 @@ export interface MarkMessagesStatusInput {
99
110
  throughMessageId?: string;
100
111
  limit?: number;
101
112
  }
102
- export type SyncEventType = 'MESSAGE_NEW' | 'MESSAGE_STATUS_UPDATED';
113
+ export type SyncEventType = 'MESSAGE_NEW' | 'MESSAGE_STATUS_UPDATED' | 'MESSAGE_REACT';
103
114
  export interface SyncEvent {
104
115
  sequence: string;
105
116
  type: SyncEventType;
@@ -145,6 +156,7 @@ export interface SendEncryptedMessageInput {
145
156
  chatId: string;
146
157
  targetUserId: string;
147
158
  text: string;
159
+ forwardedFromId?: string;
148
160
  }
149
161
  export interface SendMediaMessageInput {
150
162
  profileId: string;
@@ -8,6 +8,7 @@ export interface LocalSdkMessage {
8
8
  createdAt?: string;
9
9
  updatedAt?: string;
10
10
  }
11
+ import type { MessageReaction } from '../../contracts/chat.contract';
11
12
  export interface DecryptedMessage {
12
13
  id: string;
13
14
  chatId: string;
@@ -15,6 +16,38 @@ export interface DecryptedMessage {
15
16
  text: string;
16
17
  kind: string;
17
18
  status: string;
19
+ forwardedFrom?: {
20
+ id: string;
21
+ displayName: string;
22
+ avatarUrl?: string | null;
23
+ } | null;
24
+ reactions?: MessageReaction[];
18
25
  createdAt: string;
19
26
  updatedAt: string;
20
27
  }
28
+ export interface SenderKeyState {
29
+ chain_key_b64: string;
30
+ signing_key_b64: string;
31
+ verifying_key_b64: string;
32
+ iteration: number;
33
+ }
34
+ export interface SenderKeyDistribution {
35
+ group_id: string;
36
+ sender_id: string;
37
+ chain_key_b64: string;
38
+ verifying_key_b64: string;
39
+ iteration: number;
40
+ }
41
+ export interface ReceivedSenderKey {
42
+ group_id: string;
43
+ sender_id: string;
44
+ chain_key_b64: string;
45
+ verifying_key_b64: string;
46
+ iteration: number;
47
+ }
48
+ export interface SenderKeyMessage {
49
+ sender_id: string;
50
+ iteration: number;
51
+ ciphertext_b64: string;
52
+ signature_b64: string;
53
+ }
@@ -1,5 +1,5 @@
1
1
  import { WasmCryptoEngine } from '../../core/wasm-crypto-engine';
2
- import type { DecryptedMessage } from './message.contracts';
2
+ import type { DecryptedMessage, SenderKeyDistribution } from './message.contracts';
3
3
  export declare class MessagesCryptoClient {
4
4
  private readonly engine;
5
5
  private groupChatIds;
@@ -14,7 +14,9 @@ export declare class MessagesCryptoClient {
14
14
  syncMessages(): Promise<void>;
15
15
  private handleSessionHealing;
16
16
  getLocalMessages(chatId: string): Promise<DecryptedMessage[]>;
17
- getSenderKeyDistribution(groupId: string): Promise<any>;
18
- storeReceivedSenderKeyDistribution(distJson: any): Promise<void>;
19
- rotateGroupSenderKey(groupId: string): Promise<any>;
17
+ getSenderKeyDistribution(groupId: string): Promise<SenderKeyDistribution | undefined>;
18
+ storeReceivedSenderKeyDistribution(distJson: SenderKeyDistribution): Promise<void>;
19
+ rotateGroupSenderKey(groupId: string): Promise<SenderKeyDistribution>;
20
+ encryptSenderKeyDistribution(recipientId: string, distJson: SenderKeyDistribution): Promise<string>;
21
+ decryptSenderKeyDistribution(senderId: string, encryptedBlob: string): Promise<SenderKeyDistribution>;
20
22
  }
@@ -98,4 +98,22 @@ export class MessagesCryptoClient {
98
98
  throw normalizeLocalCryptoError(error);
99
99
  }
100
100
  }
101
+ async encryptSenderKeyDistribution(recipientId, distJson) {
102
+ try {
103
+ await this.engine.ensureReady();
104
+ return this.engine.runWithClient((client) => client.encryptSenderKeyDistribution(recipientId, distJson));
105
+ }
106
+ catch (error) {
107
+ throw normalizeLocalCryptoError(error);
108
+ }
109
+ }
110
+ async decryptSenderKeyDistribution(senderId, encryptedBlob) {
111
+ try {
112
+ await this.engine.ensureReady();
113
+ return this.engine.runWithClient((client) => client.decryptSenderKeyDistribution(senderId, encryptedBlob));
114
+ }
115
+ catch (error) {
116
+ throw normalizeLocalCryptoError(error);
117
+ }
118
+ }
101
119
  }
@@ -14,4 +14,5 @@ export declare class MessagesClient {
14
14
  getSyncCheckpoint(): Promise<any>;
15
15
  getSyncEvents(input?: any): Promise<any>;
16
16
  acknowledgeSyncCheckpoint(input: any): Promise<any>;
17
+ reactToMessage(chatId: string, messageId: string, emoji: string): Promise<any>;
17
18
  }
@@ -60,4 +60,7 @@ export class MessagesClient {
60
60
  async acknowledgeSyncCheckpoint(input) {
61
61
  return this.http.post('/link/v1/sync/ack', input);
62
62
  }
63
+ async reactToMessage(chatId, messageId, emoji) {
64
+ return this.http.post(`/link/v1/chats/${chatId}/messages/${messageId}/react`, { emoji });
65
+ }
63
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msssystems/mss-link-sdk",
3
- "version": "0.2.11",
3
+ "version": "0.2.15",
4
4
  "description": "Official managed application SDK for MSS ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,7 +53,7 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "peerDependencies": {
56
- "@msssystems/mss-crypto-wasm": "^0.1.25",
56
+ "@msssystems/mss-crypto-wasm": "^0.1.26",
57
57
  "@nestjs/common": "^10.0.0 || ^11.0.0",
58
58
  "@nestjs/core": "^10.0.0 || ^11.0.0",
59
59
  "express": "^4.0.0 || ^5.0.0",
@@ -77,7 +77,7 @@
77
77
  }
78
78
  },
79
79
  "devDependencies": {
80
- "@msssystems/mss-crypto-wasm": "^0.1.25",
80
+ "@msssystems/mss-crypto-wasm": "^0.1.28",
81
81
  "@nestjs/common": "^11.0.1",
82
82
  "@nestjs/core": "^11.0.1",
83
83
  "@types/express": "^5.0.0",