@tencent-rtc/mcp 1.0.1 → 1.0.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 (29) hide show
  1. package/README.md +38 -37
  2. package/package.json +1 -1
  3. package/resource/doc/chatuikit/android/client_api_Android.md +1373 -0
  4. package/resource/doc/chatuikit/android/generate_UserSig.md +306 -0
  5. package/resource/doc/chatuikit/android/integrarte_only_tuichat_Android.md +290 -0
  6. package/resource/doc/chatuikit/android/integrate_tuikit_Android.md +287 -0
  7. package/resource/doc/chatuikit/android/quick_start_Android.md +138 -0
  8. package/resource/doc/chatuikit/android/show_typing_Android.md +43 -0
  9. package/resource/doc/chatuikit/faq/faq_sdk.md +120 -0
  10. package/resource/doc/chatuikit/faq/generate_UserSig.md +306 -0
  11. package/resource/doc/chatuikit/flutter/client_api_Flutter.md +932 -0
  12. package/resource/doc/chatuikit/flutter/generate_UserSig.md +306 -0
  13. package/resource/doc/chatuikit/flutter/integrate_only_tuichat_Flutter.md +333 -0
  14. package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +769 -0
  15. package/resource/doc/chatuikit/flutter/quick_start_Flutter.md +217 -0
  16. package/resource/doc/chatuikit/iOS/client_api_iOS.md +1121 -0
  17. package/resource/doc/chatuikit/iOS/generate_UserSig.md +306 -0
  18. package/resource/doc/chatuikit/iOS/integrate_only_tuichat_iOS.md +748 -0
  19. package/resource/doc/chatuikit/iOS/integrate_tuikit_iOS.md +852 -0
  20. package/resource/doc/chatuikit/iOS/quick_start_iOS.md +163 -0
  21. package/resource/doc/chatuikit/iOS/show_typing_iOS.md +52 -0
  22. package/resource/doc/chatuikit/react/generate_UserSig.md +306 -0
  23. package/resource/doc/chatuikit/react/integrate_tuichat_only_react.md +202 -0
  24. package/resource/doc/chatuikit/react/integrate_tuichat_react.md +279 -0
  25. package/resource/doc/chatuikit/vue/generate_UserSig.md +306 -0
  26. package/resource/doc/chatuikit/vue/integrate_only_tuichat_Vue_web.md +124 -0
  27. package/resource/doc/chatuikit/vue/integrate_tuikit_Vue_web.md +552 -0
  28. package/server.js +51 -27
  29. package/server.js.map +1 -1
@@ -0,0 +1,306 @@
1
+ This document outlines two authentication methods for Chat services, with a focus on UserSig, a security signature by Tencent Cloud to safeguard against unauthorized access. For basic cloud service usage, provide SDKAppID, UserID, and UserSig during SDK initialization or login.
2
+ - SDKAppID is used to identify your application.
3
+
4
+ - UserID is used to identify your user.
5
+
6
+ - UserSig is a security signature calculated based on the first two using the HMAC SHA256 encryption algorithm. As long as attackers cannot forge the UserSig, they cannot steal your cloud service traffic.
7
+
8
+
9
+ ## Obtaining a Key
10
+ 1. Log in to the [Chat console](https://console.trtc.io/chat).
11
+
12
+
13
+ > **Note: **
14
+ >
15
+
16
+ > If you do not have any app, [create an app](https://intl.cloud.tencent.com/document/product/1047/45914) and then perform [step 2](https://write.woa.com/#step2).
17
+ >
18
+
19
+ 2. Click the target app card to go to its basic configuration page.
20
+
21
+ 3. In the **Basic Information** section, click **Display key** to the right of **Key**.
22
+
23
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100026631907/9da6a1d5f4df11efa823525400e889b2.png)
24
+
25
+ 4. Click **Copy** to copy and save the key information.
26
+
27
+
28
+ > **Note: **
29
+ >
30
+
31
+ > Store the key information properly to prevent disclosure.
32
+ >
33
+
34
+
35
+ ## Calculating UserSig on the Client
36
+
37
+ The `GenerateTestUserSig` open-source module provided in the sample code of the Chat SDK can help you quickly generate a UserSig. You only need to configure three member variables, including SDKAPPID (SDKAppID of the app), EXPIRETIME (UserSig expiration time), and SECRETKEY (key information), and then call the genTestUserSig() function to quickly obtain a UserSig.
38
+
39
+ To simplify this process, we provide the source code for computing a UserSig for the following languages and platforms. You can directly download and integrate the source code into your client.
40
+ <table>
41
+ <tr>
42
+ <td rowspan="1" colSpan="1" >Programing Language</td>
43
+
44
+ <td rowspan="1" colSpan="1" >Platform</td>
45
+
46
+ <td rowspan="1" colSpan="1" >GenerateTestUserSig Source Code</td>
47
+ </tr>
48
+
49
+ <tr>
50
+ <td rowspan="1" colSpan="1" >Java</td>
51
+
52
+ <td rowspan="1" colSpan="1" >Android</td>
53
+
54
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.java](https://github.com/tencentyun/TIMSDK/blob/master/Android/Demo/app/src/main/java/com/tencent/qcloud/tim/demo/signature/GenerateTestUserSig.java)</td>
55
+ </tr>
56
+
57
+ <tr>
58
+ <td rowspan="1" colSpan="1" >Objective-C</td>
59
+
60
+ <td rowspan="1" colSpan="1" >iOS</td>
61
+
62
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.h](https://github.com/tencentyun/TIMSDK/blob/master/iOS/Demo/TUIKitDemo/Private/GenerateTestUserSig.h)</td>
63
+ </tr>
64
+
65
+ <tr>
66
+ <td rowspan="1" colSpan="1" >Objective-C</td>
67
+
68
+ <td rowspan="1" colSpan="1" >Mac</td>
69
+
70
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.h](https://github.com/tencentyun/TIMSDK/blob/master/Mac/Demo/TUIKitDemo/Debug/GenerateTestUserSig.h)</td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <td rowspan="1" colSpan="1" >C++</td>
75
+
76
+ <td rowspan="1" colSpan="1" >Windows</td>
77
+
78
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.h](https://github.com/tencentyun/TIMSDK/blob/master/Windows/Demo/IMApp/GenerateTestUserSig.h)</td>
79
+ </tr>
80
+
81
+ <tr>
82
+ <td rowspan="1" colSpan="1" >Javascript</td>
83
+
84
+ <td rowspan="1" colSpan="1" >Web</td>
85
+
86
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.js](https://github.com/TencentCloud/chat-uikit-uniapp/blob/main/TUIKit/debug/GenerateTestUserSig.js)</td>
87
+ </tr>
88
+
89
+ <tr>
90
+ <td rowspan="1" colSpan="1" >Dart</td>
91
+
92
+ <td rowspan="1" colSpan="1" >Flutter</td>
93
+
94
+ <td rowspan="1" colSpan="1" >[GenerateTestUserSig.dart](https://github.com/TencentCloud/chat-demo-flutter/blob/main/lib/utils/GenerateTestUserSig.dart )</td>
95
+ </tr>
96
+ </table>
97
+
98
+
99
+ > **Note: **
100
+ >
101
+
102
+ > In this method, the `SECRETKEY` is vulnerable to decompilation and reverse engineering. Once your `SECRETKEY` is disclosed, attackers can steal your Tencent Cloud traffic. Therefore, **this method is only suitable for locally running a demo project and feature debugging**.
103
+ The correct way to issue a UserSig is to integrate the UserSig computing code into your server and provide app-oriented APIs. When UserSig is needed, your app will send a request to the business server to obtain a dynamic UserSig. For more information, see [How to Calculate UserSig](https://write.woa.com/#GeneratingdynamicUserSig).
104
+ >
105
+
106
+
107
+ ## Calculating UserSig on the Server
108
+
109
+ Generating a UserSig on the server provides maximum protection against the disclosure of the key used for calculating the UserSig. You only need to deploy the code for calculating the UserSig on your server and provide an app-oriented API. When a UserSig is needed, your app will send a request to the business server to obtain a dynamic UserSig.
110
+ To simplify this process, we provide the source code for calculating a UserSig for the following languages and platforms. You can directly download and integrate the source code into your server.
111
+ <table>
112
+ <tr>
113
+ <td rowspan="1" colSpan="1" >Programming Language</td>
114
+
115
+ <td rowspan="1" colSpan="1" >Key Function</td>
116
+
117
+ <td rowspan="1" colSpan="1" >Download URL</td>
118
+ </tr>
119
+
120
+ <tr>
121
+ <td rowspan="1" colSpan="1" >Java</td>
122
+
123
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
124
+
125
+ <td rowspan="1" colSpan="1" >[genSig](https://github.com/Tencent-RTC/tls-sig-api-v2-java/blob/main/src/main/java/com/tencentcloud/TLSSigAPIv2.java)</td>
126
+ </tr>
127
+
128
+ <tr>
129
+ <td rowspan="1" colSpan="1" >GO</td>
130
+
131
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
132
+
133
+ <td rowspan="1" colSpan="1" >[GenSig](https://github.com/Tencent-RTC/tls-sig-api-v2-golang/blob/main/tencentyun/TLSSigAPI.go)</td>
134
+ </tr>
135
+
136
+ <tr>
137
+ <td rowspan="1" colSpan="1" >PHP</td>
138
+
139
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
140
+
141
+ <td rowspan="1" colSpan="1" >[genSig](https://github.com/Tencent-RTC/tls-sig-api-v2-php/blob/main/src/TLSSigAPIv2.php)</td>
142
+ </tr>
143
+
144
+ <tr>
145
+ <td rowspan="1" colSpan="1" >Nodejs</td>
146
+
147
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
148
+
149
+ <td rowspan="1" colSpan="1" >[genSig](https://github.com/Tencent-RTC/tls-sig-api-v2-node/blob/main/TLSSigAPIv2.js)</td>
150
+ </tr>
151
+
152
+ <tr>
153
+ <td rowspan="1" colSpan="1" >Python</td>
154
+
155
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
156
+
157
+ <td rowspan="1" colSpan="1" >[gen_sig](https://github.com/Tencent-RTC/tls-sig-api-v2-python/blob/main/TLSSigAPIv2.py)</td>
158
+ </tr>
159
+
160
+ <tr>
161
+ <td rowspan="1" colSpan="1" >C#</td>
162
+
163
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
164
+
165
+ <td rowspan="1" colSpan="1" >[GenSig](https://github.com/Tencent-RTC/tls-sig-api-v2-cs/blob/main/tls-sig-api-v2-cs/TLSSigAPIv2.cs)</td>
166
+ </tr>
167
+
168
+ <tr>
169
+ <td rowspan="1" colSpan="1" >C++</td>
170
+
171
+ <td rowspan="1" colSpan="1" >HMAC-SHA256</td>
172
+
173
+ <td rowspan="1" colSpan="1" >[gen_sig](https://github.com/Tencent-RTC/tls-sig-api-v2-cpp)</td>
174
+ </tr>
175
+ </table>
176
+
177
+
178
+ Key fields in a UserSig calculation function include the SDKAppID, UserID, and UserSig validity period, as described in the following table.
179
+
180
+ > **Note: **
181
+ >
182
+
183
+ > The following table uses the field names in the Java source code as an example. The field names may be different in other languages.
184
+ >
185
+
186
+ <table>
187
+ <tr>
188
+ <td rowspan="1" colSpan="1" >Field Name (Example)</td>
189
+
190
+ <td rowspan="1" colSpan="1" >Description</td>
191
+ </tr>
192
+
193
+ <tr>
194
+ <td rowspan="1" colSpan="1" >sdkappid</td>
195
+
196
+ <td rowspan="1" colSpan="1" >SDKAppID of the app. You can obtain the SDKAppID on the app card in the [Chat console](https://console.trtc.io/chat).</td>
197
+ </tr>
198
+
199
+ <tr>
200
+ <td rowspan="1" colSpan="1" >userId</td>
201
+
202
+ <td rowspan="1" colSpan="1" >User ID (former name: `Identifier`).</td>
203
+ </tr>
204
+
205
+ <tr>
206
+ <td rowspan="1" colSpan="1" >expire</td>
207
+
208
+ <td rowspan="1" colSpan="1" >UserSig validity period, in seconds.</td>
209
+ </tr>
210
+
211
+ <tr>
212
+ <td rowspan="1" colSpan="1" >userbuf</td>
213
+
214
+ <td rowspan="1" colSpan="1" >This field is set to `null` by default because APIs without UserBuf are used in Chat by default.APIs with UserBuf may be required in some TRTC use cases, for example, when entering a room. For more information, see [Enabling Advanced Permission Control](https://intl.cloud.tencent.com/document/product/647/35157).</td>
215
+ </tr>
216
+
217
+ <tr>
218
+ <td rowspan="1" colSpan="1" >key</td>
219
+
220
+ <td rowspan="1" colSpan="1" >Key. You can obtain a key on the app details page in the [Chat console](https://console.trtc.io/chat). For more information, see [Obtaining a Key](https://write.woa.com/#getkey).</td>
221
+ </tr>
222
+ </table>
223
+
224
+
225
+ ## Old Version of Algorithm
226
+
227
+ To simplify signature computing so that customers can conveniently and quickly use Tencent Cloud services, the signature algorithm of the Chat service has been upgraded from ECDSA-SHA256 to HMAC-SHA256 since July 19, 2019. This means that all SDKAppIDs created after July 19, 2019 will use the new HMAC-SHA256 algorithm.
228
+
229
+ If your SDKAppID was created before July 19, 2019, we recommend that you upgrade the signature algorithm to [HMAC-SHA256](https://write.woa.com/#GeneratingdynamicUserSig). The upgrade will not affect your business. Alternatively, you can still use the signature algorithm of an earlier version. The URLs for downloading the source code for the ECDSA-SHA256 algorithm are as follows:
230
+ <table>
231
+ <tr>
232
+ <td rowspan="1" colSpan="1" >Programming Language</td>
233
+
234
+ <td rowspan="1" colSpan="1" >Signature Algorithm</td>
235
+
236
+ <td rowspan="1" colSpan="1" >Download Link</td>
237
+ </tr>
238
+
239
+ <tr>
240
+ <td rowspan="1" colSpan="1" >Java</td>
241
+
242
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
243
+
244
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-java)</td>
245
+ </tr>
246
+
247
+ <tr>
248
+ <td rowspan="1" colSpan="1" >GO</td>
249
+
250
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
251
+
252
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-golang)</td>
253
+ </tr>
254
+
255
+ <tr>
256
+ <td rowspan="1" colSpan="1" >PHP</td>
257
+
258
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
259
+
260
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-php)</td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <td rowspan="1" colSpan="1" >Nodejs</td>
265
+
266
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
267
+
268
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-node)</td>
269
+ </tr>
270
+
271
+ <tr>
272
+ <td rowspan="1" colSpan="1" >Python</td>
273
+
274
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
275
+
276
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-python)</td>
277
+ </tr>
278
+
279
+ <tr>
280
+ <td rowspan="1" colSpan="1" >C#</td>
281
+
282
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
283
+
284
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api-cs)</td>
285
+ </tr>
286
+
287
+ <tr>
288
+ <td rowspan="1" colSpan="1" >C++</td>
289
+
290
+ <td rowspan="1" colSpan="1" >ECDSA-SHA256</td>
291
+
292
+ <td rowspan="1" colSpan="1" >[GitHub](https://github.com/tencentyun/tls-sig-api)</td>
293
+ </tr>
294
+ </table>
295
+
296
+
297
+ ## Get UserSig from the console
298
+ - Log in to Tencent-RTC Console, navigate to Development Tools > [UserSig Tools](https://console.trtc.io/usersig).
299
+
300
+ - Under the UserSig Generation Tool, select the corresponding SDKAppID and UserID.
301
+
302
+ - Click the Generate button to compute the corresponding UserSig.
303
+
304
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100026631907/bf1ed039f4df11ef920e5254005ef0f7.png)
305
+
306
+
@@ -0,0 +1,124 @@
1
+ ## Applicable Scenario
2
+
3
+ Web & H5 platform, enabling independent integration of private messaging (1V1) or group chat (Group), such as real estate consultations, e-commerce customer service, and remote insurance claims assessment.
4
+
5
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027119864/67bfc1a7428911efbc2f52540055f650.png)
6
+
7
+ ## Environment Requirements
8
+ - Vue (Comprehensively supports both Vue2 & Vue3. Please select the Vue version guide that matches your needs for integration below)
9
+
10
+ - TypeScript (If you have a JS project, please refer to [How to Integrate TUIKit Components in a JS Project](https://write.woa.com/document/134592754616455168) for progressive support for TS)
11
+
12
+ - Sass (sass-loader version ≤ 10.1.1)
13
+
14
+ - node(node.js ≥ 16.0.0)
15
+
16
+ - npm (use a version that matches the Node version in use)
17
+
18
+
19
+ ## Integration Guide
20
+
21
+ Follow the steps in [Integrating TUIKit](https://write.woa.com/document/134592754616455168). After completing these steps, you need to configure TUIChat as follows.
22
+
23
+ ### Integrate <TUIChat>
24
+
25
+ ##### Import the TUIChat component on the page where it is needed.
26
+
27
+ ##### For example, implement the following code in App.vue to quickly set up the chat interface and initiate a specified session:
28
+
29
+ > **Note:**
30
+ >
31
+
32
+ > conversationID:Session ID. The composition of the Session ID is as follows:
33
+ >
34
+ > - C2C${userID} (for one-on-one chats), for example `C2C123456`
35
+ > - GROUP${groupID} (for group chats), for example `GROUP123456`
36
+
37
+ ``` javascript
38
+ <template>
39
+ <div id="app">
40
+ <TUIKit
41
+ :SDKAppID="0"
42
+ userID="YOUR_USERID"
43
+ userSig="YOUR_USERSIG"
44
+ conversationID="YOUR_CONVERSATIONID"
45
+ :style="{ width: '500px', height: '800px', margin: '0 auto', boxShadow: '0 11px 20px #ccc' }"
46
+ >
47
+ <TUIChat><h1>Welcome to Tencent Cloud Chat</h1></TUIChat>
48
+ </TUIKit>
49
+ </div>
50
+ </template>
51
+ <script lang="ts" setup>
52
+ import { TUIKit, TUIChat } from "./TUIKit";
53
+ </script>
54
+ <style lang="scss"></style>
55
+ ```
56
+
57
+ ### Initiate the project
58
+
59
+ Execute the following command to initiate the project:
60
+
61
+
62
+
63
+ 【vue-cli】
64
+
65
+ > **Note:**
66
+ >
67
+
68
+ > Since vue-cli enables Webpack Global Overlay Error Message Prompt by default, for a better experience, **it is recommended to disable the global overlay error prompt**.
69
+ >
70
+
71
+ >
72
+
73
+ 【webpack4】
74
+ > `module.exports = defineConfig({`
75
+ > ` devServer: {`
76
+ > ` client: {`
77
+ > ` overlay: false,`
78
+ > ` },`
79
+ > ` },`
80
+ > `});`
81
+
82
+ 【webpack3】
83
+ > `module.exports = {`
84
+ > ` devServer: {`
85
+ > ` overlay: false,`
86
+ > ` },`
87
+ > `};`
88
+ >
89
+
90
+
91
+
92
+ 【shell】
93
+ ``` bash
94
+ npm run serve
95
+ ```
96
+
97
+ 【vite】
98
+
99
+
100
+ 【shell】
101
+ ``` bash
102
+ npm run dev
103
+ ```
104
+
105
+ ## FAQs
106
+
107
+ Please click [FAQs](https://write.woa.com/document/134592754616455168) to view the solution.
108
+
109
+ ## Documentation
110
+
111
+ #### Related to Vue2 & Vue3 UIKit:
112
+ - [chat-uikit-vue npm](https://www.npmjs.com/package/@tencentcloud/chat-uikit-vue)
113
+
114
+ - [Vue3 Demo Source Code and Launch Example](https://github.com/TencentCloud/chat-uikit-vue/tree/main/Vue2/Demo)
115
+
116
+ - [Vue3 Demo Source Code and Launch Example](https://github.com/TencentCloud/chat-uikit-vue/tree/main/Vue3/Demo)
117
+
118
+
119
+ ## Exchange and Feedback
120
+
121
+ Join the [Telegram technical exchange group](https://t.me/tencent_imsdk) or [WhatsApp discussion group](https://chat.whatsapp.com/IVa11ZkVmKTEwSWsAzSyik), benefit from the support of professional engineers, and solve your toughest challenges.
122
+
123
+
124
+