Skip to content

Initialization

After installing the CyberShield SDK, you must initialize it using your API key and preferred environment. Initialization creates a client instance that communicates with the CyberShield backend.


Basic Initialization

JavaScript (Node.js)

import CyberShield from "cybershield-sdk";

const shield = new CyberShield({
  apiKey: process.env.CS_API_KEY,
  environment: "sandbox"
});

Python

from cybershield import CyberShield

shield = CyberShield(
    api_key="YOUR_API_KEY",
    environment="sandbox"
)

Java

CyberShield shield = new CyberShield.Builder()
    .apiKey("YOUR_API_KEY")
    .environment("sandbox")
    .build();

Initialization Parameters

Parameter Required Description
apiKey Yes Your CyberShield API key.
environment No Either "sandbox" or "production". Default is "sandbox".
timeout No API request timeout in milliseconds. Default is 5000.
cacheResults No Enables local caching to speed up repeated scans.

Example With Custom Configuration

JavaScript

const shield = new CyberShield({
  apiKey: "...",
  environment: "production",
  timeout: 8000,
  cacheResults: true
});

Successful Initialization Output

A correctly initialized client returns a ready status:

{
  "status": "ready",
  "environment": "sandbox"
}

Next Step

Proceed to configure your SDK:

Configuration