STAGING — non-production environment. Billing is disabled; data may be wiped at any time.

Go

Go 1.21+. Standard library only.

Install

mkdir -p .geckoguard-sdk
curl -L https://geckoguard.net/downloads/sdk/v1.3.0/geckoguard-sdk-1.3.0-source.tar.gz | tar -xz -C .geckoguard-sdk
go mod edit -require=github.com/GeckoGuard/GeckoSDK/go@v1.3.0
go mod edit -replace=github.com/GeckoGuard/GeckoSDK/go=./.geckoguard-sdk/go

This vendors the reviewed historical v1.3.0 preview source. The first official coordinated release is planned as v1.0.0 and remains on hold.

import geckoguard "github.com/GeckoGuard/GeckoSDK/go"

Quick start

package main

import (
    "context"
    "errors"
    "log"
    "time"

    geckoguard "github.com/GeckoGuard/GeckoSDK/go"
)

func main() {
    client, err := geckoguard.NewClient("gg_live_...", "your-product-uuid", geckoguard.WithSigningSecret("your-signing-secret"))
    if err != nil {
        log.Fatal(err)
    }

    ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
    defer cancel()

    resp, err := client.Authorize(ctx, "LICENSE-KEY-123", nil)
    var denied *geckoguard.LicenseDeniedError
    if errors.As(err, &denied) {
        log.Fatalf("denied: %s", denied.ReasonCode)
    }
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("allowed: %v", resp.Allow)
}

The returned *Client is safe for concurrent use.

Configuration

client, err := geckoguard.NewClient("gg_live_...", "your-product-uuid",
    geckoguard.WithBaseURL("https://api.geckoguard.net"),
    geckoguard.WithSigningSecret("..."),     // enable HMAC request signing
    geckoguard.WithHTTPClient(customClient), // custom timeouts / proxy
)

For the full method list and endpoint reference, see the API Reference.

For long-running applications, follow the session lifecycle and heartbeat requirements.