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

@hauska-sdk/core

v0.1.0

Published

CNS Protocol Core SDK - Unified SDK for Payment, VDA, and Document Retrieval

Readme

@hauska-sdk/core

CNS Protocol Core SDK - Unified SDK for Payment, VDA, and Document Retrieval

The CNS Protocol Core SDK provides a single, unified interface for all CNS Protocol functionality, combining Payment, VDA (Verified Digital Assets), Document Retrieval, and Wallet Management into one easy-to-use package.

Installation

npm install @hauska-sdk/core

Quick Start

import { CNSSDK } from "@hauska-sdk/core";
import { PostgreSQLStorageAdapter } from "@hauska-sdk/adapters-storage-postgres";

// Initialize SDK
const sdk = new CNSSDK({
  vda: {
    storageAdapter: new PostgreSQLStorageAdapter({
      connectionString: process.env.DATABASE_URL!,
    }),
  },
  payment: {
    storage: new PostgreSQLStorageAdapter({
      connectionString: process.env.DATABASE_URL!,
    }),
    blockchain: {
      chain: "base",
      token: "USDC",
      facilitatorWallet: "0xYourFacilitatorWallet",
      baseRpcUrl: "https://mainnet.base.org",
    },
  },
  retrieval: {
    pinata: {
      pinataJwt: process.env.PINATA_JWT!,
      pinataGateway: "https://gateway.pinata.cloud",
    },
  },
});

// Create a data room with document
const dataRoom = await sdk.createDataRoom({
  ownerWallet: {
    userId: "owner-123",
    password: "secure-password",
  },
  vdaParams: {
    assetType: "deed",
    address: "123 Main St, Schertz, TX 78154",
    spoke: "real-estate",
  },
  document: {
    content: Buffer.from("Property documents..."),
    name: "property-deed.pdf",
    encrypt: true,
  },
  accessPass: {
    recipientWallet: {
      userId: "buyer-456",
      password: "buyer-password",
    },
    permissions: ["view", "download"],
    expiry: Date.now() + 30 * 24 * 3600000, // 30 days
  },
});

console.log(`Data room created: ${dataRoom.vda.id}`);
console.log(`Document uploaded: ${dataRoom.document?.cid}`);

Features

🎯 Unified API

  • Single entry point for all CNS Protocol functionality
  • Automatic wallet management
  • Seamless integration between Payment, VDA, and Retrieval modules

💰 Payment Processing

  • HTTP 402 Payment Required protocol (x402)
  • Crypto payment verification (USDC on Base L2)
  • Fiat payment support (via Circle API)
  • Automatic payment recording and audit trails

🏷️ VDA Management

  • Mint Verified Digital Assets (metadata-only ownership proofs)
  • Create and manage access passes
  • Transfer ownership
  • Cross-spoke search (real-estate, healthcare, architect, etc.)

📄 Document Retrieval

  • IPFS document upload/download via Pinata
  • AES-256-GCM encryption
  • Gated access control (VDA ownership or access passes)
  • PDF watermarking for access pass viewers
  • Access logging and analytics

🔐 Wallet Management

  • Automatic wallet creation per user
  • Secure wallet encryption
  • EIP-712 signing support

Core Concepts

Verified Digital Assets (VDAs)

VDAs are metadata-only ownership proofs, not tokens or NFTs. They represent ownership of real-world assets (properties, medical records, blueprints, etc.) without tokenization.

Access Passes

Time-bound VDAs that grant temporary, permissioned access to other VDAs. Perfect for data rooms, medical record sharing, and document collaboration.

Spokes

Industry verticals (e.g., real-estate, healthcare, architect). Each spoke can have its own metadata schema while sharing universal metadata keys (address, legalDesc, patientId, api14).

Universal Metadata

Standardized metadata keys that enable cross-spoke search:

  • address - Physical address (real estate)
  • legalDesc - Legal description (real estate)
  • patientId - Patient identifier (healthcare)
  • api14 - API 14 identifier (oil & gas)

Documentation

Examples

Architect Invoice Flow

import { architectInvoiceFlow } from "@hauska-sdk/core/examples/architect-invoice-flow";

// Complete flow: Create invoice → Payment → Transfer blueprint
const result = await architectInvoiceFlow();

Data Room Creation

// Create a data room with encrypted documents
const dataRoom = await sdk.createDataRoom({
  ownerWallet: { userId: "owner", password: "pass" },
  vdaParams: {
    assetType: "deed",
    address: "123 Main St",
    spoke: "real-estate",
  },
  document: {
    content: Buffer.from("..."),
    encrypt: true,
  },
});

Purchase and Mint VDA

// Purchase and mint a VDA in a single operation
const result = await sdk.purchaseAndMintVDA({
  wallet: { userId: "user", password: "pass" },
  amount: "5000",
  currency: "USDC",
  method: "crypto",
  vdaParams: {
    assetType: "blueprint",
    address: "123 Main St",
    spoke: "architect",
  },
});

See Examples Guide for more complete examples.

Error Handling

The SDK uses structured error types for better error handling:

import {
  SDKError,
  PaymentError,
  VDAError,
  RetrievalError,
  WalletError,
  ConfigurationError,
  isSDKError,
  isRetryableError,
} from "@hauska-sdk/core";

try {
  await sdk.purchaseAndMintVDA({ /* ... */ });
} catch (error) {
  if (isSDKError(error)) {
    console.error(`Error code: ${error.code}`);
    console.error(`Context:`, error.context);
    
    if (isRetryableError(error)) {
      // Retry logic
    }
  }
}

See Error Handling for more details.

Logging and Monitoring

The SDK supports logging and metrics hooks for monitoring:

const sdk = new CNSSDK({
  // ... config
  logHook: (level, message, data) => {
    console.log(`[${level}] ${message}`, data);
  },
  metricsHook: (event, data) => {
    // Send to your analytics service
    analytics.track(event, data);
  },
});

Adapters

The SDK uses adapters for storage, blockchain, and IPFS:

Storage Adapters

  • @hauska-sdk/adapters-storage-postgres - PostgreSQL (production)
  • @hauska-sdk/adapters-storage-redis - Redis caching layer
  • @hauska-sdk/adapters-storage-mock - In-memory (testing)

Blockchain Adapters

  • @hauska-sdk/adapters-blockchain-ethers - Ethers.js (Base L2)

IPFS Adapters

  • Pinata (via @hauska-sdk/retrieval)

Requirements

  • Node.js 18+
  • TypeScript 5.3+
  • PostgreSQL (for production storage)
  • Pinata account (for IPFS storage)
  • Base L2 RPC endpoint (for blockchain operations)

License

MIT

Related Packages

Support