{"id":33124652,"url":"https://github.com/multiparty/jiff","last_synced_at":"2026-03-11T14:39:06.488Z","repository":{"id":21531645,"uuid":"92989930","full_name":"multiparty/jiff","owner":"multiparty","description":"JavaScript library for building web-based applications that employ secure multi-party computation (MPC).","archived":false,"fork":false,"pushed_at":"2026-02-13T15:04:28.000Z","size":159123,"stargazers_count":274,"open_issues_count":53,"forks_count":51,"subscribers_count":18,"default_branch":"master","last_synced_at":"2026-03-05T14:39:58.600Z","etag":null,"topics":["cybersecurity","javascript","javascript-library","mpc","multi-party","multi-party-computation","multiparty","multiparty-computation","privacy-enhancing-technologies","web-security"],"latest_commit_sha":null,"homepage":"https://multiparty.org/jiff/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multiparty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-31T21:23:20.000Z","updated_at":"2026-02-12T15:13:09.000Z","dependencies_parsed_at":"2023-02-14T01:45:45.038Z","dependency_job_id":"c457a10b-3816-4cbd-8e11-04cb159a98db","html_url":"https://github.com/multiparty/jiff","commit_stats":null,"previous_names":["multiparty/jiff-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/multiparty/jiff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiparty%2Fjiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiparty%2Fjiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiparty%2Fjiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiparty%2Fjiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiparty","download_url":"https://codeload.github.com/multiparty/jiff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiparty%2Fjiff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30384145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cybersecurity","javascript","javascript-library","mpc","multi-party","multi-party-computation","multiparty","multiparty-computation","privacy-enhancing-technologies","web-security"],"created_at":"2025-11-15T06:00:41.171Z","updated_at":"2026-03-11T14:39:06.479Z","avatar_url":"https://github.com/multiparty.png","language":"JavaScript","readme":"# JIFF\n\n[![CircleCI Build Status](https://circleci.com/gh/multiparty/jiff.svg?style=shield)](https://app.circleci.com/pipelines/github/multiparty/jiff)\n\nJIFF is a JavaScript library for building applications that rely on secure multi-party computation. JIFF is built to be highly flexible with a focus on usability, with the ability to be run in the browser, on mobile phones, or via Node.js. JIFF is designed so that developers need not be familiar with MPC techniques or know the details of cryptographic protocols in order to build secure applications.\n\n## Requirements\n\n### Server\n\nRunning the server requires [Node](https://nodejs.org/en/) and [npm](https://www.npmjs.com/).\n\n### Client\n\nFor browsers, we provide a bundle including the base client side library and its dependencies ([libsodium-wrappers](https://www.npmjs.com/package/libsodium-wrappers) and socket.io). Extensions have to be imported separately.\n\nFor node.js clients, npm install should install all the required dependencies.\n\nYou can use browserify or similar tools to require JIFF via npm and bundle it with your browser-side JS.\n\n## Installation\n\nAdd JIFF as a dependency to your project:\n```shell\nnpm install jiff-mpc\n```\n\n### Node.js\n\nAfter installing JIFF via npm, you can require the server module in your server\ncode using:\n```javascript\nconst { JIFFServer } = require('jiff-mpc');\n\n// create the JIFF server.\nconst jiffServer = new JIFFServer(http, options);\n\n// listen for connections.\nhttp.listen(port, cb);\n```\n\nSimilarly, you can require the client module in your node.js clients using:\n```javascript\nconst { JIFFClient } = require('jiff-mpc');\n\n// create a jiff client.\nconst jiffClient = new JIFFClient(\"\u003cserver address\u003e\", \"\u003ccomputation_id\u003e\", \u003coptions\u003e);\n\n// perform some computation.\nlet shares = jiffClient.share(\u003csecret\u003e);\n...\n```\n\n### Client - Browser\n\nTo use our bundle, include the provided pre-built JS file in a script tag. Make sure\nthat you set up your web-server to serve this JS file.\n```html\n\u003c!-- exposes JIFFClient to the global scope --\u003e\n\u003cscript src=\"/dist/jiff-client.js\"\u003e\u003c/script\u003e\n```\n\nThen inside a script tag (and after the page loads), initialize a JIFF object and set up a computation:\n```javascript\nconst jiffClient = new JIFFClient(\"\u003cserver address\u003e\", \"\u003ccomputation_id\u003e\", \u003coptions\u003e);\n```\nThe jiffClient object provides methods for sharing, opening, and performing operations on shares.\n\nAlternatively, you can use the same code for both Node.js and browser-based clients, using tools\nsuch as [browserify](https://browserify.readthedocs.io/en/latest/readme/).\n\nTo do this, require JIFF from npm in your client JS code normally, e.g. using `const { JIFFClient } = require('jiff-mpc');`,\nand then build your JS code into a bundle using browserify. You can then serve that bundle\nvia your web server, and include it in your HTML using script tags.\n\nTo see an example of this, look at this [JIFF standalone example repo](https://github.com/multiparty/jiff-standalone-example).\n\n### Extensions\n\nIf you want to support more complex data types, such as Fixedpoint numbers or infinite precision integers,\nyou should apply the corresponding extension to your client and/or server JIFF instances.\n\nThe extensions can be imported via npm, bundled into web clients via browserify, or included directly via\nscript tags into the browser.\n\n```javascript\n// Server\nconst { JIFFServer, JIFFServerBigNumber } = require('jiff-mpc');\nconst jiffServer = new JIFFServer(http, options);\njiffServer.apply_extension(JIFFServerBigNumber);\n\n// Client using node.js or browserify.\nconst { JIFFClient, JIFFClientBigNumber } = require('jiff-mpc');\nconst jiffClient = new JIFFClient(\"\u003cserver address\u003e\", \"\u003ccomputation_id\u003e\", {\n  autoConnect: false,\n  \u003cother options\u003e\n});\njiffClient.apply_extension(JIFFClientBigNumber, options);\njiffClient.connect();\n```\n\n```html\n\u003c!-- Plain JS without browserify --\u003e\n\u003c!-- include the extension and any of its dependencies directly using script tags --\u003e\n\u003c!-- make sure your web server serves these files at the corresponding URLs --\u003e\n\u003cscript src=\"/bignumber.js/bignumber.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/lib/ext/jiff-client-bignumber.js\"\u003e\u003c/script\u003e\n```\n\n## Project Layout\n\n    ├─ demos/               Example of common jiff use-cases and functionality\n    ├─ docs/                JSDoc config and generated docs\n    ├─ lib/                 Libraries for both client and server-side jiff instances\n    │  ├─ client/           Implementation of the client side library\n    │  ├─ server/           Implementation of the server side library\n    │  ├─ ext/              Extended functionality for use cases (e.g. negative numbers): Includes server and client extensions\n    │  ├─ common/           Some common helpers between both client and server code\n    │  ├─ jiff-client.js    Main module for the client side library, include this (or the bundle under dist/) in your projects\n    │  └─ jiff-server.js    Main module for the server side library, include this in your server code\n    ├─ test/                Unit testing for base Jiff, demos, and extensions\n    │  ├─ dev/              Limited tests for testing some features under development\n    │  ├─ live/             Template and setup for live coding with JIFF with nodejs's command line shell (REPL)\n    │  └─ suite/            Base Jiff and extension tests (See test/suite/README.md)\n    ├─ tutorial/            Contains interactive tutorial files that can be run locally to learn JIFF!\n\n## Running Tutorials\n\nClone the github repo, and run `npm run tutorial` inside its root directory.\n\nOn your terminal, you will see a list of \"Routes/Documents\". Open either document in your browser to go through the tutorial.\n\nEach document is an independent tutorial. However, beginners are encouraged to view them in order.\n\n## Running Demos and Examples\n\nRun a sample server from one of the demos under `demos` in the following way:\n```shell\nnode demos/\u003cdemo-name\u003e/server.js\n```\nThe output from the example server will direct you to open `localhost:8080/demos/\u003cdemo-name\u003e/client.html` in a browser (you must open\nan instance in a separate window/tab for every distinct party participating in the protocol).\nYou can then proceed with the protocol using the client interfaces.\n\nNote that you can run Node.js parties that can also participate in the protocol by executing (e.g., a separate terminal for each party):\n```shell\nnode demos/\u003cdemo-name\u003e/party.js \u003cinput-value\u003e\n```\n\n## Documentation\n\nThe latest documentation can be viewed on the [project page](https://multiparty.org/jiff/). The documentation can be generated using [JSDoc](http://usejsdoc.org/); you will find these docs in `docs/jsdocs/`:\n```shell\n./node_modules/.bin/jsdoc -r -c docs/jsdoc.conf.json\nnpm run-script gen-docs # shortcut\n```\n### Where to Look in the Docs\n\nThe documentation for the client side library is separated into the distinct modules, namespaces, and classes:\n\n\n    ├─ modules\n    │  └─ jiff-client            Parent module: represents the exposed JIFFClient global variable\n    ├─ classes\n    │  ├─ JIFFClient             Represents a client side jiff instance including the main API of JIFF\n    │  ├─ SecretShare            Contains the API for SecretShare objects\n    │  ├─ GuardedSocket          Internal wrapper around socket.io for added reliability\n    │  └─ Deferred               Polyfill to construct deferred from native Promises\n    ├─ namespaces\n    │  ├─ protocols              Common protocols exposed by jiff client instances, suitable for preprocessing\n    │  ├─ bits                   Primitives for operating on bit-wise shared secrets (hybrid protocols)\n    │  └─ hooks                  Available hooks that can be used by users to customize behavior\n\n## Running Tests\n\nAll of the JIFF library test cases can be run in the following way:\n```shell\nnpm test\n```\n\nDemos are accompanied by test cases. The following command can be used to run the demo servers and test cases:\n```shell\nnpm run-script test-demo -- demos/\u003cdemo-name\u003e\n```\nThe command assumes that the server is located at demos/\u003cdemo-name\u003e/server.js and the test cases are located at demos/\u003cdemo-name\u003e/test.js\nSee demos/run-test.sh for instructions on running test cases located in different directories or with different names.\n\nSee the [testing suite framework documentation](tests/suite/README.md) for more details on running and creating tests for the JIFF library.\n\n## Bundling\n\nIf you made changes to the library and would like to bundle it again into a single browser-friendly file, you can run this command:\n```shell\nnpm run-script build # will override dist/jiff-client.js\n```\n\n## Development\n\nThe JIFF libraries allow developers to customize or extend their functionality by introducing new *hooks*. Multiple hooks can be combined to form a library *extension*.\n\n### Hooks\n\nThe JIFF client and server libraries support hooks. Hooks can be provided in the options parameter during instantiation or afterwards. Hooks allow the introduction of custom functionality to be executed at critical times during the computation, or the introduction of different implementations of specified primitives and operations (e.g. using a different sharing scheme).\n\nThe client-side [hooks documentation](lib/ext/Hooks.md) provides more details. If hooks are used to provide important reusable functionality, then it is recommended to bundle these hooks within a JIFF extension.\n\n### Extensions\n\nJIFF supports implementing extensions on top of the base implementations that can provide additional extended functionality. Some extensions can be found under `lib/ext`. Two important modules are implemented and provided in this repository: bignumbers and fixed point arithmetic.\n\nSee the [extensions documentation](lib/ext/README.md) and the documentation inside `src/ext/jiff-client-bignumber.js` for instructions on how to create additional extensions.\n\nBoth client and server libraries support extensions. Some extensions require customizing both the server and client libraries to behave properly (such as the bignumbers extension). Other extensions may require only server or client-side modifications (e.g., the fixed point arithmetic module is only client-side). A server that wants to participate in the computation would require only the client-side extension to use the additional functionality (unless, of course, that extension depends on additional server-side modifications as in bignumbers).\n\nFor examples on how to use an extension, see the following files:\n\n1. `demos/sum-fixed/server.js`: using the server with the Node bignumber.js module.\n2. `demos/sum-fixed/client.html`: using fixed point arithmetic extension in the browser.\n\nRun the bignumber test suite in the following way:\n```shell\nnpm run-script test-bignumber\n```\n\n## How to Contribute\nCheck out our contribution guidelines and resources @ [contributing](CONTRIBUTING.md).\n\n# For Cryptographers\n\n## Security Model and Assumptions\n\nJIFF is secure against semi-honest adversaries.\n\nJIFF's default preprocessing protocol for beaver triples generation is based on bgw. All protocols that depend on triplets/multiplication are\nsecure with an honest majority in the preprocessing phase, and against a dishonest majority in the online stage. This is important, since the parties\nperforming the preprocessing may be different than the ones carrying out the online computation.\n\nIf preprocessing is not used, and `crypto_provider` option is set to true during instance creation, JIFF will acquire all required\ncorelated randomness and preprocessing material from the server. This yields an asymetric trust model, where the computation is secure\nagainst a dishonest majority of non-server parties, but insecure against coalitions of one or more party plus the server. Conretely, this\nreduces to more traditional models in certain cases. For example, if the computation is made out of two parties and a server, this becomes\nequivalent to 3-party computation with honest majority.\n\n## Costs of Operations: [OUTDATED]\nBelow is a table of the current costs of operations in the *base* JIFF without extensions:\n\n\n| Operation         | Rounds            | Total Messages                    | Preprocessing Rounds | Preprocessing Total Messages                 | Dependencies |\n|-------------------|-------------------|-----------------------------------|----------------------|----------------------------------------------|--------------|\n| Share             | 1                 | senders \\* receivers              | 0                    | 0                                            | N/A          |\n| Open              | 2                 | sender + sender \\* receivers      | 1                    | senders \\* senders                           | N/A          |\n| +, -, c+, c-, c\\* | 0                 | 0                                 | 0                    | 0                                            | N/A          |\n| \\*                | 2                 | 2\\*parties + parties\\*(parties-1) | 2                    | 2 \\* (parties \\* parties - 1)                | triplet,open |\n| \u003c, \u003c=, \u003e, \u003e=      | 2\\*(bits+3)       | O( bits \\* parties^2 )            | 3                    | bits \\* (2\\*parties + parties^2)             | \\*, open     |\n| c\u003c, c\u003c=, c\u003e, c\u003e=  | 2\\*(bits+3)       | O( bits \\* parties^2 )            | 3                    | bits \\* (2\\*parties + parties^2)             | \\*, open     |\n| =, c=, !=, c!=    | 2\\*(bits+4)       | O( bits \\* parties^2 )            | 3                    | 2\\*bits \\* (2\\*parties + parties^2)          | c\u003c, c\u003e, \\*   |\n| /                 | bits^2 + 5\\*bits  | O( bits^2 \\* parties^2 )          | 3                    | bits\\*(2\\*bits \\* (2\\*parties + parties^2))  | \u003c, c\u003c, \\*    |\n| c/                | 2\\*(bits+3) + 5   | O( bits \\* parties^2 )            | 3                    | 4 \\* bits \\* (2\\*parties + parties^2)        | open, \\*, c\u003c |\n| bits+             | 8\\*bits           | O( parties^2 \\* bits )            | 2                    | 8 \\* bits \\* (parties \\* parties - 1)        | triplet,open | \n| bits-             | 8\\*bits           | O( parties^2 \\* bits )            | 2                    | 8 \\* bits \\* (parties \\* parties - 1)        | triplet,open |\n| bits*             | 12\\*bits          | O( parties^4 \\* bits^2 )          | 2                    | 12 \\* bits^2 \\* (parties \\* parties - 1)^2   | triplet,open |\n| bits/             | 25\\*bits^2        | O( parties^2 \\* bits^2 )          | 2                    | 25 \\* bits^2 \\* (parties \\* parties - 1)     | triplet,open |\n\nSome exact costs not shown in the table:\n1. Exact total number of messages for secret inequalities is: 3\\*(parties + parties^2 + (bits+1) \\* (2\\*parties + parties\\*(parties-1))) + 2\\*parties + parties\\*(parties-1)\n2. Exact total number of messages for constant inequalities is: 2\\*(parties + parties^2 + (bits+1) \\* (2\\*parties + parties\\*(parties-1))) + 2\\*parties + parties\\*(parties-1)\n3. Exact total number of messages for equality checks: 2\\*(\\*(parties + parties^2 + (bits+1) \\* (2\\*parties + parties\\*(parties-1))) + 2\\*parties + parties\\*(parties-1)) + 2\\*parties + parties\\*(parties-1)\n4. Exact total number of messages for division is: bits \\* ( 5\\*(parties + parties^2 + (bits+1) \\* (2\\*parties + parties\\*(parties-1))) + 2\\*parties + parties\\*(parties-1) + 2\\*parties + parties\\*(parties-1) )\n5. Exact total number of messages for constant division is: 1 + 7\\*parties + 4\\*parties^2 + 8\\*(parties + parties^2 + (bits+1) \\* (2\\*parties + parties\\*(parties-1)))\n\nDependencies:\n1. Multiplication has one message to synchronize beaver triplets and one open in sequence.\n2. inequality tests has 3 less than half primes in parallel, each has an open and as many multiplication in sequence as bits.\n3. constant inequality test has 2 less than half primes in parallel.\n4. equality and constant equality tests have 2 inequalities in parallel, sequenced with a multiplication.\n5. division has as many sequential iterations as bits, each iteration contains a constant inequality, secret inequality, and multiplication.\n6. constant division has one open sequenced with 4 parallel constant inequality checks and two multiplications.\n7. Secret XORs and ORs are equivalent to a single multiplication, constant XORs and ORs are free.\n\n\n## Information and Collaborators\n\nMore information about this project, including collaborators and publications, can be found at [multiparty.org](https://multiparty.org/).\n","funding_links":[],"categories":["Software"],"sub_categories":["Frameworks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiparty%2Fjiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiparty%2Fjiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiparty%2Fjiff/lists"}