github.com/qiniu/go-sdk/v7@v7.27.0/auth/qbox/qbox_auth.go (about)

     1  package qbox
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/qiniu/go-sdk/v7/auth"
     7  )
     8  
     9  type Mac = auth.Credentials
    10  
    11  // 兼容保留
    12  func NewMac(accessKey, secretKey string) *Mac {
    13  	return auth.New(accessKey, secretKey)
    14  }
    15  
    16  // Sign 一般用于下载凭证的签名
    17  func Sign(mac *Mac, data []byte) string {
    18  	return mac.Sign(data)
    19  }
    20  
    21  // SignWithData 一般用于上传凭证的签名
    22  func SignWithData(mac *Mac, data []byte) string {
    23  	return mac.SignWithData(data)
    24  }
    25  
    26  // VerifyCallback 验证上传回调请求是否来自七牛
    27  func VerifyCallback(mac *Mac, req *http.Request) (bool, error) {
    28  	return mac.VerifyCallback(req)
    29  }