Merge pull request #782 from mallek/postmancollection

Add postman collection and README for general workflow
pull/850/head
Tux 2019-03-15 13:33:37 -06:00 committed by GitHub
commit eb13d35d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 326 additions and 0 deletions

View File

@ -0,0 +1,199 @@
{
"info": {
"_postman_id": "10f6b241-d6e8-4151-9a26-aa466ab76951",
"name": "NuCypher",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [{
"name": "Alice/derive_policy_pubkey",
"event": [{
"listen": "test",
"script": {
"id": "04cdbe20-68cd-479b-81a2-b146d614d426",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"console.log(jsonData.result);",
"postman.setEnvironmentVariable(\"policy_encrypting_key\", jsonData.result.policy_encrypting_key);"
],
"type": "text/javascript"
}
}],
"request": {
"method": "POST",
"header": [{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{base_uri}}:{{alice_port}}/derive_policy_pubkey/{{label}}",
"host": [
"{{base_uri}}"
],
"port": "{{alice_port}}",
"path": [
"derive_policy_pubkey",
"{{label}}"
]
}
},
"response": []
},
{
"name": "Enrico/encrypt_message",
"event": [{
"listen": "test",
"script": {
"id": "2771b0c4-3755-47cc-ac35-58105453bf46",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"console.log(jsonData.result);",
"postman.setEnvironmentVariable(\"enrico_message_kit\", jsonData.result.message_kit);",
"postman.setEnvironmentVariable(\"enrico_signature\", jsonData.result.signature)"
],
"type": "text/javascript"
}
}],
"request": {
"method": "POST",
"header": [{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}],
"body": {
"mode": "raw",
"raw": "{\n\t\"message\":\"NuVault Rocks\"\n}"
},
"url": {
"raw": "{{base_uri}}:{{enrico_port}}/encrypt_message",
"host": [
"{{base_uri}}"
],
"port": "{{enrico_port}}",
"path": [
"encrypt_message"
]
}
},
"response": []
},
{
"name": "Bob/public_keys",
"event": [{
"listen": "test",
"script": {
"id": "435cfc59-27a4-4391-8f1b-ae0ba63c36bc",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"console.log(jsonData.result);",
"postman.setEnvironmentVariable(\"bob_encrypting_key\", jsonData.result.bob_encrypting_key);",
"postman.setEnvironmentVariable(\"bob_verifying_key\", jsonData.result.bob_verifying_key);"
],
"type": "text/javascript"
}
}],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}],
"body": {
"mode": "raw",
"raw": "\n"
},
"url": {
"raw": "{{base_uri}}:{{bob_port}}/public_keys",
"host": [
"{{base_uri}}"
],
"port": "{{bob_port}}",
"path": [
"public_keys"
]
}
},
"response": []
},
{
"name": "Alice/grant",
"event": [{
"listen": "test",
"script": {
"id": "d5a7dcd3-7eba-4b50-acba-fb106af01426",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"console.log(jsonData.result);",
"postman.setEnvironmentVariable(\"alice_treasure_map\", jsonData.result.treasure_map);",
"postman.setEnvironmentVariable(\"alice_policy_encrypting_key\", jsonData.result.policy_encrypting_key)",
"postman.setEnvironmentVariable(\"alice_verifying_key\", jsonData.result.alice_verifying_key)"
],
"type": "text/javascript"
}
}],
"request": {
"method": "PUT",
"header": [{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}],
"body": {
"mode": "raw",
"raw": "{\n\t\"bob_verifying_key\": \"{{bob_verifying_key}}\",\n \"bob_encrypting_key\": \"{{bob_encrypting_key}}\",\n \"m\": 1,\n \"n\": 1,\n \"label\": \"{{label}}\",\n \"expiration_time\": \"2019-02-19T12:56:26.976816\"\n}"
},
"url": {
"raw": "{{base_uri}}:{{alice_port}}/grant",
"host": [
"{{base_uri}}"
],
"port": "{{alice_port}}",
"path": [
"grant"
]
}
},
"response": []
},
{
"name": "Bob/retrieve",
"request": {
"method": "POST",
"header": [{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}],
"body": {
"mode": "raw",
"raw": "{\n\t\"label\": \"{{label}}\",\n\t\"policy_encrypting_key\": \"{{alice_policy_encrypting_key}}\",\n\t\"alice_verifying_key\": \"{{alice_verifying_key}}\",\n\t\"datasource_signing_pubkey\": \"{{enrico_signature}}\",\n\t\"message_kit\": \"{{enrico_message_kit}}\"\n}"
},
"url": {
"raw": "{{base_uri}}:{{bob_port}}/retrieve",
"host": [
"{{base_uri}}"
],
"port": "{{bob_port}}",
"path": [
"retrieve"
]
}
},
"response": []
}
]
}

View File

@ -0,0 +1,13 @@
## Postman collection
This collection is designed to help in testing the nucypher encryption workflow. Each item is linked to environment variables that are injected into future calls.
The order to call the collection is as follows
- Alice/derive_policy_pubkey (create a policy)
- Enrico/encrypt_message (encrypt some data inside the policy)
- Bob/public_keys (Get Bob's keys so alice can grant him permission)
- Alice/grant (Grant bob permission to see the policy's data)
- Bob/retrieve (Get alice's data)
If you try to receive the data before you are granted access you will be returned a 500.

View File

@ -0,0 +1,114 @@
{
"id": "578a3d66-560a-4eb8-ba59-db439946f3f4",
"name": "dev",
"values": [{
"key": "label",
"value": "ETHDENVER",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "base_uri",
"value": "http://localhost",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "alice_port",
"value": "8151",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "bob_port",
"value": "11151",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "enrico_port",
"value": "5151",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "derive_policy_pubkey",
"value": "",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "policy_encrypting_key",
"value": "",
"enabled": true
},
{
"key": "enrico_message_kit",
"value": "",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "enrico_signature",
"value": "",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "bob_encrypting_key",
"value": "",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
},
{
"key": "bob_verifying_key",
"value": "",
"enabled": true
},
{
"key": "alice_policy_encrypting_key",
"value": "",
"enabled": true
},
{
"key": "alice_verifying_key",
"value": "",
"enabled": true
},
{
"key": "alice_treasure_map",
"value": "",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-02-18T16:37:46.501Z",
"_postman_exported_using": "Postman/6.5.2"
}