From bfbd73fb92f4b7e9fdfd6199880d50bcf47872d8 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Thu, 30 Mar 2023 11:57:29 +0800 Subject: [PATCH] trtc --- sdk/trtc/trtc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/trtc/trtc.go b/sdk/trtc/trtc.go index 12a51e8..8dd2570 100644 --- a/sdk/trtc/trtc.go +++ b/sdk/trtc/trtc.go @@ -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 -- 2.22.0