Commit f2e848f8 authored by chenweijian's avatar chenweijian

trtc

parent 3428baaf
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"git.hilo.cn/hilo-common/mylogrus"
"time" "time"
) )
...@@ -17,6 +18,7 @@ func CreateGroupTRTCUserSig(uid uint64) string { ...@@ -17,6 +18,7 @@ func CreateGroupTRTCUserSig(uid uint64) string {
nowTime := time.Now() nowTime := time.Now()
base64Str := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%d%v%v%v", uid, appId, nowTime.Unix(), expireTimeInSeconds))) 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) userSig := hmacSha256(fmt.Sprintf("%d%v%v%v%v", uid, appId, nowTime.Unix(), expireTimeInSeconds, base64Str), appSecret)
mylogrus.MyLog.Infof("CreateGroupTRTCUserSig uid:%d, token:%s", uid, userSig)
return 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