New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nillion/nilql

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nillion/nilql

Library for working with encrypted data within NilDB queries and replies.

  • 0.0.0-alpha.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

nilQL

npm ci coveralls

Library for working with encrypted data within nilDB queries and replies.

Description and Purpose

This library provides cryptographic operations that are compatible with nilDB nodes and clusters, allowing developers to leverage certain privacy-enhancing technologies (PETs) when storing, operating upon, and retrieving data while working with nilDB. The table below summarizes the functionalities available in nilQL.

ClusterOperationImplementation DetailsSupported Types
single nodestoreXSalsa20 stream cipher and Poly1305 MAC32-bit signed integer; UTF-8 string (<4097 bytes)
single nodematchdeterministic salted hashing via SHA-51232-bit signed integer; UTF-8 string (<4097 bytes)
single nodesumnon-deterministic Paillier with 2048-bit primes32-bit signed integer
multiple nodesstoreXOR-based secret sharing32-bit signed integer; UTF-8 string (<4097 bytes)
multiple nodesmatchdeterministic salted hashing via SHA-51232-bit signed integer; UTF-8 string (<4097 bytes)
multiple nodessumadditive secret sharing with modulus 2^3232-bit signed integer

Package Installation and Usage

The package can be installed using pnpm:

pnpm install

The library can be imported in the usual way:

import { nilql } from "@nillion/nilql";

An example demonstrating use of the library is presented below:

const cluster = {"nodes": [{}, {}]};
const secretKey = await nilql.SecretKey.generate(cluster, {"sum": true});
const plaintext = BigInt(123);
const ciphertext = await nilql.encrypt(secretKey, plaintext);
const decrypted = await nilql.decrypt(secretKey, ciphertext);
console.log(plaintext, decrypted); // Should output `123n 123n`.

Testing and Conventions

All unit tests are executed and their coverage measured with vitest:

pnpm test

Style conventions are enforced using biomejs:

pnpm lint

Types are checked with:

pnpm typecheck

Contributions

In order to contribute, open an issue or submit a pull request on the GitHub. To enforce conventions, git hooks are provided and can be setup with:

pnpm install-hooks

Versioning

The version number format for this library and the changes to the library associated with version number increments conform with Semantic Versioning 2.0.0.

FAQs

Package last updated on 21 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc