Skip to content

Commit ba9ce1a

Browse files
committed
prettier applied
1 parent 12b5534 commit ba9ce1a

File tree

166 files changed

+68534
-48339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+68534
-48339
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ coverage
44
demos
55
.circleci
66
.github
7-
.travis.yml
7+
.travis.yml
8+
CONTRIBUTING.md

.prettierrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"printWidth": 200,
3+
"singleQuote": true,
4+
"trailingComma": "none"
5+
}

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ You can use browserify or similar tools to require JIFF via npm and bundle it wi
2121
## Installation
2222

2323
Add JIFF as a dependency to your project:
24+
2425
```shell
2526
npm install jiff-mpc
2627
```
@@ -29,6 +30,7 @@ npm install jiff-mpc
2930

3031
After installing JIFF via npm, you can require the server module in your server
3132
code using:
33+
3234
```javascript
3335
const { JIFFServer } = require('jiff-mpc');
3436

@@ -40,6 +42,7 @@ http.listen(port, cb);
4042
```
4143

4244
Similarly, you can require the client module in your node.js clients using:
45+
4346
```javascript
4447
const { JIFFClient } = require('jiff-mpc');
4548

@@ -55,15 +58,18 @@ let shares = jiffClient.share(<secret>);
5558

5659
To use our bundle, include the provided pre-built JS file in a script tag. Make sure
5760
that you set up your web-server to serve this JS file.
61+
5862
```html
5963
<!-- exposes JIFFClient to the global scope -->
6064
<script src="/dist/jiff-client.js"></script>
6165
```
6266

6367
Then inside a script tag (and after the page loads), initialize a JIFF object and set up a computation:
68+
6469
```javascript
6570
const jiffClient = new JIFFClient("<server address>", "<computation_id>", <options>);
6671
```
72+
6773
The jiffClient object provides methods for sharing, opening, and performing operations on shares.
6874

6975
Alternatively, you can use the same code for both Node.js and browser-based clients, using tools
@@ -135,30 +141,34 @@ Each document is an independent tutorial. However, beginners are encouraged to v
135141
## Running Demos and Examples
136142

137143
Run a sample server from one of the demos under `demos` in the following way:
144+
138145
```shell
139146
node demos/<demo-name>/server.js
140147
```
148+
141149
The output from the example server will direct you to open `localhost:8080/demos/<demo-name>/client.html` in a browser (you must open
142150
an instance in a separate window/tab for every distinct party participating in the protocol).
143151
You can then proceed with the protocol using the client interfaces.
144152

145153
Note that you can run Node.js parties that can also participate in the protocol by executing (e.g., a separate terminal for each party):
154+
146155
```shell
147156
node demos/<demo-name>/party.js <input-value>
148157
```
149158

150159
## Documentation
151160

152161
The 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/`:
162+
153163
```shell
154164
./node_modules/.bin/jsdoc -r -c docs/jsdoc.conf.json
155165
npm run-script gen-docs # shortcut
156166
```
167+
157168
### Where to Look in the Docs
158169

159170
The documentation for the client side library is separated into the distinct modules, namespaces, and classes:
160171

161-
162172
├─ modules
163173
│ └─ jiff-client Parent module: represents the exposed JIFFClient global variable
164174
├─ classes
@@ -174,14 +184,17 @@ The documentation for the client side library is separated into the distinct mod
174184
## Running Tests
175185

176186
All of the JIFF library test cases can be run in the following way:
187+
177188
```shell
178189
npm test
179190
```
180191

181192
Demos are accompanied by test cases. The following command can be used to run the demo servers and test cases:
193+
182194
```shell
183195
npm run-script test-demo -- demos/<demo-name>
184196
```
197+
185198
The command assumes that the server is located at demos/<demo-name>/server.js and the test cases are located at demos/<demo-name>/test.js
186199
See demos/run-test.sh for instructions on running test cases located in different directories or with different names.
187200

@@ -190,13 +203,14 @@ See the [testing suite framework documentation](tests/suite/README.md) for more
190203
## Bundling
191204

192205
If you made changes to the library and would like to bundle it again into a single browser-friendly file, you can run this command:
206+
193207
```shell
194208
npm run-script build # will override dist/jiff-client.js
195209
```
196210

197211
## Development
198212

199-
The JIFF libraries allow developers to customize or extend their functionality by introducing new *hooks*. Multiple hooks can be combined to form a library *extension*.
213+
The JIFF libraries allow developers to customize or extend their functionality by introducing new _hooks_. Multiple hooks can be combined to form a library _extension_.
200214

201215
### Hooks
202216

@@ -218,11 +232,13 @@ For examples on how to use an extension, see the following files:
218232
2. `demos/sum-fixed/client.html`: using fixed point arithmetic extension in the browser.
219233

220234
Run the bignumber test suite in the following way:
235+
221236
```shell
222237
npm run-script test-bignumber
223238
```
224239

225240
## How to Contribute
241+
226242
Check out our contribution guidelines and resources @ [contributing](CONTRIBUTING.md).
227243

228244
# For Cryptographers
@@ -242,33 +258,35 @@ reduces to more traditional models in certain cases. For example, if the computa
242258
equivalent to 3-party computation with honest majority.
243259

244260
## Costs of Operations: [OUTDATED]
245-
Below is a table of the current costs of operations in the *base* JIFF without extensions:
246-
247-
248-
| Operation | Rounds | Total Messages | Preprocessing Rounds | Preprocessing Total Messages | Dependencies |
249-
|-------------------|-------------------|-----------------------------------|----------------------|----------------------------------------------|--------------|
250-
| Share | 1 | senders \* receivers | 0 | 0 | N/A |
251-
| Open | 2 | sender + sender \* receivers | 1 | senders \* senders | N/A |
252-
| +, -, c+, c-, c\* | 0 | 0 | 0 | 0 | N/A |
253-
| \* | 2 | 2\*parties + parties\*(parties-1) | 2 | 2 \* (parties \* parties - 1) | triplet,open |
254-
| <, <=, >, >= | 2\*(bits+3) | O( bits \* parties^2 ) | 3 | bits \* (2\*parties + parties^2) | \*, open |
255-
| c<, c<=, c>, c>= | 2\*(bits+3) | O( bits \* parties^2 ) | 3 | bits \* (2\*parties + parties^2) | \*, open |
256-
| =, c=, !=, c!= | 2\*(bits+4) | O( bits \* parties^2 ) | 3 | 2\*bits \* (2\*parties + parties^2) | c<, c>, \* |
257-
| / | bits^2 + 5\*bits | O( bits^2 \* parties^2 ) | 3 | bits\*(2\*bits \* (2\*parties + parties^2)) | <, c<, \* |
258-
| c/ | 2\*(bits+3) + 5 | O( bits \* parties^2 ) | 3 | 4 \* bits \* (2\*parties + parties^2) | open, \*, c< |
259-
| bits+ | 8\*bits | O( parties^2 \* bits ) | 2 | 8 \* bits \* (parties \* parties - 1) | triplet,open |
260-
| bits- | 8\*bits | O( parties^2 \* bits ) | 2 | 8 \* bits \* (parties \* parties - 1) | triplet,open |
261-
| bits* | 12\*bits | O( parties^4 \* bits^2 ) | 2 | 12 \* bits^2 \* (parties \* parties - 1)^2 | triplet,open |
262-
| bits/ | 25\*bits^2 | O( parties^2 \* bits^2 ) | 2 | 25 \* bits^2 \* (parties \* parties - 1) | triplet,open |
261+
262+
Below is a table of the current costs of operations in the _base_ JIFF without extensions:
263+
264+
| Operation | Rounds | Total Messages | Preprocessing Rounds | Preprocessing Total Messages | Dependencies |
265+
| ----------------- | ---------------- | --------------------------------- | -------------------- | ------------------------------------------- | ------------ |
266+
| Share | 1 | senders \* receivers | 0 | 0 | N/A |
267+
| Open | 2 | sender + sender \* receivers | 1 | senders \* senders | N/A |
268+
| +, -, c+, c-, c\* | 0 | 0 | 0 | 0 | N/A |
269+
| \* | 2 | 2\*parties + parties\*(parties-1) | 2 | 2 \* (parties \* parties - 1) | triplet,open |
270+
| <, <=, >, >= | 2\*(bits+3) | O( bits \* parties^2 ) | 3 | bits \* (2\*parties + parties^2) | \*, open |
271+
| c<, c<=, c>, c>= | 2\*(bits+3) | O( bits \* parties^2 ) | 3 | bits \* (2\*parties + parties^2) | \*, open |
272+
| =, c=, !=, c!= | 2\*(bits+4) | O( bits \* parties^2 ) | 3 | 2\*bits \* (2\*parties + parties^2) | c<, c>, \* |
273+
| / | bits^2 + 5\*bits | O( bits^2 \* parties^2 ) | 3 | bits\*(2\*bits \* (2\*parties + parties^2)) | <, c<, \* |
274+
| c/ | 2\*(bits+3) + 5 | O( bits \* parties^2 ) | 3 | 4 \* bits \* (2\*parties + parties^2) | open, \*, c< |
275+
| bits+ | 8\*bits | O( parties^2 \* bits ) | 2 | 8 \* bits \* (parties \* parties - 1) | triplet,open |
276+
| bits- | 8\*bits | O( parties^2 \* bits ) | 2 | 8 \* bits \* (parties \* parties - 1) | triplet,open |
277+
| bits\* | 12\*bits | O( parties^4 \* bits^2 ) | 2 | 12 \* bits^2 \* (parties \* parties - 1)^2 | triplet,open |
278+
| bits/ | 25\*bits^2 | O( parties^2 \* bits^2 ) | 2 | 25 \* bits^2 \* (parties \* parties - 1) | triplet,open |
263279

264280
Some exact costs not shown in the table:
281+
265282
1. 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)
266283
2. 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)
267284
3. 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)
268285
4. 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) )
269286
5. 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)))
270287

271288
Dependencies:
289+
272290
1. Multiplication has one message to synchronize beaver triplets and one open in sequence.
273291
2. inequality tests has 3 less than half primes in parallel, each has an open and as many multiplication in sequence as bits.
274292
3. constant inequality test has 2 less than half primes in parallel.
@@ -277,7 +295,6 @@ Dependencies:
277295
6. constant division has one open sequenced with 4 parallel constant inequality checks and two multiplications.
278296
7. Secret XORs and ORs are equivalent to a single multiplication, constant XORs and ORs are free.
279297

280-
281298
## Information and Collaborators
282299

283300
More information about this project, including collaborators and publications, can be found at [multiparty.org](https://multiparty.org/).

0 commit comments

Comments
 (0)