1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add generic webhook integration

This commit is contained in:
Frédéric Guillot 2023-09-08 22:45:17 -07:00
parent 32d33104a4
commit 48f6885f44
39 changed files with 527 additions and 324 deletions

View file

@ -4,6 +4,7 @@
package crypto // import "miniflux.app/v2/internal/crypto"
import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
@ -48,3 +49,9 @@ func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(bytes), err
}
func GenerateSHA256Hmac(secret string, data []byte) string {
h := hmac.New(sha256.New, []byte(secret))
h.Write(data)
return hex.EncodeToString(h.Sum(nil))
}