Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(readme): make it more immediately clear re: batching #34

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Oprf.Suite.P521_SHA512

#### Step 1

First setup a client and a server. In this case, we use the VOPRF mode with suite P384-SHA384.
First set up a client and a server. In this case, we use the VOPRF mode with suite P384-SHA384.

```js
import {
Expand All @@ -49,40 +49,42 @@ const client = new VOPRFClient(suite, publicKey);

#### Step 2

The client prepares arbitrary input that will be evaluated by the server, the blinding method produces an evaluation request, and some finalization data to be used later. Then, the client sends the evaluation request to the server.
The client prepares arbitrary input[s] that will be batch evaluated by the server. The blinding method produces an evaluation request, and some finalization data to be used later. Then, the client sends the evaluation request to the server.

```js
const input = new TextEncoder().encode("This is the client's input");
const [finData, evalReq] = await client.blind([input]);
const batch = [input]
const [finData, evalReq] = await client.blind(batch);
```

#### Step 3

Once the server received the evaluation request, it responds to the client with an evaluation.

```js
const evaluation = await server.evaluate(evalReq);
const evaluation = await server.blindEvaluate(evalReq);
armfazh marked this conversation as resolved.
Show resolved Hide resolved
```

#### Step 4

Finally, the client can produce the output of the OPRF protocol using the server's evaluation and the finalization data from the second step. If the mode is verifiable, this step allows the client to check the proof that the server used the expected private key for the evaluation.
Finally, the client can produce the output[s] of the OPRF protocol using the server's evaluation and the finalization data from the second step. If the mode is verifiable, this step allows the client to check the proof that the server used the expected private key for the evaluation.

```js
const output = await client.finalize(finData, evaluation);
// Get output matching first input of batch
const [output] = await client.finalize(finData, evaluation);
```

### Development

| Task | NPM scripts |
|--|--|
| Installing | `$ npm ci` |
| Building | `$ npm run build` |
| Unit Tests | `$ npm run test` |
| Examples | `$ npm run examples` |
| Benchmarking | `$ npm run bench` |
| Code Linting | `$ npm run lint` |
| Code Formating | `$ npm run format` |
| Task | NPM scripts |
|-----------------|----------------------|
| Installing | `$ npm ci` |
| Building | `$ npm run build` |
| Unit Tests | `$ npm run test` |
| Examples | `$ npm run examples` |
| Benchmarking | `$ npm run bench` |
| Code Linting | `$ npm run lint` |
| Code Formatting | `$ npm run format` |


**Dependencies**
Expand Down