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 endpoint

GitLab 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

  1. Ensure your plugin follows WordPress coding standards
  2. Create a test WordPress installation
  3. Test your plugin thoroughly before protection

Protection Process

  1. Package your plugin directory into a ZIP file
  2. Include an installer.php file that handles license activation
  3. Upload to ShieldCipher and encode
  4. Download the protected version
  5. 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

  1. Exclude vendor directory from ZIP (will be installed via Composer)
  2. Include all source files in app/, config/, database/, routes/
  3. Create installer.php for license activation
  4. Upload and encode
  5. 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

  1. Go to SettingsWebhooks in your portal
  2. Click Add Webhook
  3. Enter your webhook URL (must be HTTPS)
  4. Select events to subscribe to:
    • license.activated - When a license is activated
    • license.deactivated - When a license is deactivated
    • license.expired - When a license expires
    • security.alert - Security events and threats detected
    • package.encoded - When encoding completes
  5. 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