Commit 203578f4 authored by chenweijian's avatar chenweijian

trtc

parent 23862335
package trtc
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"fmt"
"git.hilo.cn/hilo-common/mylogrus"
)
......@@ -13,9 +10,6 @@ func CreateGroupTRTCUserSig(uid uint64) string {
appId := 1400548270
appSecret := "321bd60f73096b059c7350f1cd97d51028850b34fa58c5c0d26bb4a19e783de8"
expireTimeInSeconds := 60 * 60 * 24 * 7 //一个星期
//nowTime := time.Now()
//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)
sig, err := GenUserSig(appId, appSecret, fmt.Sprintf("%d", uid), expireTimeInSeconds)
if err != nil {
......@@ -25,9 +19,3 @@ func CreateGroupTRTCUserSig(uid uint64) string {
return sig
}
func hmacSha256(data string, secret string) string {
h := hmac.New(sha256.New, []byte(secret))
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}
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