The JavaScript/TypeScript SDK now automatically sends telemetry data to your backend endpoint after every encrypt/decrypt operation.
POST http://192.168.18.96:3000/api/sdk/telemetry
{
"sdkId": "e81276c4-740f-46cf-b35f-8cc25ec05642",
"operation": "encrypt",
"algorithm": "aes-256-gcm",
"duration": 12,
"success": true,
"inputSize": 1024,
"outputSize": 1088,
"metadata": {
"platform": "nodejs",
"deviceInfo": {
"os": "linux",
"arch": "x64",
"nodeVersion": "v18.17.0"
},
"networkInfo": {
"endpoint": "http://192.168.18.96:3000/api/sdk/telemetry"
}
}
}When the SDK loads, it automatically creates a telemetry client:
const telemetryClient = new TelemetryClient();The client reads configuration from hardcoded SDK metadata:
sdkId- From databasetelemetryEnabled- true/falsetelemetryEndpoint- Your backend URL
Every encrypt/decrypt operation is automatically tracked:
// User code
const crypto = new AveroxCrypto(masterKey);
const envelope = await crypto.encrypt(plaintext, aad);
// Behind the scenes:
// 1. Start timer
// 2. Perform encryption
// 3. Send telemetry (non-blocking)
// 4. Return resultTelemetry is sent asynchronously and never blocks crypto operations:
// Send asynchronously without blocking
this.sendAsync(telemetryData).catch(() => {
// Silent failure - telemetry should never break crypto operations
});{
"sdkId": "e81276c4-740f-46cf-b35f-8cc25ec05642",
"operation": "encrypt",
"algorithm": "aes-256-gcm",
"duration": 12,
"success": true,
"inputSize": 1024,
"outputSize": 1088,
"metadata": {
"platform": "nodejs",
"deviceInfo": {
"os": "win32",
"arch": "x64",
"nodeVersion": "v20.10.0"
},
"networkInfo": {
"endpoint": "http://192.168.18.96:3000/api/sdk/telemetry"
}
}
}{
"sdkId": "e81276c4-740f-46cf-b35f-8cc25ec05642",
"operation": "decrypt",
"algorithm": "aes-256-gcm",
"duration": 8,
"success": true,
"inputSize": 1088,
"outputSize": 1024,
"metadata": {
"platform": "nodejs",
"deviceInfo": {
"os": "darwin",
"arch": "arm64",
"nodeVersion": "v18.17.0"
},
"networkInfo": {
"endpoint": "http://192.168.18.96:3000/api/sdk/telemetry"
}
}
}{
"sdkId": "e81276c4-740f-46cf-b35f-8cc25ec05642",
"operation": "decrypt",
"algorithm": "aes-256-gcm",
"duration": 5,
"success": false,
"inputSize": 1088,
"outputSize": 0,
"metadata": {
"platform": "nodejs",
"deviceInfo": {
"os": "linux",
"arch": "x64",
"nodeVersion": "v18.17.0"
},
"networkInfo": {
"endpoint": "http://192.168.18.96:3000/api/sdk/telemetry"
}
}
}# In your backend, create SDK with telemetry enabled
POST /api/sdks
{
"name": "Test SDK",
"version": "2.0.0",
"languages": ["javascript"],
"telemetryEnabled": true,
"telemetryEndpoint": "http://192.168.18.96:3000/api/sdk/telemetry"
}GET /api/sdks/{sdk-id}/downloadimport { AveroxCrypto } from './src/index';
const masterKey = AveroxCrypto.generateMasterKey();
const crypto = new AveroxCrypto(masterKey);
// Encrypt - telemetry sent automatically
const envelope = await crypto.encrypt(
Buffer.from('Secret data'),
Buffer.from('user-123')
);
// Decrypt - telemetry sent automatically
const plaintext = await crypto.decrypt(
envelope,
Buffer.from('user-123')
);Your backend should receive telemetry events:
POST /api/sdk/telemetry
{
"sdkId": "e81276c4-740f-46cf-b35f-8cc25ec05642",
"operation": "encrypt",
"duration": 12,
"success": true,
...
}
- ❌ Plaintext data
- ❌ Ciphertext data
- ❌ Encryption keys
- ❌ AAD (Additional Authenticated Data)
- ❌ IVs or authentication tags
- ✅ SDK ID (links to database)
- ✅ Operation type (encrypt/decrypt)
- ✅ Algorithm used
- ✅ Duration (milliseconds)
- ✅ Success/failure status
- ✅ Data sizes (bytes)
- ✅ Platform info (OS, architecture, Node version)
At SDK Generation Time:
const sdk = {
sdkId: "e81276c4-740f-46cf-b35f-8cc25ec05642",
name: "My SDK",
version: "2.0.0",
telemetryEnabled: true, // ← Enable/disable
telemetryEndpoint: "http://192.168.18.96:3000/api/sdk/telemetry"
};Hardcoded in Generated SDK:
const SDK_METADATA: SDKMetadata = {
sdkId: "e81276c4-740f-46cf-b35f-8cc25ec05642",
telemetryEnabled: true, // ← Baked into code
telemetryEndpoint: "http://192.168.18.96:3000/api/sdk/telemetry",
// ...
};Implemented Features:
- ✅ Automatic telemetry tracking
- ✅ Non-blocking async execution
- ✅ Silent failure handling
- ✅ Performance timing
- ✅ Success/failure tracking
- ✅ Input/output size tracking
- ✅ Platform/device info collection
- ✅ 5-second timeout
- ✅ Privacy-preserving (no sensitive data)
Next Steps:
- Generate a new SDK to test telemetry
- Verify telemetry events arrive at your backend
- Implement similar telemetry in Python/Go SDKs
The JavaScript/TypeScript SDK telemetry is production-ready! 🎉