Skip to content

JavaScript library that serves as an API for common primitives used to implement OPRF and OT protocols.

License

Notifications You must be signed in to change notification settings

nthparty/oblivious-js

Repository files navigation

oblivious-js

npm version GitHub Actions Status Coverage Status

JavaScript library that serves as an API for common primitives used to implement OPRF and OT protocols.

Purpose

This library provides TypeScript libsodium wrappers for cryptographic primitives that are often used to implement oblivious pseudorandom function (OPRF) and oblivious transfer (OT) protocols.

For more information on the underlying mathematical structures and primitives, consult materials about the Ed25519 system and the Ristretto group.

Package Installation and Usage

The package is available on npm:

npm install @nthparty/oblivious

The library can be imported in the usual ways:

const Oblivious = require('path/to/dist/oblivious.js');  // Standalone
const Oblivious = require('path/to/dist/oblivious.slim.js')(sodium);  // Slim
const { Oblivious } = require('@nthparty/oblivious');  // Node.js

Oblivious.ready.then(function () {
    const p = Oblivious.Point.random();
    console.log(p);  // Point(32) [Uint8Array] [ ... ]
});

The latest browser-optimized distributions can be found here.

Testing and Conventions

All unit tests are executed and their coverage measured when using Jest (see jest.config.js for configuration details):

npm test

Browser-based tests are located in test/browser/, and you can run them either locally, or by visiting the preview.

Style conventions are enforced using ESLint:

eslint src test/oblivious.test.ts
# -OR-
npm run-script lint

Contributions

In order to contribute to the source code, open an issue or submit a pull request on the GitHub page for this library. Remember to run npm run-script lint on any proposed code changes.

Versioning

Beginning with version 0.1.0, 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.

About

JavaScript library that serves as an API for common primitives used to implement OPRF and OT protocols.

Resources

License

Stars

Watchers

Forks