- the same resource can sometimes be downloaded and sometimes cannot be downloaded. (currently, it is found that the current), key is uploaded and stored in our mysql table. When I download it, I take the key, from the table and splice the download link.
func (mac * Mac) Sign (data [] byte) (token string) {
h := hmac.New(sha1.New, mac.SecretKey)
h.Write(data)
sign := base64.URLEncoding.EncodeToString(h.Sum(nil))
return fmt.Sprintf("%s:%s", mac.AccessKey, sign)
}
code is encoded using secure urlbase64.
I copy the link to the browser and I can see