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

@nsec/core

v0.4.0

Published

Core schemas, configurations, and API clients for NullSec / ZVault

Readme

@nsec/core

npm version License: MIT TypeScript

Core Schemas, Configuration Loader, and Zero-Knowledge API Client for NullSec / ZVault

Overview • Installation • Modules • Usage Examples


Overview

@nsec/core is the foundational package providing:

  • Zod Schemas & DTOs: Strict runtime type validation for projects, users, encrypted secrets payloads, service tokens, and invites.
  • Config Loader: Hierarchical configuration discovery (nullsec.config.json, .nullsecrc, nsec.config.json, environment variables).
  • NullSecApiClient: Complete HTTP client with cryptographic request signing (Ed25519), replay prevention, and timeout handling.
  • Typed Errors: Standardized error classes across the NullSec ecosystem (ApiClientError, AuthenticationError, NotFoundError, ConfigError).

Installation

# With npm
npm install @nsec/core

# With pnpm
pnpm add @nsec/core

# With yarn
yarn add @nsec/core

Modules

1. Schemas (@nsec/core/schemas or root export)

Built using Zod for compile-time TypeScript inference and runtime payload validation:

| Schema | Purpose | |---|---| | NullSecConfigSchema | Configuration file structure (projectId, serverUrl, defaultEnv, etc.) | | ProjectSchema | Project entities, environments, members, and access roles | | UserSchema | User identity entity with public keys (Ed25519 signing, RSA encryption) | | EncryptedSecretsPayloadSchema | Base64 AES-256-GCM ciphertext, IV, and auth tag | | EncryptedProjectKeySchema | Wrapped Master Project Key (RSA-OAEP-4096 or AES-256-GCM) | | ServiceTokenSchema | CI/CD automation token metadata and token prefix validation | | InviteTokenSchema | Single-use registration invite tokens |

2. Configuration Loader (loadConfig, findConfigFile)

Resolves configurations by searching up the directory tree and merging environment variable overrides:

Search priority:

  1. Explicit function overrides
  2. Environment variables (NULLSEC_PROJECT_ID, NULLSEC_SERVER_URL, NSEC_*, ZVAULT_*)
  3. Nearest project config file (nullsec.config.json, .nullsecrc.json, nsec.config.json, etc.)
import { loadConfig, findConfigFile } from '@nsec/core';

// Search up from current directory and parse validated config
const config = await loadConfig();
console.log(`Connected to project: ${config.projectId} at ${config.serverUrl}`);

3. API Client (NullSecApiClient)

Performs authenticated zero-knowledge HTTP communication with the NullSec server. Requests are signed using the user's Ed25519 private key or authenticated via CI/CD Bearer service tokens.

import { NullSecApiClient } from '@nsec/core';

// 1. Initialized with Developer Identity Keys
const client = new NullSecApiClient({
  serverUrl: 'https://vault.internal.net',
  signingKeys: {
    privateKey: userSigningPrivateKeyPem,
    publicKey: userSigningPublicKeyPem
  },
  timeoutMs: 15_000
});

// Fetch encrypted secrets payload for environment
const secretsResponse = await client.fetchSecrets('my-app', 'production');
// {
//   secrets: { ciphertext: '...', iv: '...', tag: '...', version: 1 },
//   projectKey: { encryptedKey: '...', algorithm: 'RSA-OAEP-4096' }
// }

// 2. Initialized with CI/CD Service Token
const ciClient = new NullSecApiClient({
  serverUrl: 'https://vault.internal.net',
  serviceToken: 'zv_st_production_a9c...'
});

const ciSecretsResponse = await ciClient.fetchSecrets('my-app', 'production');

Error Handling

@nsec/core exports domain-specific error classes for error matching and handling:

import {
  ApiClientError,
  AuthenticationError,
  NotFoundError,
  ConfigError
} from '@nsec/core';

try {
  await client.getProject('unknown-id');
} catch (err) {
  if (err instanceof NotFoundError) {
    console.error('Project does not exist');
  } else if (err instanceof AuthenticationError) {
    console.error('Cryptographic signature failed verification or user unauthorized');
  } else if (err instanceof ApiClientError) {
    console.error(`API request failed with status: ${err.statusCode}`);
  }
}

License

MIT © NullSec / zVault Contributors