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

security-snapshot-api

v1.0.0

Published

TypeScript client for the Website Security Snapshot API — pay-per-call security header checker via x402 (USDC on Base)

Readme

security-snapshot-api

TypeScript client for Website Security Snapshot API.

Pay per call. No account. No API key.

Payment is settled automatically on-chain via the x402 protocol — 0.05 USDC on Base.

Network status: Currently on Base Sepolia testnet. Mainnet (Base) goes live 2026-03-28. Use NETWORK=base-sepolia for testing before that date; switch to NETWORK=base on 2026-03-28.

Install

npm install security-snapshot-api x402-fetch viem

Quick Start

import { SnapshotClient } from "security-snapshot-api";
import { createSigner } from "x402-fetch";

// Your wallet private key (keep this secret!)
const signer = await createSigner("base", "0xYOUR_PRIVATE_KEY");
const client = new SnapshotClient(signer);

// Scan any public URL — costs 0.05 USDC per call
const result = await client.scan("https://example.com");

console.log(result.hsts_present);               // true
console.log(result.csp_present);                // false
console.log(result.x_frame_options_present);    // true
console.log(result.redirect_count);             // 1
console.log(result.security_txt_present);       // null (not checked)

Try Without Paying

const client = new SnapshotClient(signer); // signer not used for demo
const demo = await client.demo();
// Returns pre-baked example response with _demo: true

Full Response Type

interface SnapshotResult {
  requested_url: string;
  normalized_url: string;
  final_url: string;
  fetched_at: string;           // ISO 8601
  reachable: boolean;
  final_status_code: number | null;
  redirect_count: number;
  https_ok: boolean;
  hsts_present: boolean;
  csp_present: boolean;
  x_frame_options_present: boolean;
  x_content_type_options_present: boolean;
  referrer_policy_present: boolean;
  permissions_policy_present: boolean;
  security_txt_present: boolean | null;
  robots_txt_present: boolean | null;
  sitemap_xml_present: boolean | null;
  notes: string[];
  checks: Record<string, boolean | null>;
}

Error Handling

import { SnapshotClient, SnapshotApiError } from "security-snapshot-api";

try {
  const result = await client.scan("http://192.168.1.1");
} catch (err) {
  if (err instanceof SnapshotApiError) {
    console.log(err.data.error_type); // "ssrf"
    console.log(err.data.error);      // "Private or reserved IP ranges are not allowed."
  }
}

Use with viem WalletClient

import { SnapshotClient } from "security-snapshot-api";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const client = new SnapshotClient(walletClient);
const result = await client.scan("https://example.com");

Testnet (Base Sepolia)

import { createSigner } from "x402-fetch";
const signer = await createSigner("base-sepolia", "0xYOUR_TESTNET_KEY");
const client = new SnapshotClient(signer, {
  baseUrl: "https://api.cybersecurity-japan.com", // same endpoint, different network in wallet
});

Get free testnet USDC: https://faucet.circle.com

Pricing

| | | |--|--| | Per call | 0.05 USDC | | Network | Base (mainnet) | | Asset | USDC | | Account required | No |

Links

License

MIT