You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
346 B
17 lines
346 B
package dingtalk
|
|
|
|
import (
|
|
"crypto/hmac"
|
|
"crypto/sha256"
|
|
"encoding/base64"
|
|
"fmt"
|
|
)
|
|
|
|
func (c *Client) sign(t int64) string {
|
|
secStr := fmt.Sprintf("%d\n%s", t, c.GetSecret())
|
|
hmac256 := hmac.New(sha256.New, []byte(c.GetSecret()))
|
|
hmac256.Write([]byte(secStr))
|
|
result := hmac256.Sum(nil)
|
|
return base64.StdEncoding.EncodeToString(result)
|
|
}
|