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

astra-security

v1.0.0

Published

Advanced security library for AI detection and human verification

Downloads

21

Readme

Astra Security

Advanced security library for AI detection and human verification.

Installation

npm install astra-security

Quick Start

import Astra from 'astra-security';

// Initialize with your API key
const astra = new Astra({
  apiKey: 'your-api-key-here',
  environment: 'production' // or 'development'
});

// Initialize the SDK
astra.init();

// Verify a request
astra.verifyRequest(requestData)
  .then(result => {
    if (result.isHuman) {
      // Proceed with human request
      console.log('Human detected');
    } else {
      // Handle bot detection
      console.log('Bot detected');
    }
  })
  .catch(error => {
    console.error('Verification failed:', error);
  });

Configuration Options

const astra = new Astra({
  apiKey: 'string',           // Required: Your API key
  environment: 'production',   // Optional: 'production' or 'development'
  timeout: 5000,              // Optional: Request timeout in ms
  debug: false,               // Optional: Enable debug logging
  autoBlock: true,            // Optional: Automatically block detected bots
  endpoint: 'https://api.astra.security/v1' // Optional: Custom API endpoint
});

API Reference

astra.init()

Initializes the SDK. Must be called before using other methods.

astra.verifyRequest(requestData)

Verifies if a request is from a human or AI.

Parameters:

  • requestData (Object): Request data including headers, IP, user agent, etc.

Returns: Promise resolving to verification result

astra.trackEvent(eventName, data)

Tracks security events for analytics.

astra.getAnalytics()

Retrieves analytics data for your account.

Browser Usage

<script src="https://cdn.astra.security/v1/astra.min.js"></script>
<script>
  const astra = new Astra({
    apiKey: 'your-api-key-here'
  });
  
  astra.init();
</script>

React Integration

import { AstraProvider, useAstra } from 'astra-security/react';

function App() {
  return (
    <AstraProvider apiKey="your-api-key-here">
      <YourApp />
    </AstraProvider>
  );
}

function ProtectedComponent() {
  const { verifyRequest } = useAstra();
  
  const handleRequest = async () => {
    const result = await verifyRequest(requestData);
    if (result.isHuman) {
      // Proceed
    }
  };
  
  return <button onClick={handleRequest}>Submit</button>;
}

Node.js Integration

const Astra = require('astra-security');

const astra = new Astra({
  apiKey: 'your-api-key-here'
});

// Express middleware
app.use((req, res, next) => {
  astra.verifyRequest(req)
    .then(result => {
      if (result.isHuman) {
        next();
      } else {
        res.status(403).json({ error: 'Bot detected' });
      }
    })
    .catch(error => {
      console.error('Verification error:', error);
      next(); // Fail open for errors
    });
});

Events

Astra emits events you can listen to:

astra.on('verification.success', (result) => {
  console.log('Human verified:', result);
});

astra.on('verification.failure', (result) => {
  console.log('Bot detected:', result);
});

astra.on('error', (error) => {
  console.error('Astra error:', error);
});

Error Handling

try {
  const result = await astra.verifyRequest(requestData);
  // Handle result
} catch (error) {
  if (error.code === 'NETWORK_ERROR') {
    // Handle network issues
  } else if (error.code === 'INVALID_API_KEY') {
    // Handle invalid API key
  } else {
    // Handle other errors
  }
}

Dashboard

After installation, visit your Astra Dashboard to:

  • View analytics
  • Configure settings
  • Manage API keys
  • Monitor security events

Support

License

MIT © Astra Security