Integration Guides
Integrate ShieldCipher into your development workflow with these guides and examples.
CI/CD Pipeline Integration
Automate code protection as part of your continuous integration and deployment process.
CI/CD Pipeline Integration
Automate code protection as part of your continuous integration and deployment process.
GitHub Actions
Example workflow for automatically protecting code on push:
name: Protect Code with ShieldCipher
on:
push:
branches: [ main, release/* ]
jobs:
protect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create package ZIP
run: |
zip -r application.zip . -x "*.git*" "*.github*" "node_modules/*"
- name: Upload to ShieldCipher
run: |
curl -X POST https://www.shieldcipher.com/api/admin/packages/upload \
-H "Authorization: Bearer ${{ secrets.SHIELDCIPHER_API_KEY }}" \
-H "Content-Type: multipart/form-data" \
-F "product_id=1" \
-F "name=build-${{ github.sha }}" \
-F "zip_file=@application.zip"
- name: Encode Package
run: |
# Wait for upload, then trigger encoding
# See API reference for encoding endpointGitLab CI
protect_code:
stage: build
image: alpine:latest
script:
- apk add curl zip
- zip -r app.zip . -x ".git/*" "node_modules/*"
- |
curl -X POST https://www.shieldcipher.com/api/admin/packages/upload \
-H "Authorization: Bearer $SHIELDCIPHER_API_KEY" \
-F "product_id=$PRODUCT_ID" \
-F "name=build-$CI_COMMIT_SHA" \
-F "zip_file=@app.zip"
only:
- main
- release/*Jenkins Pipeline
pipeline {
agent any
stages {
stage('Package') {
steps {
sh 'zip -r app.zip . -x ".git/*" "node_modules/*"'
}
}
stage('Protect') {
steps {
sh '''
curl -X POST https://www.shieldcipher.com/api/admin/packages/upload \
-H "Authorization: Bearer ${SHIELDCIPHER_API_KEY}" \
-F "product_id=${PRODUCT_ID}" \
-F "name=build-${BUILD_NUMBER}" \
-F "zip_file=@app.zip"
'''
}
}
}
}WordPress Plugin Protection
Protect your WordPress plugins from reverse engineering:
Preparation
- Ensure your plugin follows WordPress coding standards
- Create a test WordPress installation
- Test your plugin thoroughly before protection
Protection Process
- Package your plugin directory into a ZIP file
- Include an
installer.phpfile that handles license activation - Upload to ShieldCipher and encode
- Download the protected version
- Test in your WordPress installation
Example installer.php
Laravel Package Protection
Protect Laravel packages and applications:
Package Structure
Ensure your Laravel package has:
- Proper namespace structure
- Service provider for registration
- Composer autoloading configured
Protection Steps
- Exclude vendor directory from ZIP (will be installed via Composer)
- Include all source files in app/, config/, database/, routes/
- Create installer.php for license activation
- Upload and encode
- Deploy protected version
Custom Build Script
Example build script for Laravel:
#!/bin/bash
# build-protected.sh
# Create build directory
mkdir -p build/protected
# Copy necessary files
cp -r app build/protected/
cp -r config build/protected/
cp -r database build/protected/
cp -r routes build/protected/
cp composer.json build/protected/
cp installer.php build/protected/
# Create ZIP
cd build/protected
zip -r ../../laravel-app.zip .
cd ../..
# Upload to ShieldCipher
curl -X POST https://www.shieldcipher.com/api/admin/packages/upload \
-H "Authorization: Bearer $SHIELDCIPHER_API_KEY" \
-F "product_id=$PRODUCT_ID" \
-F "name=laravel-app-$(date +%Y%m%d)" \
-F "zip_file=@laravel-app.zip"
echo "Package uploaded successfully"Webhook Configuration
Receive real-time notifications about license events and security alerts:
Setting Up Webhooks
- Go to Settings → Webhooks in your portal
- Click Add Webhook
- Enter your webhook URL (must be HTTPS)
- Select events to subscribe to:
license.activated- When a license is activatedlicense.deactivated- When a license is deactivatedlicense.expired- When a license expiressecurity.alert- Security events and threats detectedpackage.encoded- When encoding completes
- Save webhook configuration
Webhook Payload Example
{
"event": "license.activated",
"timestamp": "2025-01-12T10:30:00Z",
"data": {
"license_id": "12345",
"license_key": "xxx-xxx-xxx",
"device_hash": "ABC123...",
"device_label": "Production Server",
"domain": "example.com"
},
"signature": {
"algorithm": "ed25519",
"kid": "psk:prod:v3",
"signature": "base64_signature_here"
}
}Verifying Webhook Signatures
Always verify webhook signatures to ensure authenticity:
SDK Integration
Use our SDKs for easier integration:
PHP SDK
'your_api_key',
'api_secret' => 'your_api_secret',
'base_url' => 'https://www.shieldcipher.com/api'
]);
// Upload package
$result = $client->packages()->upload([
'product_id' => 1,
'name' => 'My Package',
'zip_file' => '/path/to/package.zip'
]);
// Create license
$license = $client->licenses()->create([
'product_id' => 1,
'plan' => 'subscription',
'seats' => 5,
'customer_name' => 'John Doe',
'customer_email' => 'john@example.com'
]);Python SDK
from shieldcipher import Client
client = Client(
api_key='your_api_key',
api_secret='your_api_secret'
)
# Upload package
result = client.packages.upload(
product_id=1,
name='My Package',
zip_file='package.zip'
)
# Create license
license = client.licenses.create(
product_id=1,
plan='subscription',
seats=5,
customer_name='John Doe',
customer_email='john@example.com'
)Node.js SDK
const ShieldCipher = require('@shieldcipher/sdk');
const client = new ShieldCipher({
apiKey: 'your_api_key',
apiSecret: 'your_api_secret'
});
// Upload package
const result = await client.packages.upload({
productId: 1,
name: 'My Package',
zipFile: './package.zip'
});
// Create license
const license = await client.licenses.create({
productId: 1,
plan: 'subscription',
seats: 5,
customerName: 'John Doe',
customerEmail: 'john@example.com'
});Best Practices
- Environment Variables: Store API keys in environment variables, never in code
- Error Handling: Always handle API errors gracefully in your integrations
- Rate Limiting: Respect API rate limits and implement retry logic
- Testing: Test integrations in staging before production
- Monitoring: Monitor webhook delivery and API calls