skip to main content
Browse documentation

Ruby

Verify Syncanix agent intents in Ruby — Rails and any Rack app — with a local HMAC check on every tool call.

The Ruby SDK offers a Rails controller concern and Rack middleware over a shared VerifyIntent core. Include the concern on your tools controller and read the verified payload from the intent it exposes.

Install

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

bundle add syncanix-sdk-rails

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.

class ToolsController < ApplicationController
  include SyncanixSdk::Rails::VerifyIntentConcern
  syncanix_verify_intent secret: ENV['SYNCANIX_INTENT_SECRET']

  def refund
    render json: { tenantId: @syncanix_intent.tenant_id }
  end
end
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