From 3883606810492f86807d86c51b9b44e4ee5cca50 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 3 Apr 2020 08:39:38 -0700 Subject: [PATCH 1/8] Added --self-attested parameter to demo Signed-off-by: Ian Costanzo --- demo/run_demo | 9 +++++++++ demo/runners/faber.py | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/demo/run_demo b/demo/run_demo index e857806d14..2f6854d2d8 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -23,6 +23,10 @@ do fi continue ;; + --self-attested) + SELF_ATTESTED=1 + continue + ;; --trace-log) TRACE_TARGET=log TRACE_TAG=acapy.events @@ -62,6 +66,7 @@ do echo "For example, to create the directory and then set the permissions use: 'mkdir ../logs; chmod uga+rws ../logs'" exit 1 fi + continue ;; --bg) if [[ "${AGENT}" == "alice" ]] || [[ "${AGENT}" == "faber" ]] || [[ "${AGENT}" == "acme" ]]; then @@ -90,6 +95,7 @@ Usage: --bg - run the agent in the background; for use when using OpenAPI/Swagger interface --trace-log - log events to the standard log file --trace-http - log events to an http endmoint specified in env var TRACE_TARGET_URL + --self-attested - inlcude a self-attested attribute in the proof request/response debug options: --debug-pycharm-agent-port ; --debug-pycharm-controller-port --debug-pycharm; --debug-ptvsd @@ -159,6 +165,9 @@ fi if ! [ -z "$EVENTS" ]; then DOCKER_ENV="${DOCKER_ENV} -e EVENTS=1" fi +if ! [ -z "$SELF_ATTESTED" ]; then + DOCKER_ENV="${DOCKER_ENV} -e SELF_ATTESTED=${SELF_ATTESTED}" +fi if ! [ -z "$TRACE_TARGET" ]; then DOCKER_ENV="${DOCKER_ENV} -e TRACE_TARGET=${TRACE_TARGET}" DOCKER_ENV="${DOCKER_ENV} -e TRACE_TAG=${TRACE_TAG}" diff --git a/demo/runners/faber.py b/demo/runners/faber.py index c46fa22ccd..c0ed3d2ccc 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -24,6 +24,7 @@ CRED_PREVIEW_TYPE = ( "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/credential-preview" ) +SELF_ATTESTED = os.getenv("SELF_ATTESTED") LOGGER = logging.getLogger(__name__) @@ -286,8 +287,9 @@ async def main( req_attrs.append( {"name": "degree", "restrictions": [{"issuer_did": agent.did}]} ) - # test self-attested claims - req_attrs.append({"name": "self_attested_thing"},) + if SELF_ATTESTED: + # test self-attested claims + req_attrs.append({"name": "self_attested_thing"},) req_preds = [ # test zero-knowledge proofs { From a25123ef686bb79f8c6479e864f9829d1e6b458e Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 3 Apr 2020 09:56:53 -0700 Subject: [PATCH 2/8] Cleanup revocation registry commands Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index e74aec14e3..8eab10bbb4 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -219,6 +219,7 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr # Update the revocation registry with the public URL to the tails file tails_file_admin_url = f"{self.admin_url}/revocation/registry/{revocation_registry_id}/tails-file" tails_file_url = f"{self.public_tails_url}/revocation/registry/{revocation_registry_id}/tails-file" + tails_file_external_url = f"http://{DEFAULT_EXTERNAL_HOST}/revocation/registry/{revocation_registry_id}/tails-file" revoc_updated_response = await self.admin_PATCH( f"/revocation/registry/{revocation_registry_id}", { @@ -226,14 +227,20 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr } ) tails_public_uri = revoc_updated_response["result"]["tails_public_uri"] - log_msg(f"Revocation Registry Tails File Admin URL: {tails_file_admin_url}") - log_msg(f"Revocation Registry Tails File URL: {tails_public_uri}") - log_msg(f"================") - log_msg(f"mkdir -p /tmp/tails-files/revocation/registry/{revocation_registry_id}/") - log_msg(f"curl -X GET \"{tails_file_admin_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file") - log_msg(f"================") assert tails_public_uri == tails_file_url + # if PUBLIC_TAILS_URL is specified, tell user how to get tails file from agent + if os.getenv("PUBLIC_TAILS_URL"): + log_msg(f"================") + log_msg(f"Revocation Registry Tails File Admin URL: {tails_file_admin_url}") + log_msg(f"Revocation Registry Tails File URL: {tails_public_uri}") + log_msg(f"External host Tails File URL: {tails_file_external_url}") + log_msg(f"================") + log_msg(f"mkdir -p ./revocation/registry/{revocation_registry_id}/") + log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file") + log_msg(f"base64 revocation/registry/{revocation_registry_id}/tails-file.txt >revocation/registry/{revocation_registry_id}/tails-file") + log_msg(f"================") + revoc_publish_response = await self.admin_POST( f"/revocation/registry/{revocation_registry_id}/publish" ) From 11669460c9bc31f42b652766bafdc38e56c669f7 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 3 Apr 2020 10:44:53 -0700 Subject: [PATCH 3/8] Fix tails endpoint Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index 8eab10bbb4..d3d9dbea27 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -219,7 +219,7 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr # Update the revocation registry with the public URL to the tails file tails_file_admin_url = f"{self.admin_url}/revocation/registry/{revocation_registry_id}/tails-file" tails_file_url = f"{self.public_tails_url}/revocation/registry/{revocation_registry_id}/tails-file" - tails_file_external_url = f"http://{DEFAULT_EXTERNAL_HOST}/revocation/registry/{revocation_registry_id}/tails-file" + tails_file_external_url = f"{self.endpoint}/revocation/registry/{revocation_registry_id}/tails-file" revoc_updated_response = await self.admin_PATCH( f"/revocation/registry/{revocation_registry_id}", { From ec7af12f95dfaadeb9e78ab560d67da823b53fc2 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Fri, 3 Apr 2020 10:50:52 -0700 Subject: [PATCH 4/8] Fix tails endpoint Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index d3d9dbea27..5912296851 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -237,7 +237,7 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr log_msg(f"External host Tails File URL: {tails_file_external_url}") log_msg(f"================") log_msg(f"mkdir -p ./revocation/registry/{revocation_registry_id}/") - log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file") + log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file.txt") log_msg(f"base64 revocation/registry/{revocation_registry_id}/tails-file.txt >revocation/registry/{revocation_registry_id}/tails-file") log_msg(f"================") From 24d114ddc0a67739c40868c8589f3ebdb67c43d7 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 5 Apr 2020 11:18:34 -0700 Subject: [PATCH 5/8] Fixed tails files path Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index 5912296851..089c406c47 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -219,7 +219,11 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr # Update the revocation registry with the public URL to the tails file tails_file_admin_url = f"{self.admin_url}/revocation/registry/{revocation_registry_id}/tails-file" tails_file_url = f"{self.public_tails_url}/revocation/registry/{revocation_registry_id}/tails-file" - tails_file_external_url = f"{self.endpoint}/revocation/registry/{revocation_registry_id}/tails-file" + if RUN_MODE == "pwd": + tails_file_external_url = f"http://{self.external_host}" + else: + tails_file_external_url = f"http://127.0.0.1:{self.admin_port}" + tails_file_external_url += f"/revocation/registry/{revocation_registry_id}/tails-file" revoc_updated_response = await self.admin_PATCH( f"/revocation/registry/{revocation_registry_id}", { @@ -237,8 +241,8 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr log_msg(f"External host Tails File URL: {tails_file_external_url}") log_msg(f"================") log_msg(f"mkdir -p ./revocation/registry/{revocation_registry_id}/") - log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file.txt") - log_msg(f"base64 revocation/registry/{revocation_registry_id}/tails-file.txt >revocation/registry/{revocation_registry_id}/tails-file") + log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file.bin") + log_msg(f"base64 revocation/registry/{revocation_registry_id}/tails-file.bin >revocation/registry/{revocation_registry_id}/tails-file") log_msg(f"================") revoc_publish_response = await self.admin_POST( From bdcdaad675e430000698d1a6905385d89fe2e198 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 5 Apr 2020 11:27:48 -0700 Subject: [PATCH 6/8] Fix port Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index 089c406c47..852acce17f 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -220,7 +220,9 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr tails_file_admin_url = f"{self.admin_url}/revocation/registry/{revocation_registry_id}/tails-file" tails_file_url = f"{self.public_tails_url}/revocation/registry/{revocation_registry_id}/tails-file" if RUN_MODE == "pwd": - tails_file_external_url = f"http://{self.external_host}" + tails_file_external_url = f"http://{self.external_host}".replace( + "{PORT}", str(self.admin_port) + ) else: tails_file_external_url = f"http://127.0.0.1:{self.admin_port}" tails_file_external_url += f"/revocation/registry/{revocation_registry_id}/tails-file" From a1f258fc0e3536178051b86ca1610870f0a40ab7 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 5 Apr 2020 11:38:56 -0700 Subject: [PATCH 7/8] Fix port Signed-off-by: Ian Costanzo --- demo/runners/support/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index 852acce17f..09a4fab00b 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -243,7 +243,7 @@ async def create_and_publish_revocation_registry(self, credential_def_id, max_cr log_msg(f"External host Tails File URL: {tails_file_external_url}") log_msg(f"================") log_msg(f"mkdir -p ./revocation/registry/{revocation_registry_id}/") - log_msg(f"curl -X GET \"{tails_file_external_url}\" --output /tmp/tails-files/revocation/registry/{revocation_registry_id}/tails-file.bin") + log_msg(f"curl -X GET \"{tails_file_external_url}\" --output ./revocation/registry/{revocation_registry_id}/tails-file.bin") log_msg(f"base64 revocation/registry/{revocation_registry_id}/tails-file.bin >revocation/registry/{revocation_registry_id}/tails-file") log_msg(f"================") From 23fe13abb3b6f8569b44d896e1805219c3326ff2 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Sun, 5 Apr 2020 11:40:41 -0700 Subject: [PATCH 8/8] Fix typo Signed-off-by: Ian Costanzo --- demo/run_demo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/run_demo b/demo/run_demo index 2f6854d2d8..8c76b4f031 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -95,7 +95,7 @@ Usage: --bg - run the agent in the background; for use when using OpenAPI/Swagger interface --trace-log - log events to the standard log file --trace-http - log events to an http endmoint specified in env var TRACE_TARGET_URL - --self-attested - inlcude a self-attested attribute in the proof request/response + --self-attested - include a self-attested attribute in the proof request/response debug options: --debug-pycharm-agent-port ; --debug-pycharm-controller-port --debug-pycharm; --debug-ptvsd