You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is the python implementation of tls-sig-api-v2. Previous asymmetric keys cannot use APIs of this version. To enable them to use APIs of this version,[see here](https://github.com/tencentyun/tls-sig-api-python)。
3
+
4
+
## integration
5
+
It can be integrated using pip or source code.
6
+
7
+
### pip
8
+
```shell
9
+
pip install tls-sig-api-v2
10
+
```
11
+
12
+
### source code
13
+
Just download the file `TLSSigAPIv2.py` to the local.
14
+
15
+
## use
16
+
17
+
```python
18
+
import TLSSigAPIv2
19
+
20
+
api = TLSSigAPIv2.TLSSigAPIv2(1400000000, '5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e')
##It is used to generate real-time audio and video (TRTC) business access rights encryption string. For specific usage, please refer to the TRTC document:https://cloud.tencent.com/document/product/647/32240
55
+
# User-defined userbuf is used for the encrypted string of TRTC service entry permission
56
+
# @brief generate userbuf
57
+
# @param account username
58
+
# @param dwSdkappid sdkappid
59
+
# @param dwAuthID digital room number
60
+
# @param dwExpTime Expiration time: The expiration time of the encrypted string of this permission. Expiration time = now+dwExpTime
61
+
# @param dwPrivilegeMap User permissions, 255 means all permissions
# Used to issue PrivateMapKey that is optional for room entry.
209
+
# PrivateMapKey must be used together with UserSig but with more powerful permission control capabilities.
210
+
# - UserSig can only control whether a UserID has permission to use the TRTC service. As long as the UserSig is correct, the user with the corresponding UserID can enter or leave any room.
211
+
# - PrivateMapKey specifies more stringent permissions for a UserID, including whether the UserID can be used to enter a specific room and perform audio/video upstreaming in the room.
212
+
# To enable stringent PrivateMapKey permission bit verification, you need to enable permission key in TRTC console > Application Management > Application Info.
213
+
# *
214
+
# Parameter description:
215
+
# userid - User ID. The value can be up to 32 bytes in length and contain letters (a-z and A-Z), digits (0-9), underscores (_), and hyphens (-).
216
+
# roomid - ID of the room to which the specified UserID can enter.
217
+
# expire - PrivateMapKey expiration time, in seconds. For example, 86400 indicates that the generated PrivateMapKey will expire one day after being generated.
218
+
# privilegeMap - Permission bits. Eight bits in the same byte are used as the permission switches of eight specific features:
219
+
# - Bit 1: 0000 0001 = 1, permission for room creation
220
+
# - Bit 2: 0000 0010 = 2, permission for room entry
221
+
# - Bit 3: 0000 0100 = 4, permission for audio sending
222
+
# - Bit 4: 0000 1000 = 8, permission for audio receiving
223
+
# - Bit 5: 0001 0000 = 16, permission for video sending
224
+
# - Bit 6: 0010 0000 = 32, permission for video receiving
225
+
# - Bit 7: 0100 0000 = 64, permission for substream video sending (screen sharing)
226
+
# - Bit 8: 1000 0000 = 200, permission for substream video receiving (screen sharing)
227
+
# - privilegeMap == 1111 1111 == 255: Indicates that the UserID has all feature permissions of the room specified by roomid.
228
+
# - privilegeMap == 0010 1010 == 42: Indicates that the UserID has only the permissions to enter the room and receive audio/video data.
# Used to issue PrivateMapKey that is optional for room entry.
263
+
# PrivateMapKey must be used together with UserSig but with more powerful permission control capabilities.
264
+
# - UserSig can only control whether a UserID has permission to use the TRTC service. As long as the UserSig is correct, the user with the corresponding UserID can enter or leave any room.
265
+
# - PrivateMapKey specifies more stringent permissions for a UserID, including whether the UserID can be used to enter a specific room and perform audio/video upstreaming in the room.
266
+
# To enable stringent PrivateMapKey permission bit verification, you need to enable permission key in TRTC console > Application Management > Application Info.
267
+
# *
268
+
# Parameter description:
269
+
# @param userid - User ID. The value can be up to 32 bytes in length and contain letters (a-z and A-Z), digits (0-9), underscores (_), and hyphens (-).
270
+
# @param roomstr - ID of the room to which the specified UserID can enter.
271
+
# @param expire - PrivateMapKey expiration time, in seconds. For example, 86400 indicates that the generated PrivateMapKey will expire one day after being generated.
272
+
# @param privilegeMap - Permission bits. Eight bits in the same byte are used as the permission switches of eight specific features:
273
+
# - Bit 1: 0000 0001 = 1, permission for room creation
274
+
# - Bit 2: 0000 0010 = 2, permission for room entry
275
+
# - Bit 3: 0000 0100 = 4, permission for audio sending
276
+
# - Bit 4: 0000 1000 = 8, permission for audio receiving
277
+
# - Bit 5: 0001 0000 = 16, permission for video sending
278
+
# - Bit 6: 0010 0000 = 32, permission for video receiving
279
+
# - Bit 7: 0100 0000 = 64, permission for substream video sending (screen sharing)
280
+
# - Bit 8: 1000 0000 = 200, permission for substream video receiving (screen sharing)
281
+
# - privilegeMap == 1111 1111 == 255: Indicates that the UserID has all feature permissions of the room specified by roomid.
282
+
# - privilegeMap == 0010 1010 == 42: Indicates that the UserID has only the permissions to enter the room and receive audio/video data.
0 commit comments