Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo updates 2 #449

Merged
merged 9 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions demo/run_demo
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ do
fi
continue
;;
--self-attested)
SELF_ATTESTED=1
continue
;;
--trace-log)
TRACE_TARGET=log
TRACE_TAG=acapy.events
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 - include a self-attested attribute in the proof request/response
debug options: --debug-pycharm-agent-port <port>; --debug-pycharm-controller-port <port>
--debug-pycharm; --debug-ptvsd

Expand Down Expand Up @@ -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}"
Expand Down
6 changes: 4 additions & 2 deletions demo/runners/faber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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
{
Expand Down
25 changes: 19 additions & 6 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,34 @@ 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"
if RUN_MODE == "pwd":
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"
revoc_updated_response = await self.admin_PATCH(
f"/revocation/registry/{revocation_registry_id}",
{
"tails_public_uri": tails_file_url
}
)
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}/")
ianco marked this conversation as resolved.
Show resolved Hide resolved
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"================")

revoc_publish_response = await self.admin_POST(
f"/revocation/registry/{revocation_registry_id}/publish"
)
Expand Down