Add the runnable Gitea, PostgreSQL, and Hop control-plane foundation

Hop-State: A_06FN3QYA1N56NQYGZ81DWGR
Hop-Proposal: R_06FN3QXJRYPPEQZQA6S69QG
Hop-Task: T_06FN3MVGY3MT82ESQ89BND0
Hop-Attempt: AT_06FN3MVGY092BFA5MR9C7EG
This commit is contained in:
Hop
2026-07-11 08:50:48 -07:00
parent dd2c0abfd2
commit d9544b435b
22 changed files with 1114 additions and 0 deletions
@@ -0,0 +1,25 @@
package gitea
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"testing"
)
func TestVerifySignature(t *testing.T) {
body := []byte(`{"hello":"hop"}`)
mac := hmac.New(sha256.New, []byte("secret"))
_, _ = mac.Write(body)
signature := hex.EncodeToString(mac.Sum(nil))
if !VerifySignature(body, signature, "secret") {
t.Fatal("expected valid signature")
}
if VerifySignature(body, signature, "wrong") {
t.Fatal("accepted signature with wrong secret")
}
if VerifySignature(body, "not-hex", "secret") {
t.Fatal("accepted malformed signature")
}
}