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

@qsafe/sdk

v1.0.4

Published

OpenAPI client for @qsafe/sdk

Downloads

15

Readme

@qsafe/sdk (TypeScript / Node.js)

Post-quantum cryptography SDK for the QSafe API — supports ML-KEM (Kyber) encryption and ML-DSA (Dilithium) signatures.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Works in Node.js, Webpack, and Browserify

Installation

npm install @qsafe/sdk

Authentication

| Method | Use case | Configuration | |--------|----------|---------------| | API Key | Programmatic access (recommended) | apiKey: (name) => name === 'ApiKeyHeader' ? 'pqc_...' : '' | | JWT Bearer | Managing API keys, user sessions | accessToken: 'your_jwt_token' |

Getting an API key: Register → Login (JWT) → POST /api-keys → copy data.api_key.

Quick Start — API Key Auth (Recommended)

import { Configuration, KeypairsApi, CryptographicOperationsApi,
         GenerateKeypairRequest, EncryptRequest, DecryptRequest,
         SignRequest, VerifyRequest } from '@qsafe/sdk';

const config = new Configuration({
  apiKey: (securityName: string) =>
    securityName === 'ApiKeyHeader' ? 'pqc_your_api_key_here' : '',
});

const keypairsApi = new KeypairsApi(config);
const cryptoApi = new CryptographicOperationsApi(config);

async function run() {
  // 1. Generate a KEM keypair
  const kp = await keypairsApi.generateKeypair({ algorithm: 'KYBER768' });
  const keypairId = kp.data.data!.id!;
  console.log('Keypair:', keypairId);

  // 2. Encrypt
  const enc = await cryptoApi.encryptData(keypairId, {
    plaintext: 'Hello, quantum-safe world!'
  });
  const { ciphertext, encapsulated_key } = enc.data.data!;

  // 3. Decrypt
  const dec = await cryptoApi.decryptData(keypairId, {
    ciphertext,
    encapsulated_key,
  });
  console.log('Decrypted:', dec.data.data!.plaintext);
}

run().catch(console.error);

Sign & Verify

// Generate a signature keypair
const kp = await keypairsApi.generateKeypair({ algorithm: 'DILITHIUM3' });
const keypairId = kp.data.data!.id!;

// Sign
const sig = await cryptoApi.signData(keypairId, {
  message: 'I approve this transaction',
  hash_algorithm: 'sha256',
});
const signature = sig.data.data!.signature!;

// Verify
const ver = await cryptoApi.verifySignature(keypairId, {
  message: 'I approve this transaction',
  signature,
  hash_algorithm: 'sha256',
});
console.log('Valid:', ver.data.data!.verification_result!.valid); // true

Quick Start — JWT Auth (for managing API keys)

import { Configuration, AuthenticationApi, APIKeysApi,
         RegisterRequest, CreateApiKeyRequest } from '@qsafe/sdk';

// 1. Register and get JWT token
const authApi = new AuthenticationApi(new Configuration());
const reg = await authApi.registerUser({
  email: '[email protected]',
  password: 'SecureP@ssw0rd123',
  firstName: 'Your',
  lastName: 'Name',
});
const jwtToken = reg.data.data!.accessToken!;

// 2. Create an API key using JWT
const jwtConfig = new Configuration({ accessToken: jwtToken });
const keysApi = new APIKeysApi(jwtConfig);
const keyResp = await keysApi.createApiKey({
  name: 'My Production Key',
  permissions: ['read', 'write', 'crypto_encrypt', 'crypto_decrypt', 'crypto_sign', 'crypto_verify'],
});
const rawApiKey = keyResp.data.data!.api_key!;  // pqc_xxxx — save this!
console.log('API Key:', rawApiKey);

Ephemeral Storage

// Encrypt and get ephemeral_id
const enc = await cryptoApi.encryptData(keypairId, {
  plaintext: 'Sensitive data',
  ephemeral_storage: { ttl: 1800, max_access_count: 3 },
});
const ephemeralId = enc.data.data!.ephemeral_storage!.ephemeral_id!;

// Decrypt by ephemeral_id
const dec = await cryptoApi.decryptData(keypairId, { ephemeral_id: ephemeralId });
console.log(dec.data.data!.plaintext);

Building from Source

npm install
npm run build

API Reference

| Class | Method | Endpoint | Auth | |-------|--------|----------|------| | AuthenticationApi | registerUser | POST /auth/register | None | | AuthenticationApi | loginUser | POST /auth/login | None | | APIKeysApi | createApiKey | POST /api-keys | JWT only | | APIKeysApi | listApiKeys | GET /api-keys | JWT only | | KeypairsApi | generateKeypair | POST /generate-keypair | JWT or API key | | CryptographicOperationsApi | encryptData | POST /keypairs/{id}/encrypt | JWT or API key | | CryptographicOperationsApi | decryptData | POST /keypairs/{id}/decrypt | JWT or API key | | CryptographicOperationsApi | signData | POST /keypairs/{id}/sign | JWT or API key | | CryptographicOperationsApi | verifySignature | POST /keypairs/{id}/verify | JWT or API key | | UtilitiesApi | getRateLimitStatus | GET /rate-limit/status | API key only |

Support

  • API docs: https://rushikesh66-pqc-api.hf.space/api-docs
  • Issues: https://github.com/rushikesh-kakadiya/QSafeApi/issues