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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nillion-sv-wrappers

v1.0.9

Published

Wrappers for Nillion's Secret Vault and nilQL

Readme

nillion-sv-wrappers

Wrapper classes for simplifying usage of Nillion's Secret Vault and the nilQL encryption and decryption library.

Installation

npm install nillion-sv-wrappers

NilQLWrapper: Lightweight wrapper for encryption and decryption using nilQL:

  • Encrypts data into shares for distributed storage across nodes
  • Handles structured data with $allot markers for selective encryption
  • Recombines shares and decrypts data marked $share using unify
  • Manages secret keys for encryption/decryption operations
  • Recombines and decrypts shares to recover original data
  • Maintains compatibility with SecretVault timestamps
  • No node configuration required when used standalone

SecretVaultWrapper: wrapper for Secret Vault API operations:

Authentication

  • Handles JWT creation and management per node
  • Manages node authentication automatically

Schema Operations

Create: Deploy schema across nodes (/api/v1/schemas)

  • Creates schemas with optional custom ID
  • Validates schema structure
  • Distributes to all nodes

Read: List available schemas (/api/v1/schemas)

  • Retrieves schema configurations
  • Shows schema metadata and structure

Delete: Remove schema definition (/api/v1/schemas)

  • Deletes schema across all nodes
  • Preserves data integrity

Data Operations

Write: Upload data to the specified schema collection (/api/v1/data/create)

  • Writes data to multiple nodes
  • Encrypts specified fields with $allot markers before distribution
  • Distributes encrypted shares marked $share across nodes

Read: Retrieve data from the specified schema collection that matches the provided filter (/api/v1/data/read)

  • Retrieves data from all nodes
  • Recombines encrypted shares marked $share from nodes to decrypts specified fields automatically
  • Returns decrypted record

Flush: Remove all documents in a schema collection (/api/v1/data/flush)

  • Removes all data across nodes from a schema collection

List the organization's schemas (/api/v1/schemas)

Usage

Standalone NilQLWrapper Example

Run examples

node examples/nilQlEncryption.js

SecretVaultWrapper Example

Copy the .env.example to create a .env file that uses the example org

cp .env.example .env

Run example to encrypt and upload data to all nodes, then read data from nodes.

node examples/readWriteSv.js

Basic setup

const secretVaultCollection = new SecretVaultWrapper(
    orgConfig.nodes,
    orgConfig.orgCredentials,
    collectionConfig.schemaId
);
await secretVaultCollection.init();

// years_in_web3 field value is marked with $allot to show it will be encrypted
const dataWritten = await secretVaultCollection.writeToNodes(
    [{
        _id: uuidv4(),
        years_in_web3: { $allot: 4 },
        responses: [
        { rating: 5, question_number: 1 },
        { rating: 3, question_number: 2 },
        ],
    },]
);