Skip to main content

Getting Started with QuantumLock™

Get your first license working in 5 minutes.


Step 1: Get Your API Key

  1. Go to portal.softquantus.com
  2. Sign up or log in
  3. Navigate to Settings → API Keys
  4. Click Create New Key
  5. Copy your API key (starts with ql_)

⚠️ Keep your API key secret! Never expose it in client-side code.


Step 2: Choose Your Integration Method

Best for Python applications.

# Install the SDK
pip install quantumlock-sdk
from quantumlock_sdk import QuantumLockClient

# Initialize
client = QuantumLockClient(api_key="ql_your_api_key")

# Create a license
artifact = client.create_license(
subject="customer:acme-corp",
product="MyApp",
tier="PRO",
features=["feature:api", "feature:export"],
valid_days=365
)

print(f"License ID: {artifact.license_id}")
print(f"Compact Token: {artifact.compact[:50]}...")

Option B: REST API

Best for any programming language.

# Create a license
curl -X POST "https://quantumlock.softquantus.com/api/v1/v2/artifacts" \
-H "Authorization: Bearer ql_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"subject": "customer:acme-corp",
"days_valid": 365,
"entitlements": [
{"id": "feature:api", "type": "feature", "value": true},
{"id": "seats:max", "type": "quantity", "value": 10}
]
}'

Option C: CLI Tool

Best for administrators and automation.

# Configure CLI
quantumlock configure --api-key ql_your_api_key

# Generate license
quantumlock generate \
--subject "customer:acme-corp" \
--product "MyApp" \
--tier "PRO" \
--days 365

# Validate license
quantumlock validate --file license.qlf

Step 3: Validate Licenses in Your App

Python SDK Validation

from quantumlock_sdk import QuantumLockClient

client = QuantumLockClient(api_key="ql_your_api_key")

# Validate a license token
result = client.validate(compact_token="eyJ0eXAiOi...")

if result.is_valid:
print("✅ License is valid!")
print(f" Entitlements: {result.entitlements}")
print(f" Expires: {result.expires_at}")
else:
print(f"❌ License invalid: {result.error}")

REST API Validation

curl -X POST "https://quantumlock.softquantus.com/api/v1/v2/validate" \
-H "Authorization: Bearer ql_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"artifact_compact": "eyJ0eXAiOi..."
}'

Step 4: Handle License States

Your application should handle these license states:

StateDescriptionAction
validLicense is activeAllow access
expiredPast expiration datePrompt renewal
grace_periodIn grace period after expirationShow warning, allow access
revokedAdministratively revokedBlock access
not_yet_validBefore activation dateShow countdown
result = client.validate(compact_token=token)

match result.status:
case "valid":
allow_access()
case "grace_period":
show_renewal_warning()
allow_access()
case "expired":
show_renewal_required()
block_access()
case "revoked":
show_revoked_message()
block_access()

For applications that need to work without constant internet connection, use the HybridLicenseValidator:

Benefits of Hybrid Validation

  • Instant startup - Validates offline first (< 5ms)
  • 🔄 Background sync - Checks revocation without blocking
  • 📶 Works offline - Grace period of 7 days without internet
  • 🔔 Callbacks - Get notified when license is revoked

Basic Usage

from quantumlock.sdk import HybridLicenseValidator

# Initialize (loads config from environment)
validator = HybridLicenseValidator()

# Validate (instant, offline-first)
result = validator.validate()

if result.is_valid:
print("✅ License valid!")
print(f" Customer: {result.customer_name}")
print(f" Features: {result.features}")
run_application()
else:
print(f"❌ {result.message}")
show_license_dialog()

Environment Configuration

# Required: Path to license file
export QUANTUMLOCK_LICENSE_PATH=/path/to/license.qlicense

# Optional: API for background sync
export QUANTUMLOCK_API_URL=https://quantumlock.softquantus.com
export QUANTUMLOCK_API_KEY=ql_your_api_key

# Optional: Validation mode
export QUANTUMLOCK_MODE=hybrid # offline, online, or hybrid

With Context Manager

from quantumlock.sdk import HybridLicenseValidator, LicenseError

try:
with HybridLicenseValidator() as validator:
# License validated, background sync started
run_my_application()
except LicenseError as e:
print(f"License error: {e}")
show_purchase_dialog()

Protect Functions with Decorator

from quantumlock.sdk import HybridLicenseValidator

validator = HybridLicenseValidator()

@validator.require_license(features=["premium"])
def premium_feature():
"""Only runs if license has 'premium' feature"""
return expensive_computation()

Handle License Events

from quantumlock.sdk import HybridLicenseValidator

validator = HybridLicenseValidator()

# Called when license is revoked remotely
@validator.on_revoked
def handle_revocation(result):
show_revoked_dialog()
disable_premium_features()

# Called when entering grace period
@validator.on_grace_period
def handle_grace(result):
show_reconnect_warning(result.grace_period_ends)

result = validator.validate()

Next Steps


Need Help?