Catalog npm
Back to packageRELEASE DETAILS

0.4.0

npm

1-out-of-n

1-out-of-n oblivious transfer

1-in-n1-out-of-nobliviousoblivious-transferottransfer
Published11 Aug 2020
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

1-out-of-n

1-out-of-n oblivious transfer protocol in JavaScript

Protocol

To create 1-out-of-N, we use log2(N) 1-out-of-2 oblivious transfers of random bits to create log2(N) random strings. Each secret is masked with one of these strings (by XOR) and the receiving party picks one after which the sender reveals all the masked secrets.

We build 1-out-of-N OT by composing random 1-out-of-N and multiple 1-out-of-2 oracles. This is the same protocol as described in Oblivious Transfer and Polynomial Evaluation pp. 247-248.

Project layout

├─ index.js           Module entry point (include this or use npm)
├─ lib/               Library source
│  ├─ ot.js             Oblivious transfer protocols
│  ├─ util.js           Bitwise helpers
│  └─ crypto.js         Crypto primitives
└─ demo/              Example demos
   ├─ io-example.js     Input-output communication for the demos
   ├─ io-template.js    IO methods template
   ├─ strings/          Strings demo
   │  ├─ example.js       OT choosing from strings
   │  └─ ascii.js         ASCII helpers to convert inputs to Uint8Array
   └─ numbers/          Numbers demo
      └─ example.js       OT choosing from numbers

Installation

You may also install this module from npm.

npm install 1-out-of-n

Calling the API

The process generally works as follows:

// Each party includes the 1-out-of-n module with IO:
const OT = require('1-out-of-n')(IO);

// 1-out-of-3
const N = 3;

// The sender calls send and provides its secrets:
OT.send([77, 66, 88], N);

// The receiver calls receive with its selection out of N:
OT.receive(2, N).then(console.log.bind(null, 'Secret #2 is:'));

// Result:
66

Note that the latest version expects to get an array of Uint8Array as inputs, so if you are working with numbers larger than 8 bits, it is strongly recommended to use the Uint8Array byte array type to represent your number choices. Please read strings/example.js for a more detailed example or run it with node demo/*/example.js.

Test suite

The example demos in demo/numbers/example.js and demo/strings/example.js test both a basic, and slightly more advanced usage of the library. You may run them individually, or use the pre-configured test script by running npm test. All versions and releases have tests passing.

Code linting

Please run npm run-script lint-fix before submitting a pull request.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
libsodium-wrappers-sumo
Environment
{
  "local_name": "libsodium-wrappers-sumo",
  "alias": false,
  "peer_metadata": null
}
^0.7.6runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-42GVLjJx4j2KZUFJocs1ZeavPY58yetOx2bQyJMzoD7Rw7Ru9/otXJ/weeDb65pASdvDPePGtxKmW+Msz8IQsw==",
  "shasum": "9d08f85eafd0bf4b04d8e8b0ec8897829e031bc2",
  "tarball": "https://registry.npmjs.org/1-out-of-n/-/1-out-of-n-0.4.0.tgz",
  "fileCount": 7,
  "unpackedSize": 13241,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMq35CRA9TVsSAnZWagAApvAP/3L5m13kXy6e14TFSM6y\nXN0R+aOvFu8dWfQTlXt15Tr875lVPsZpnhywP+XNZPms+5UKEtvlkJ2Q9Qmd\nsRKep0Klozwn8JwXt2wfL5R3QwFTtdq3TfsIgoTJFEaZxuWR6XZ0O7ReEIO7\nLjXqgPwUZmqurSeGUwPwwjnyH7fVNdMmeilpA3uoro326zLi41Lfy4xpJH9r\nFmuxGLH/8vJBonWR6yp6Zpv13Z0olVcTjpUwF2VRBPaZtMUrIe1xfyo5uMrj\n9zL689ksMtv0tv1/3DAeUpxotiHwjsikLMzCiEeA9QcbZUye9cEaElc9CmMz\nMOXihIlpXihRZv+DX7ZLyvsb0T7SetHMEFjvDaxxdXDrOHe8T5FjwGJxrO4e\nXACS6nNy4SpLAs8uSvS2pTAHc44JH3GYkPYru4MI0NTkzPMxn0JNCIb4motF\nbaCzcrNELJy5pjcpoJ94UKoH6IO8bTuici4n6qC48c+mwBXm3LSfNwKBQyxE\nORmFVjXHvxtMHdjECtdLwM3UAC+sIN0wKiIhsCevnjSBpeTLGNe3mONya/aW\n+N0b0NcyRT1/diWDOdpJTsA3uihJYddlSM/OG5C2SI7xQ6hfgnARSpX6ae3G\nRtzect2tb3U7ab8LQTLqPK3vTTMNlAlx+zXz9CIsv09AVmYhMMDcqKqgkswV\n/x4K\r\n=63Yo\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQCBhIMpiLlXQlNXMwSjnl7UdLJETTQvHsWtc0RFqFvxeAIhAOtnZ786yDLYZkLfBI+p/dCK27hKWFE3nNOwnRbQkS9i"
    }
  ]
}

Repository

PENDING
wyatt-howe/1-out-of-n

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:55 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:3afe2e5be2c1befd96f9061a55001035db6a5645a2bbc6530dca8695e3286485

Other collected versions

0.4.311 Aug0.4.211 Aug0.4.111 Aug0.3.110 Jul0.3.010 Jul0.2.16 JulView all collected versions →