(secret []byte, username string, expire int64)
| 147 | } |
| 148 | |
| 149 | func CalculateHMACSignature(secret []byte, username string, expire int64) []byte { |
| 150 | mac := hmac.New(sha256.New, secret) |
| 151 | mac.Write([]byte(HMACSignaturePrefix)) |
| 152 | mac.Write([]byte(username)) |
| 153 | binary.Write(mac, binary.BigEndian, expire) |
| 154 | return mac.Sum(nil) |
| 155 | } |