Commit bfbd73fb authored by chenweijian's avatar chenweijian

trtc

parent f2e848f8
......@@ -16,8 +16,8 @@ func CreateGroupTRTCUserSig(uid uint64) string {
appSecret := "321bd60f73096b059c7350f1cd97d51028850b34fa58c5c0d26bb4a19e783de8"
expireTimeInSeconds := uint32(60 * 60 * 24 * 7) //一个星期
nowTime := time.Now()
base64Str := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%d%v%v%v", uid, appId, nowTime.Unix(), expireTimeInSeconds)))
userSig := hmacSha256(fmt.Sprintf("%d%v%v%v%v", uid, appId, nowTime.Unix(), expireTimeInSeconds, base64Str), appSecret)
base64Str := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%d\n%v\n%v\n%v", uid, appId, nowTime.Unix(), expireTimeInSeconds)))
userSig := hmacSha256(fmt.Sprintf("%d\n%v\n%v\n%v\n%v", uid, appId, nowTime.Unix(), expireTimeInSeconds, base64Str), appSecret)
mylogrus.MyLog.Infof("CreateGroupTRTCUserSig uid:%d, token:%s", uid, userSig)
return userSig
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment