Get started with license management in minutes
3-line integration with automatic caching:
valid) {
die("License invalid: {$license->error}");
}
?>
curl -o laas-client.php https://api.lisensetech.com/download/client
// Install: npm install laas-client
const LAAS = require('laas-client');
async function validateLicense() {
const license = await LAAS.validate(
'LAAS-XXXX-XXXX',
123,
{ cacheTtl: 3600 }
);
if (!license.valid) {
throw new Error(license.error);
}
}
// server.js
const express = require('express');
const crypto = require('crypto');
const app = express();
app.use(express.json({ verify: verifySignature }));
function verifySignature(req, res, buf) {
const signature = req.get('X-LAAS-Signature');
const hmac = crypto.createHmac('sha256', process.env.WEBHOOK_SECRET);
const digest = hmac.update(buf).digest('hex');
if (!crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(digest)
)) throw new Error('Invalid signature');
}
app.post('/webhooks', (req, res) => {
console.log('Received event:', req.body.type);
res.sendStatus(200);
});
app.listen(3000);
{
"dependencies": {
"express": "^4.18.2",
"laas-client": "^1.0.0"
},
"scripts": {
"start": "node server.js"
}
}
# Install: pip install laas-client
from laas import validate_license
license = validate_license(
code="LAAS-XXXX-XXXX",
app_id=123,
cache_ttl=3600
)
if not license['valid']:
raise Exception(license['error'])
# app.py
from flask import Flask, request, abort
import hmac
import hashlib
app = Flask(__name__)
WEBHOOK_SECRET = b'your_secret_here'
@app.route('/webhooks', methods=['POST'])
def handle_webhook():
signature = request.headers.get('X-LAAS-Signature')
if not verify_signature(request.data, signature):
abort(401)
event = request.json
print(f"Received {event['type']} event")
return '', 200
def verify_signature(payload, signature):
digest = hmac.new(
WEBHOOK_SECRET,
payload,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(digest, signature)
# requirements.txt
Flask==2.3.2
laas-client==1.0.0
python-dotenv==1.0.0
Event Type | Payload Example |
---|---|
license_activated |
|
payment_processed |
|
X-LAAS-Signature
header{
"click_test_button": "Response will appear here"
}
Learn how to add LiSense LAAS to your PHP application
Configure real-time notifications in Node.js