npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

shieldcortex-sdk

v0.1.0

Published

Official TypeScript SDK for the ShieldCortex API

Downloads

91

Readme

shieldcortex-sdk

Official TypeScript SDK for the ShieldCortex API. Scan AI agent memory and inputs for prompt injection, credential leaks, and other threats.

Install

npm install shieldcortex-sdk

Quick Start

import { ShieldCortex } from 'shieldcortex-sdk';

const sc = new ShieldCortex({ apiKey: 'sc_live_...' });

const result = await sc.scan({ content: 'user input here' });

if (!result.allowed) {
  console.log('Blocked:', result.firewall.reason);
}

Getting an API Key

  1. Sign up at shieldcortex.ai
  2. Go to Dashboard > Keys
  3. Click Create Key with the scan scope
  4. Copy the key (it's only shown once)

API

new ShieldCortex(options)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | required | Your API key (sc_live_... or sc_test_...) | | baseUrl | string | https://api.shieldcortex.ai | API base URL |

Scanning

scan(input): Promise<ScanResult>

Scan a single piece of content through the 6-layer defence pipeline.

const result = await sc.scan({
  content: 'Text to scan',
  title: 'Optional title',
  source: { type: 'user', identifier: 'user-123' },
  config: { mode: 'strict' },
});

console.log(result.allowed);            // true or false
console.log(result.firewall.result);    // 'ALLOW' | 'BLOCK' | 'QUARANTINE'
console.log(result.trust.score);        // 0.0 - 1.0
console.log(result.sensitivity.level);  // 'PUBLIC' | 'INTERNAL' | 'CONFIDENTIAL' | 'RESTRICTED'
console.log(result.auditId);            // Unique audit trail ID

scanBatch(items, options?): Promise<BatchResult>

Scan up to 100 items in a single request.

const result = await sc.scanBatch([
  { content: 'First input' },
  { content: 'Second input' },
], {
  source: { type: 'agent', identifier: 'my-bot' },
  config: { mode: 'balanced' },
});

console.log(result.totalScanned);  // 2
console.log(result.threats);       // Number of blocked/quarantined items
console.log(result.results);       // Individual ScanResult per item

Audit Logs

getAuditLogs(query?): Promise<AuditResponse>

Query your team's audit trail with optional filters and pagination.

const logs = await sc.getAuditLogs({
  level: 'BLOCK',       // Filter: 'ALLOW' | 'BLOCK' | 'QUARANTINE'
  from: '2026-01-01',   // ISO datetime
  limit: 50,
  offset: 0,
});

for (const log of logs.logs) {
  console.log(log.firewall_result, log.trust_score, log.reason);
}

getAuditStats(timeRange?): Promise<AuditStats>

Get summary statistics for your team.

const stats = await sc.getAuditStats('7d');  // '24h' | '7d' | '30d'

console.log(stats.totalOperations);
console.log(stats.blockedCount);
console.log(stats.topSources);       // [{ source, count }]
console.log(stats.threatBreakdown);  // { indicator: count }

Quarantine

getQuarantine(query?): Promise<QuarantineResponse>

List quarantined items pending review.

const queue = await sc.getQuarantine({ status: 'pending', limit: 10 });

for (const item of queue.items) {
  console.log(item.reason, item.anomalyScore);
}

reviewQuarantine(id, action): Promise<void>

Approve or reject a quarantined item.

await sc.reviewQuarantine(42, 'approve');
await sc.reviewQuarantine(43, 'reject');

Error Handling

The SDK throws typed errors you can catch:

import { ShieldCortex, AuthError, RateLimitError, ValidationError } from 'shieldcortex-sdk';

try {
  await sc.scan({ content: 'test' });
} catch (err) {
  if (err instanceof AuthError) {
    // 401 - Invalid or expired API key
    console.error('Bad API key');
  } else if (err instanceof RateLimitError) {
    // 429 - Too many requests
    console.log('Retry after:', err.retryAfter, 'seconds');
  } else if (err instanceof ValidationError) {
    // 400 - Invalid request body
    console.error('Bad input:', err.body);
  }
}

Defence Modes

| Mode | Description | |------|-------------| | strict | Maximum security. Blocks on low-confidence threats. | | balanced | Default. Good balance of security and usability. | | permissive | Minimal blocking. Logs threats but rarely blocks. |

Requirements

  • Node.js 18+ (uses native fetch)
  • TypeScript 5+ (for type definitions)

Links

Licence

MIT