new Agent(role, hostname, optionsopt)
- Source:
Create a new JIGG agent with the given role.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
role |
string | Agent role ('Garbler' or 'Evaluator'). |
|
hostname |
string | hostname and port of the server, should be acceptable by socket.io. |
|
options |
object |
<optional> |
additional optional options including: debug: boolean, defaults to false. labelSize: number, defaults to 16 bytes. |
Methods
addProgressListener(progressListener)
- Source:
Adds a listener for progress events.
Parameters:
Name | Type | Description |
---|---|---|
progressListener |
module:JIGG~progressListener | the listener. |
disconnect()
- Source:
Disconnects the socket with the server.
getOutput(encodingopt) → {Promise}
- Source:
Returns a promise to the output encoded as specified by the encoding.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
encoding |
<optional> |
'bits'
|
the encoding of the input, defaults to 'bits' for array of 0|1. The order of bits depends on the underlying circuit, but typically, index 0 represents the least significant bit. Alternatively, it accepts 'number' and 'hex' for a number and a hex string. |
Returns:
a promise to the output, which is either number, number[], or string.
- Type
- Promise
loadCircuit(circuit, encodingopt)
- Source:
Loads the given circuit.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
circuit |
string | Circuit | the circuit encoded as specified in encoding. |
||
encoding |
string |
<optional> |
'text'
|
the encoding of the circuit, defaults to 'text' indicating a text encoding of a bristol fashion circuit. Alternatively, 'object' can be used for parsed circuits provided as a Circuit object. |
setInput(input, encodingopt)
- Source:
Sets the input of this party.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input |
Array.<number> | number | string | the input to the circuit. |
||
encoding |
<optional> |
'bits'
|
the encoding of the input, defaults to 'bits' for array of 0|1. The order of bits depends on the underlying circuit, but typically, index 0 represents the least significant bit. Alternatively, it accepts 'number' and 'hex' for a number and a hex string. |
start()
- Source:
Run the agent on the circuit.