Go SDK

Official SDKs

Go SDK

Pure Go 1.21+ client, standard library only — crypto/ecdsa handles offline token verification natively, so unlike SDKs built on OpenSSL/PHP-openssl/Python cryptography this needs no raw-signature-to-DER conversion step. No third-party packages at all.

Download Go SDK (ZIP)

Installation

Not yet published as a tagged Go module — download the source ZIP above, extract it, then add a replace directive to your own go.mod pointing at the extracted folder:

require github.com/permitCore-spec/permitcore-sdk-go v0.0.0

replace github.com/permitCore-spec/permitcore-sdk-go => ./permitcore-sdk-go

Quick start — validate

import "github.com/permitCore-spec/permitcore-sdk-go"

client := permitcore.New("https://api.permitcore.dev")
result := client.Validate("PERMIT-XXXX-XXXX-XXXX-XXXX", "")

if !result.IsValid {
	log.Fatalf("License invalid: %s", result.Message)
}

if result.HasFeature("export") {
	enableExport()
}

Activate (call once per installation)

result := client.Activate(
	"PERMIT-XXXX-XXXX-XXXX-XXXX",
	"",                   // deviceId — auto-generated HWID when empty
	"Production Server #1", // deviceName
	"",                   // version, optional
)
if !result.IsValid {
	log.Fatalf("Activation failed: %s", result.Message)
}
// Save result.IsValid to local storage — use Validate() on every subsequent launch.

Metered billing

// Record a single event
client.Meter(licenseKey, "api_call", 1, nil)

// Record bulk usage with metadata
client.Meter(licenseKey, "export", 5, map[string]any{"format": "pdf", "pages": 12})

Floating licenses

// Check out a seat at session start
session := client.Checkout(licenseKey, "", "")
if !session.Success {
	log.Fatalf("No seats available: %s", session.Message)
}
token := session.SessionToken

// Heartbeat every 4-5 minutes to keep the seat alive
client.Heartbeat(token)

// Release the seat when done
client.Checkin(token)

Offline grace period

result := client.Validate(licenseKey, "") // falls back to disk cache automatically

if result.IsOffline {
	// Running on cached result — server unreachable
	showNotice("Running offline. Connect to refresh your license.")
}

Offline license tokens

No extra package needed — crypto/ecdsa is standard library. Verification is pure local ECDSA P-256/SHA-256, zero network calls:

result := permitcore.VerifyOfflineToken(token, publicKeyBase64)

if result.IsValid {
	fmt.Println("Valid! Product:", result.Payload.ProductName)
}

// Bind to this device + persist locally (call once, e.g. at install time)
result = permitcore.ActivateOffline(token, publicKeyBase64, deviceID)

// On every later launch — no token needed, reads the local cache
result = permitcore.ValidateOffline(deviceID)

LicenseResult reference

FieldTypeDescription
IsValidboolTrue if the license is active and valid
ProductNamestringProduct the license belongs to
RemainingActivations*intActivation slots remaining
ExpiresAtstringISO 8601 expiry date, empty = perpetual
Features[]stringFeature flag list, e.g. ["export","api"]
IsTrialboolTrue for trial licenses
TrialDaysRemaining*intDays until trial expires
NodeLockedboolTrue if bound to a specific device
OfflineGraceDays*intHow many days the cache remains valid
MinVersion / MaxVersionstringVersion enforcement bounds
VendorWarningstringNon-fatal message from the vendor
MessagestringReason when IsValid == false
IsOfflineboolTrue when result came from local cache
ErrorCodestringStable, machine-readable failure reason

HasFeature(feature string) bool — case-insensitive check whether a feature flag is present on the license.

Try it live: the downloadable Task Manager Pro demo includes a working Go build gated behind a real license, plus a developer console panel that exercises every SDK call (validate, activate, offline tokens, floating checkout) against your own PermitCore instance.