mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-28 16:55:32 +00:00
Webhook-Endpoint
This commit is contained in:
@@ -30,13 +30,11 @@ func PostWebhook(cfg config.Config) fiber.Handler {
|
||||
|
||||
commit, err := gitprovider.Pull(dir, cfg.GitURL, cfg.GitBranch)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return c.SendStatus(fiber.StatusInternalServerError)
|
||||
}
|
||||
|
||||
_, err = xmlmodels.Parse(dir, commit.Hash)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return c.SendStatus(fiber.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -44,12 +42,6 @@ func PostWebhook(cfg config.Config) fiber.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
func sign256(secret, body []byte) []byte {
|
||||
computed := hmac.New(sha256.New, secret)
|
||||
computed.Write(body)
|
||||
return []byte(computed.Sum(nil))
|
||||
}
|
||||
|
||||
func verifySignature256(secret, payload []byte, header string) bool {
|
||||
if !strings.HasPrefix(header, SIGNATURE_PREFIX) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user