A brief documentation is provided here to get started. For full specs, consult the Functional Specifications document.
To list the available box types:
GET https://nonlocalbox.wigner.hu/api/v1/listBoxTypes?apiKey=$API_KEY
| Parameter | Description |
|---|---|
| apiKey | apiKey |
{"boxTypes":[[1,"PR"],[2,"Bell"],[3,"MagicSquare"]],"status":0}
Status code
| Code | Description |
|---|---|
| 0 | OK |
| 1 | Permission denied: wrong apiKey |
The first two box types are the Popescu-Rohrlich (PR, boxID=1) and the Bell (boxID=2) boxes. To create a box (i.e. invite a partner), the box type ID will be needed.
GET https://nonlocalbox.wigner.hu/api/v1/invitePartner?apiKey=$ALICE\_KEY&boxTypeID=1&inviteUserName=bob&boxName=ourFirstPRbox
| Parameter | Description |
|---|---|
| apiKey | apiKey of the inviter |
| inviteUserName | username of the user to invite |
| boxTypeID | the type of box to create |
| boxName | the name of box to create |
{"boxID":42,"status":0}
Status codes
| Code | Description |
|---|---|
| 0 | OK |
| 1 | Permission denied: wrong apiKey |
| 2 | Box quota exceeded |
| 3 | Invited user does not exist |
| 4 | Invalid box type |
Note: The API is not designed to do any communication, it is restricted to the emulation of the nonlocal box. The partner’s notification on the invitation or any other necessary communication should be done with some other tool.
Use box ID 42 in transaction 2022021701 as Alice, sending x=0 as input:
GET https://nonlocalbox.wigner.hu/api/v1/useBox?apiKey=$APIKEY&boxID=42&transactionID=2022021701&x=0
Typical output:
{"a":0,"boxID":42,"status":0}
Use box ID 42 in transaction 2022021701 as Bob, sending 1 as an input:
GET https://nonlocalbox.wigner.hu/api/v1/useBox?apiKey=$APIKEY&boxID=42&transactionID=2022021701&y=1
| Parameter | Description |
|---|---|
| apiKey | api key |
| boxID | ID of the box |
| transactionID | ID of the transaction |
| x | Alice input; either x or y is needed, cannot give both |
| y | Bob input; either x or y is needed, cannot give both |
{"b":0,"boxID":42,"status":0}
Status codes
| Code | Description |
|---|---|
| 0 | OK |
| 1 | Permission denied to box, nonexistent box or wrong apiKey |
| 2 | Inconsistent data, the transaction completed before with different input |
| 3 | Invalid role. Alice gave y or Bob gave x |
| a | the output of the box towards Alice |
| b | the output of the box towards Bob |
This lists all the boxes where the given user is the inviter, i.e. Alice:
GET https://nonlocalbox.wigner.hu/api/v1/listBoxes?apiKey=$APIKEY
| Parameter | Description |
|---|---|
| apiKey | api key |
{"boxes":[{"aliceUser":"20","bobUser":"21","boxTypeID":"1","created":"2022-09-14 16:14:20","id":"4","name":"ourPRbox"}],"status":0}
| Code | Description |
|---|---|
| 0 | OK |
| 1 | Permission denied: wrong apiKey |
Note: boxes where the user is the invitee (i.e. plays the role of Bob) cannot be listed as it would enable the users to communicate using the API.