Developer Platform

Multi-Language SDK Developer Hub

Integrate BlackShield security posture, runtime guardrails, and vulnerability telemetry into TypeScript, Python, Go, and Java applications. Switch languages anytime to view idiomatic code examples and architectural differences.

Select Your Language / Ecosystem
Synchronizes all examples below

Package Installation

Install TypeScript:
npm install @blackshield/sdk

Interactive Code Examples & Common Patterns

Explore real-world implementations across TypeScript, Python, Go, and Java. Selecting a tab updates code snippets across all examples simultaneously.

1. Client Initialization & Regional Routing

Establish authenticated connections with automated retries and OpenTelemetry tracing

All BlackShield SDKs support explicit regional routing (e.g. EU data residency in Ireland `eu-west-1`), automated exponential backoff on 429/5xx errors, and W3C TraceContext header propagation.

import { BlackShieldClient } from "@blackshield/sdk";

// Initialize with environment API key and regional data residency
export const blackshield = new BlackShieldClient({
  apiKey: process.env.BLACKSHIELD_API_KEY!,
  region: "eu-west-1", // Routes to https://api.eu-west-1.blackshield.chaplau.com
  timeoutMs: 30_000,
  maxRetries: 3,
  enableOpenTelemetry: true, // Injects traceparent & tracestate
});
Edge Runtime & MCP AI Agent Tools
Node.js >= 18, Next.js App Router, Cloudflare Workers

2. Querying & Filtering Vulnerability Findings

Query prioritized findings across SAST, SCA, container, and cloud scanners

Filter findings by severity, lifecycle status, CVE identifier, or affected resource. SDKs provide typed pagination and memory-efficient cursor iterators.

import { blackshield } from "./client";

export async function getCriticalVulnerabilities(serviceName: string) {
  const response = await blackshield.findings.list({
    severity: ["critical", "high"],
    status: "open",
    resourceType: "container_image",
    resourceName: serviceName,
    limit: 50,
  });

  console.log(`Found ${response.total} active findings`);
  for (const finding of response.items) {
    console.log(`[${finding.severity.toUpperCase()}] ${finding.id}: ${finding.title}`);
  }
  return response.items;
}
Edge Runtime & MCP AI Agent Tools
Node.js >= 18, Next.js App Router, Cloudflare Workers

3. Policy Guardrails & CI/CD Deployment Gates

Block non-compliant container images and unapproved dependencies before production

Evaluate deployment decisions against centralized BlackShield governance policies. Automatically halts pipelines if critical unpatched CVEs or license violations exist.

import { blackshield } from "./client";

export async function evaluateDeployGate(imageDigest: string, targetEnv: string) {
  const decision = await blackshield.policies.evaluate({
    action: "deploy",
    environment: targetEnv,
    resource: {
      type: "container_image",
      digest: imageDigest,
    },
  });

  if (!decision.allowed) {
    const reasons = decision.violations.map(v => `- ${v.rule}: ${v.message}`).join("\n");
    throw new Error(`Deployment blocked by BlackShield policy:\n${reasons}`);
  }

  console.log(`✓ Deployment approved by policy "${decision.policyPack}"`);
}
Edge Runtime & MCP AI Agent Tools
Node.js >= 18, Next.js App Router, Cloudflare Workers

4. Ingesting Telemetry & Scanner Findings

Submit batches of unified findings from bespoke or in-house scanners

Normalize findings into the BlackShield Unified Schema. Batches are ingested asynchronously, deduplicated by key, and surfaced across SOC dashboards in real time.

import { blackshield } from "./client";

export async function submitScannerResults(findingsBatch: Array<any>) {
  const result = await blackshield.ingestion.submit({
    source: {
      scanner: "custom-pipeline-scanner",
      scannerVersion: "2.4.0",
      target: "github.com/my-org/core-service",
    },
    findings: findingsBatch.map(f => ({
      findingType: "vulnerability",
      severity: f.severity,
      title: f.title,
      cveId: f.cve,
      dedupKey: `vuln:${f.cve}:${f.pkgName}@${f.installedVersion}`,
      affectedResource: {
        resourceType: "package",
        resourceName: f.pkgName,
        resourceId: f.installedVersion,
      },
    })),
  });

  console.log(`Job ID: ${result.jobId}, Ingested: ${result.submittedCount}`);
  return result;
}
Edge Runtime & MCP AI Agent Tools
Node.js >= 18, Next.js App Router, Cloudflare Workers

5. Idiomatic Ecosystem Strengths & Specializations

Showcasing language-native paradigms: MCP AI Agents, Async Streams, K8s Controllers & Spring Boot

Each BlackShield SDK is crafted natively to leverage its ecosystem's unique strengths without unnatural abstractions.

import { BlackShieldClient } from "@blackshield/sdk";
import { BlackShieldMCPAdapter } from "@blackshield/sdk/mcp";

// Model Context Protocol (MCP) AI Agent Adapter for Claude Desktop & Cursor
const client = new BlackShieldClient({ apiKey: process.env.BLACKSHIELD_API_KEY });
const mcp = new BlackShieldMCPAdapter(client);

// Expose standard JSON-RPC tools for autonomous security agents:
// - blackshield_list_findings
// - blackshield_get_finding_detail
// - blackshield_evaluate_policy
export const registeredTools = mcp.getTools();

export async function handleAgentToolCall(toolName: string, args: Record<string, any>) {
  return await mcp.executeTool(toolName, args);
}
Edge Runtime & MCP AI Agent Tools
Node.js >= 18, Next.js App Router, Cloudflare Workers

SDK Architecture & Capability Comparison

How each SDK is engineered for its specific runtime, concurrency model, and ecosystem strengths.

Capability / Architecture
TypeScriptActive
Python
Go
Java
Package Registrynpm: @blackshield/sdkPyPI: blackshield-sdkgo.dev / S3 Module ProxyMaven Central / Gradle
Runtime TargetNode 18+, Next.js Edge, WorkersPython 3.10+, FastAPI, JupyterGo 1.22+, K8s Operators, CLIJava 17+, Spring Boot 3.x
Concurrency ModelAsync/Await (Edge native)Async (httpx/asyncio) & SyncGoroutines & ChannelsVirtual Threads & CompletableFuture
External DependenciesZero Node-only deps (Web Fetch)httpx, pydantic >= 2.0Zero external dependenciesjava.net.http, Jackson (no Netty)
Distributed TracingW3C TraceContext (traceparent)W3C TraceContext auto-injectedW3C TraceContext auto-injectedW3C TraceContext auto-injected
Automated RetriesExponential backoff + jitterExponential backoff + jitterExponential backoff + jitterExponential backoff + jitter
Ecosystem HighlightModel Context Protocol (MCP) AI ToolsAsync Streaming to Pandas / PolarsK8s Admission Webhook & ControllersSpring Boot AutoConfiguration

Enterprise Reliability & Observability

Distributed Tracing (W3C TraceContext)

All SDKs automatically propagate traceparent and tracestate headers across API calls, enabling seamless end-to-end tracing through AWS X-Ray, Datadog, and OpenTelemetry collectors.

Automated Retries & Jittered Backoff

Transient 503 Service Unavailable and 429 Too Many Requests errors are retried automatically with exponential backoff and randomized jitter honoring upstream Retry-After headers.

Multi-Language SDK Developer Hub