{"size": 1178, "ext": "js", "max_stars_repo_path": "demo/strings/example.js", "max_stars_repo_name": "wyatt-howe/1-out-of-n", "max_stars_repo_stars_event_min_datetime": "2020-06-17T15:04:14.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-21T14:21:53.000Z", "max_issues_repo_path": "demo/strings/example.js", "max_issues_repo_name": "wyatt-howe/1-out-of-n", "max_issues_repo_issues_event_min_datetime": "2020-07-24T17:18:30.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-24T17:18:30.000Z", "max_forks_repo_path": "demo/strings/example.js", "max_forks_repo_name": "wyatt-howe/1-out-of-n", "max_forks_repo_forks_event_min_datetime": "2020-07-24T16:19:02.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-24T16:19:02.000Z"}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 26.1777777778, "max_line_length": 87, "alphanum_fraction": 0.6332767402}
const ascii = require('./ascii.js');

/*
 *  This is the setup for a secure 1-out-of-11 oblivious transfer using
 *  the methods in IO to send public messages between the two parties.
 */
var IO = require('../io-example.js');
const OT = require('1-out-of-n')(IO);
const N = 11;
const op_id = '1in11ot';  // OPTIONAL op_id string
const session_id = '1,2';  // OPTIONAL string to specify participants
const extra_arg_1 = 'str_1';  // OPTIONAL extra parameters
const extra_arg_2 = 'str_2';  // (We can pass multiple, if needed for the IO.)

OT.then(function (OT) {

  /*
   *  The sender calls:
   */
  const secrets = [
    'A zeroth secret!',
    'A first secret!!',
    'A second secret!',
    'A third secret!!',
    'A fourth secret!',
    'A fifth secret!!',
    'A sixth secret!!',
    'A seventh secret',
    'A eighth secret!',
    'A nineth secret!',
    'A tenth secret!!'
  ].map(ascii.to_array);

  OT.send(secrets, N, op_id, session_id, extra_arg_1, extra_arg_2);


  /*
   *  The receiver calls:
   */
  OT.receive(6, N, op_id, session_id, extra_arg_1, extra_arg_2).then(function (array) {
    console.log('The chosen secret is:', ascii.to_ascii(array));
  });

});
