skip to main content
Browse documentation

Go

Verify Syncanix agent intents in Go — net/http, Gin, Echo, and Fiber — with a local HMAC check on every tool call.

The Go SDK ships middleware for net/http, Gin, Echo, and Fiber, plus a VerifyIntent core you can call directly. Register it on your tool routes and read the verified payload from the request context.

Install

Add the package to your project with your language's package manager.

go get github.com/syncanix-ai/syncanix-sdk-go

Configure the secret

The SDK verifies intents with your tenant's intent-signing secret. Store it as an environment variable — never commit it to source control — and load it where you register the SDK.

export SYNCANIX_INTENT_SECRET="your-intent-signing-secret"

Verify intents

Register the SDK on the routes that expose agent actions. It verifies the X-Syncanix-Intent header before your handler runs, rejects any invalid or replayed call with a 403, and hands your handler the verified payload — including the acting tenant and user.

r := gin.Default()
r.Use(syncanix.GinMiddleware(os.Getenv("SYNCANIX_INTENT_SECRET"), nil))

r.POST("/tools/refund", func(c *gin.Context) {
    payload, _ := c.MustGet(syncanix.GinIntentKey).(*syncanix.IntentPayload)
    c.JSON(200, gin.H{"tenantId": payload.TenantID})
})
Verifying an intent on a tool route. On success the verified payload is available to your handler; on failure the SDK returns 403 before your code runs.

Next steps