$_tuish

Install the SDK

Installing and configuring the Tuish SDK for your language

Install the SDK

This guide covers installation and configuration for all supported languages.

Installation

npm install @tuish/sdk

Or with your preferred package manager:

pnpm add @tuish/sdk
yarn add @tuish/sdk
go get github.com/tuish/sdk-go

Requirements: Go 1.21 or later

Add to your Cargo.toml:

[dependencies]
tuish = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Requirements: Rust 1.70 or later, Tokio runtime (for async operations)

Feature Flags

The SDK uses feature flags to minimize binary size:

# Default: all features enabled
tuish = "0.1"

# Minimal: offline verification only
tuish = { version = "0.1", default-features = false }

# Custom: pick what you need
tuish = { version = "0.1", default-features = false, features = ["storage", "http"] }
FeatureDefaultDependencies AddedUse Case
httpYesreqwest, tokioOnline validation, purchases
storageYesdirsLocal license caching
browserYesopenBrowser checkout flow
pip install tuish

Or with your preferred package manager:

poetry add tuish
pipenv install tuish

Requirements: Python 3.9 or later

Configuration

import { Tuish } from '@tuish/sdk';

const tuish = new Tuish({
  // Required
  productId: 'prod_xxx',
  publicKey: 'MCowBQYDK2VwAyEA...',  // Ed25519 public key

  // Optional
  apiBaseUrl: 'https://tuish-api-production.doug-lance.workers.dev',  // Custom API URL
  apiKey: 'tuish_sk_...',               // For authenticated requests
  storageDir: '~/.tuish/licenses/',     // Custom storage directory
  debug: false,                         // Enable debug logging
});

Configuration Options

OptionTypeDefaultDescription
productIdstringRequiredYour product ID
publicKeystringRequiredEd25519 public key for offline verification
apiBaseUrlstringhttps://tuish-api-production.doug-lance.workers.devAPI base URL
apiKeystringundefinedAPI key for authenticated requests
storageDirstring~/.tuish/licenses/License cache directory
debugbooleanfalseEnable debug logging
import tuish "github.com/tuish/sdk-go"

sdk, err := tuish.New(tuish.Config{
    // Required
    ProductID: "prod_xxx",
    PublicKey: "MCowBQYDK2VwAyEA...",

    // Optional
    APIBaseURL: "https://tuish-api-production.doug-lance.workers.dev",
    APIKey:     "tuish_sk_...",
    StorageDir: "~/.tuish/licenses/",
    Debug:      false,
})

Configuration Options

OptionTypeDefaultDescription
ProductIDstringRequiredYour product ID
PublicKeystringRequiredEd25519 public key (SPKI base64 or hex)
APIBaseURLstringhttps://tuish-api-production.doug-lance.workers.devAPI base URL
APIKeystring""API key for authenticated requests
StorageDirstring~/.tuish/licenses/License cache directory
DebugboolfalseEnable debug logging
use tuish::Tuish;

// Using builder pattern
let tuish = Tuish::builder()
    .product_id("prod_xxx")
    .public_key("MCowBQYDK2VwAyEA...")
    .api_key("tuish_sk_...")  // Optional
    .api_url("https://tuish-api-production.doug-lance.workers.dev")  // Optional
    .build()?;

// Or using config struct
use tuish::TuishConfig;

let config = TuishConfig::new("prod_xxx", "MCowBQYDK2VwAyEA...");
let tuish = Tuish::new(config)?;

Configuration Options

MethodRequiredDefaultDescription
product_id()YesYour product ID
public_key()YesEd25519 public key
api_key()NoNoneAPI key for authenticated requests
api_url()Nohttps://tuish-api-production.doug-lance.workers.devAPI base URL
from tuish import Tuish

client = Tuish(
    # Required
    product_id="prod_xxx",
    public_key="MCowBQYDK2VwAyEA...",

    # Optional
    api_base_url="https://tuish-api-production.doug-lance.workers.dev",
    api_key="tuish_sk_...",
    storage_dir="~/.tuish/licenses",
    debug=False,
)

Configuration Options

OptionTypeDefaultDescription
product_idstrRequiredYour product ID
public_keystrRequiredEd25519 public key
api_base_urlstrhttps://tuish-api-production.doug-lance.workers.devAPI base URL
api_keystrNoneAPI key for authenticated requests
storage_dirstr~/.tuish/licensesLicense cache directory
debugboolFalseEnable debug logging

Verify Installation

import { Tuish } from '@tuish/sdk';

const tuish = new Tuish({
  productId: 'prod_xxx',
  publicKey: 'MCowBQYDK2VwAyEA...',
});

// Get machine fingerprint to verify SDK is working
const fingerprint = tuish.getMachineFingerprint();
console.log('Machine ID:', fingerprint);

// Check license (will return invalid if no license exists)
const result = await tuish.checkLicense();
console.log('License status:', result.valid ? 'Valid' : result.reason);
sdk, err := tuish.New(tuish.Config{
    ProductID: "prod_xxx",
    PublicKey: "MCowBQYDK2VwAyEA...",
})
if err != nil {
    log.Fatal(err)
}

// Get machine fingerprint
fingerprint := sdk.GetMachineFingerprint()
fmt.Printf("Machine ID: %s\n", fingerprint)

// Check license
result, _ := sdk.CheckLicense(context.Background())
if result.Valid {
    fmt.Println("License valid!")
} else {
    fmt.Printf("License status: %s\n", result.Reason)
}
use tuish::{Tuish, get_machine_fingerprint};

fn main() -> Result<(), tuish::TuishError> {
    // Get machine fingerprint
    let fingerprint = get_machine_fingerprint();
    println!("Machine ID: {}", fingerprint);

    let tuish = Tuish::builder()
        .product_id("prod_xxx")
        .public_key("MCowBQYDK2VwAyEA...")
        .build()?;

    // Check license
    let result = tuish.check_license();
    if result.valid {
        println!("License valid!");
    } else {
        println!("License status: {:?}", result.reason);
    }

    Ok(())
}
from tuish import Tuish

client = Tuish(
    product_id="prod_xxx",
    public_key="MCowBQYDK2VwAyEA...",
)

# Get machine fingerprint
fingerprint = client.get_machine_fingerprint()
print(f"Machine ID: {fingerprint}")

# Check license
result = client.check_license()
if result.valid:
    print("License valid!")
else:
    print(f"License status: {result.reason}")

Key Formats

Public Key

The SDK accepts Ed25519 public keys in two formats:

MCowBQYDK2VwAyEAabc123...  (SPKI base64 - recommended)
abc123def456...             (64-character hex)

Get your public key from the Tuish dashboard. The public key is displayed when you create a product and can be retrieved from your product settings.

Next Steps