npm v2.1.0
Node.js / JavaScript SDK
Official Node.js / JavaScript SDK for Traffic Orchestrator. Validate licenses, manage keys, and integrate license management into your application in minutes.
npm install @traffic-orchestrator/client
Quick Start
Initialize the client and start validating licenses.
javascript
import { TrafficOrchestrator } from '@traffic-orchestrator/client';
const client = new TrafficOrchestrator({
baseUrl: 'https://api.trafficorchestrator.com/api/v1'
});
License Validation
Validate a license key against a domain with a single call.
javascript
// Validate a license key
const result = await client.validate({
key: 'TO-XXXX-XXXX-XXXX',
domain: 'example.com'
});
if (result.valid) {
console.log('License active!', result.features);
}
Offline Verification
Verify licenses offline using Ed25519 cryptographic signatures — no network required.
javascript
// Verify offline with Ed25519 signature
const isValid = await client.verifyOffline(
'TO-XXXX-XXXX-XXXX',
signature,
publicKey
);
Management API
Create licenses, list existing keys, and monitor usage with authenticated API calls.
javascript
// Authenticated client for management endpoints
const admin = new TrafficOrchestrator({
baseUrl: 'https://api.trafficorchestrator.com/api/v1',
apiKey: 'your-api-key'
});
const licenses = await admin.listLicenses();
const newLicense = await admin.createLicense({
product: 'my-app',
plan: 'pro'
});
const usage = await admin.getUsage();
const health = await admin.healthCheck();
Available Methods
validateLicense()
Validate a license key against a domain
verifyOffline()
Cryptographic offline verification (Ed25519)
listLicenses()
List all licenses (requires API key)
createLicense()
Create a new license key (requires API key)
getUsage()
Retrieve usage statistics (requires API key)
healthCheck()
Check API health and connectivity
gracePeriod
Cache validation results for resilience during API outages (v2.1.0+)
clearCache()
Clear cached validation results immediately