Integration guides
Go
Complete path for a Go backend with the standard library only.
go/ of the examples repo uses the standard library only (Go 1.22+): net/http, crypto/hmac, encoding/json. Routes: POST /reports, GET /me/moderation-status, POST /devices/request-hash, POST /devices/check, POST /limenia/webhook. Files: main.go (config), server.go (routes, login stub currentUser), limenia.go (client with retries, request hash), signature.go, webhook.go (events), actions.go (placeholders).
cd limenia-examples/go && go test ./...
set -a; . ./.env; set +a # .env filled in by the user from .env.example
go run . # PORT defaults to 8080Signature check
From signature.go:
const SignatureTolerance = 300 * time.Second
func VerifySignature(header string, body []byte, now time.Time, secrets ...string) error {
if header == "" {
return ErrMissingSignature
}
var ts string
seenT := false
var sigs [][]byte
for _, part := range strings.Split(header, ",") {
key, value, ok := strings.Cut(strings.TrimSpace(part), "=")
if !ok {
return ErrMalformedSignature
}
switch key {
case "t":
if seenT { // t must appear exactly once
return ErrMalformedSignature
}
seenT, ts = true, value
case "v1":
if sig, err := hex.DecodeString(value); err == nil {
sigs = append(sigs, sig)
}
}
}
unix, err := strconv.ParseInt(ts, 10, 64)
if !seenT || err != nil || unix < 0 || len(sigs) == 0 {
return ErrMalformedSignature
}
if d := now.Sub(time.Unix(unix, 0)); d > SignatureTolerance || d < -SignatureTolerance {
return ErrTimestampOutOfRange
}
for _, secret := range secrets {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(ts + "."))
mac.Write(body)
want := mac.Sum(nil)
for _, sig := range sigs {
if hmac.Equal(sig, want) { // constant time
return nil
}
}
}
return ErrSignatureMismatch
}Read the body with io.ReadAll(http.MaxBytesReader(w, r.Body, 1<<20)) and verify before json.Unmarshal. Secrets come from LIMENIA_WEBHOOK_SECRET and, while rotating, LIMENIA_WEBHOOK_SECRET_PREVIOUS.
Complaints and reviews
The Go example has no routes for complaints and reviews. Add them like POST /reports: take the user from your login, forward to POST /v1/appeals or POST /v1/reviews with an Idempotency-Key, and store the returned ID with the user. See Complaints and Pre-moderation reviews.