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

Major refactor of tutorial folder structure. #70

Merged
merged 32 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
acf6edb
Major refactor of tutorial folder structure.
morrieinmaas Mar 3, 2021
94dc203
Restructure tutorial notebooks.
morrieinmaas Mar 4, 2021
5c05e34
Renamed folder and fixed all links for 2. Public Ledgers and Mobile
morrieinmaas Mar 8, 2021
9fe4851
WIP adding multitenancy tutorial
morrieinmaas Mar 8, 2021
5be2c7b
WIP Basic notebook setup
morrieinmaas Mar 8, 2021
c27c398
Remove multitenant args file
morrieinmaas Mar 8, 2021
0c48e72
Merge branch 'master' into issue_61
morrieinmaas Mar 8, 2021
bf40bfc
Add basic multitenant functionality and notebook examples
morrieinmaas Mar 9, 2021
155b586
Address MR feedback to restructure tutorials folders
morrieinmaas Mar 10, 2021
e108029
WIP trying to establish mediation with Alice and Bob on the same agent
morrieinmaas Mar 10, 2021
e0f4eb5
fix jwt_token
lohanspies Mar 10, 2021
51337de
clean up jtw debug prints
lohanspies Mar 10, 2021
a47d533
minor fixes in mediation.py
lohanspies Mar 10, 2021
85bd135
delete stale notebook
lohanspies Mar 10, 2021
d5579e8
rename and updated notebooks
lohanspies Mar 10, 2021
aa3bd7a
added reuse address and port
lohanspies Mar 10, 2021
5e5c05f
WIP updating multitenancy notebooks
morrieinmaas Mar 15, 2021
d40c1e2
WIP Wee update in Bob Tutorial NB. Websocket showcase
morrieinmaas Mar 15, 2021
23713fb
add mediator agent
wip-abramson Mar 17, 2021
3e52ab5
update tutorial
wip-abramson Mar 17, 2021
68a50a6
Fixing bug in aries controller ClientSession so it does not get
morrieinmaas Mar 17, 2021
6e6691f
Properly working tutorials Part 1 and 2 for mediation
morrieinmaas Mar 17, 2021
e086d73
WIP Almost finished with notebooks
morrieinmaas Mar 18, 2021
53338b1
Multitenant tutorial working
morrieinmaas Mar 18, 2021
9fb582c
Clean up notebooks
morrieinmaas Mar 18, 2021
65c1483
Merge branch 'master' into issue_61
morrieinmaas Mar 18, 2021
d47519b
Minor fixes and tidying
morrieinmaas Mar 18, 2021
eefd4af
Working complete multiteant tutorials
morrieinmaas Mar 18, 2021
cf7cad5
Remove redundant dependency
morrieinmaas Mar 18, 2021
890f059
Tidying up and fixing logical error in token assignment in aries
morrieinmaas Mar 19, 2021
b74af56
Remove unwanted tutorial notebooks of om pki lesson
morrieinmaas Mar 19, 2021
5b60f4b
clean multi-tennant tutorial
wip-abramson Mar 19, 2021
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
60 changes: 60 additions & 0 deletions configuration/aries-args-multitenant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# see: https://pypi.org/project/ConfigArgParse/ for file format overview
# before running aca-py, run the following (the commands are embedded below, next to the related parameters):
# - run a local postgres database
# - run a local instance of von-network
# - register your did (seed) on the network
# run aca-py as:
# ACAPY_WALLET_SEED=my_seed_000000000000000000000000 ACAPY_WALLET_KEY=key ./bin/aca-py start --arg-file ./demo/local-indy-args.yaml

log-level: info
genesis-url: !ENV ${GENESIS_URL}
# Admin insecure mode and api key will come from the following two variables
# which is parsed and used automatically by ACA-Py
# ACAPY_ADMIN_API_KEY
# ACAPY_ADMIN_INSECURE_MODE
admin: [0.0.0.0, !ENV '${ADMIN_PORT}']
label: !ENV ${AGENT_NAME}
# the following is the callback url for your controller
webhook-url: !ENV ${WEBHOOK_URL}
# assumes you are running a local von-network, like:
# cd von-network
# ./manage start <my local ip>
inbound-transport:
- [http, 0.0.0.0, !ENV '${HTTP_PORT}']
# - [ws, 0.0.0.0, !ENV '${HTTP_PORT}']
outbound-transport: http
# the following is the public endpoint advertised by the agent
endpoint: !ENV ${AGENT_ENDPOINT}
auto-ping-connection: true
# register your did using (this example is for von-network):
# curl -d '{"seed":"my_seed_000000000000000000000000", "role":"TRUST_ANCHOR", "alias":"My Agent"}' -X POST http://localhost:9000/register
# note that the env var name is configured in argparse.py
# seed = comes from ACAPY_WALLET_SEED
wallet-type: !ENV ${WALLET_TYPE}
wallet-name: !ENV ${WALLET_NAME}
wallet-key: !ENV ${WALLET_KEY}
seed: !ENV ${WALLET_SEED}

## run a local postgres (docker) like:
## docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres:10
#wallet-storage-type: postgres_storage
## could be sent using env var ACAPY_WALLET_STORAGE_CONFIG
#wallet-storage-config: '{"url":"localhost:5432","max_connections":5}'
## could be sent using env var ACAPY_WALLET_STORAGE_CREDS
#wallet-storage-creds: '{"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}'


auto-accept-requests: true
auto-provision: true
auto-respond-credential-proposal: false
auto-respond-credential-offer: false
auto-respond-credential-request: false
auto-store-credential: false
auto-respond-presentation-proposal: true
auto-respond-presentation-request: true
preserve-exchange-records: true
debug-connections: true
debug-credentials: true
debug-presentations: true
enable-undelivered-queue: true
open-mediation: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this out of here

4 changes: 2 additions & 2 deletions dockerfiles/controllers/Dockerfile.attachmentcontroller
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ARG jupyter_port
ENV env_jupyter_port=jupyter_port
# Setup workspace environment
RUN apt-get update && apt-get install -y gcc
# RUN conda install jupyter notebook=5.7.8
RUN conda install jupyter notebook=6.1.5
# RUN conda install -c conda-forge jupyterlab==3.0.11
RUN conda install -c conda-forge jupyterlab==3.0.11

ADD libs/attachment-controller attachment-controller

Expand Down
4 changes: 2 additions & 2 deletions dockerfiles/controllers/Dockerfile.basiccontroller
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ENV env_jupyter_port=jupyter_port

# Setup workspace environment
RUN apt-get update && apt-get install -y gcc
# RUN conda install jupyter notebook=5.7.8
RUN conda install jupyter notebook=6.1.5
# RUN conda install -c conda-forge jupyterlab==3.0.11
RUN conda install -c conda-forge jupyterlab==3.0.11
ADD libs/aries-basic-controller .

#
Expand Down
2 changes: 1 addition & 1 deletion libs/acapy-protocol-example/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fi

cd $WORKSPACE
echo "HELLO THIS IS PORT $1"
jupyter notebook --ip=0.0.0.0 --port="$1" --allow-root
jupyter lab --ip=0.0.0.0 --port="$1" --allow-root
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

from .controllers.connections import ConnectionsController
from .controllers.messaging import MessagingController
from .controllers.mediation import MediationController
from .controllers.schema import SchemaController
from .controllers.wallet import WalletController
from .controllers.definitions import DefinitionsController
from .controllers.issuer import IssuerController
from .controllers.proof import ProofController
from .controllers.ledger import LedgerController
from .controllers.credential import CredentialController
from .controllers.multitenant import MultitenancyController
from .controllers.server import ServerController
from .controllers.oob import OOBController
from .controllers.action_menu import ActionMenuController
Expand All @@ -35,10 +37,13 @@ def __init__(
webhook_base: str = "",
connections: bool = True,
messaging: bool = True,
multitenant: bool = False,
mediation: bool = False,
issuer: bool = True,
action_menu: bool = True,
revocations: bool = True,
api_key: str = None,
tennant_jwt: str = None,
):

self.webhook_site = None
Expand All @@ -51,11 +56,16 @@ def __init__(
self.webhook_port = webhook_port
self.connections_controller = None

headers = {}

if api_key:
headers = {"X-API-Key": api_key}
self.client_session: ClientSession = ClientSession(headers=headers)
else:
self.client_session: ClientSession = ClientSession()
headers.update({"X-API-Key": api_key})

if tennant_jwt:
headers.update({'Authorization': 'Bearer ' + tennant_jwt, 'content-type': "application/json"})

self.client_session: ClientSession = ClientSession(headers=headers)


if connections:
self.connections = ConnectionsController(self.admin_url, self.client_session)
Expand All @@ -68,6 +78,12 @@ def __init__(
self.server = ServerController(self.admin_url, self.client_session)
self.oob = OOBController(self.admin_url, self.client_session)

if multitenant:
self.multitenant = MultitenancyController(self.admin_url, self.client_session)

if mediation:
self.mediation = MediationController(self.admin_url, self.client_session)

if issuer:
self.schema = SchemaController(self.admin_url, self.client_session)
self.wallet = WalletController(self.admin_url, self.client_session)
Expand All @@ -77,12 +93,55 @@ def __init__(

if action_menu:
self.action_menu = ActionMenuController(self.admin_url, self.client_session)

if revocations:
self.revocations = RevocationController(
self.admin_url,
self.client_session
)

# TODO: Determine whether we really want to essentially create a whole new ClientSession object as done below
# Ideally we'd just update the existing session along the lines of self.client_session(headers)
# That does not work, though because it is not callable and updating cannot be achieved reliably
# because headers can be of different type
# from https://docs.aiohttp.org/en/stable/client_reference.html :
# "May be either iterable of key-value pairs or Mapping (e.g. dict, CIMultiDict)."
# So for now let's create a new ClientSession and use all the instances current attributes
# to update every attr using ClientSession
def update_tennant_jwt(self, tennant_jwt):
self.tennant_jwt = tennant_jwt
headers = {'Authorization': 'Bearer ' + tennant_jwt, 'content-type': "application/json"}
self.client_session: ClientSession = ClientSession(headers=headers)

if self.connections:
self.connections = ConnectionsController(self.admin_url, self.client_session)

if self.messaging:
self.messaging = MessagingController(self.admin_url, self.client_session)

if self.multitenant:
self.multitenant = MultitenancyController(self.admin_url, self.client_session)

if self.mediation:
self.mediation = MediationController(self.admin_url, self.client_session)

if self.issuer:
self.schema = SchemaController(self.admin_url, self.client_session)
self.wallet = WalletController(self.admin_url, self.client_session)
self.definitions = DefinitionsController(self.admin_url, self.client_session)
self.issuer = IssuerController(self.admin_url, self.client_session, self.connections,
self.wallet, self.definitions)

if self.action_menu:
self.action_menu = ActionMenuController(self.admin_url, self.client_session)

if self.revocations:
self.revocations = RevocationController(
self.admin_url,
self.client_session
)


def register_listeners(self, listeners, defaults=True):
if defaults:
if self.connections:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def default_handler(self, payload):

# Get default mediator
async def get_default_mediator(self):
return await self.admin_POST(f"{self.base_url}/default-mediator")
return await self.admin_GET(f"{self.base_url}/default-mediator")


# Clear default mediator
Expand Down Expand Up @@ -57,12 +57,12 @@ async def send_keylist_update(self, request, mediation_id: str):


# Request mediation from connection
async def request_mediation(self, request, conn_id: str):
async def request_mediation(self, conn_id: str, request: {} = {}):
return await self.admin_POST(f"{self.base_url}/request/{conn_id}", json_data=request)


# Query mediation requests, returns list of all mediation records
async def get_mediation_records(self, mediator_terms: [str], recipient_terms: [str], state: str = None, conn_id: str = None):
async def get_mediation_records(self, mediator_terms: [str] = None, recipient_terms: [str] = None, state: str = None, conn_id: str = None):
params = {}
if conn_id:
params["conn_id"] = conn_id
Expand Down Expand Up @@ -96,6 +96,6 @@ async def grant_mediation_request_by_id(self, mediation_id: str):
return await self.admin_POST(f"{self.base_url}/requests/{mediation_id}/grant")


# Grant received mediation request
# Set default mediator
async def set_default_mediator(self, mediation_id: str):
return await self.admin_PUT(f"{self.base_url}/requests/{mediation_id}/default-mediator")
return await self.admin_PUT(f"{self.base_url}/{mediation_id}/default-mediator")
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ async def update_subwallet_by_id(self, request, wallet_id: str):


# Remove a subwallet
async def remove_subwallet_by_id(self, request, wallet_id: str):
async def remove_subwallet_by_id(self, wallet_id: str, request=None):
return await self.admin_POST(f"{self.base_url}/wallet/{wallet_id}/remove", json_data=request)


# Get auth token for a subwallet
async def get_subwallet_authtoken_by_id(self, request, wallet_id: str):
async def get_subwallet_authtoken_by_id(self, wallet_id: str, request=None):
return await self.admin_POST(f"{self.base_url}/wallet/{wallet_id}/token", json_data=request)


Expand Down
2 changes: 1 addition & 1 deletion libs/aries-basic-controller/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp~=3.6.2
aiohttp~=3.7.3
asyncio
prompt_toolkit
pygments
Expand Down
4 changes: 2 additions & 2 deletions projects/aries-fl/Dockerfile.hospitalcontroller
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ENV env_jupyter_port=jupyter_port

# Setup workspace environment
RUN apt-get update && apt-get install -y gcc
# RUN conda install jupyter notebook=5.7.8
RUN conda install jupyter notebook=6.1.5
# RUN conda install -c conda-forge jupyterlab==3.0.11
RUN conda install -c conda-forge jupyterlab==3.0.11


ADD projects/aries-fl/requirements.txt .
Expand Down
4 changes: 2 additions & 2 deletions projects/aries-fl/Dockerfile.ppmlcontroller
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ENV env_jupyter_port=jupyter_port

# Setup workspace environment
RUN apt-get update && apt-get install -y gcc
# RUN conda install jupyter notebook=5.7.8
RUN conda install jupyter notebook=6.1.5
# RUN conda install -c conda-forge jupyterlab==3.0.11
RUN conda install -c conda-forge jupyterlab==3.0.11


ADD projects/aries-fl/requirements.txt .
Expand Down
2 changes: 1 addition & 1 deletion projects/aries-fl/notebooks/researcher/Researcher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"source": [
"## Request Authorised Research Credential\n",
"\n",
"Copy invite from the [Health Research Authority Notebook](http://localhost:8889/notebooks/Health%20Research%20Regulator.ipynb)"
"Copy invite from the [Health Research Authority Notebook](http://localhost:8889/lab/tree/Health%20Research%20Regulator.ipynb)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Initialising the Health Education England Agent\n",
"\n",
"## If you wish to start at the beginning of the Doctor's in Training flow go [here](http://localhost:8889/notebooks/Part%201%20-%20Getting%20Started.ipynb).\n",
"## If you wish to start at the beginning of the Doctor's in Training flow go [here](http://localhost:8889/lab/tree/Part%201%20-%20Getting%20Started.ipynb).\n",
"\n",
"In this notebook you will register the DID of the HEE agent on the Sovrin StagingNet and write the credential definitions that Health Education England is responsible for issuing.\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"\n",
"## Before running through this notebook you should run through the following notebook - [Part 4.1](http://localhost:8891/notebooks/Part%204.1%20-%20Initialising%20the%20HEE%20Agent.ipynb).\n",
"\n",
"## Or alternatively you can start at the beginning of the Doctors in Training flow [here](http://localhost:8889/notebooks/Part%201%20-%20Getting%20Started.ipynb).\n",
"## Or alternatively you can start at the beginning of the Doctors in Training flow [here](http://localhost:8889/lab/tree/Part%201%20-%20Getting%20Started.ipynb).\n",
"\n"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Initialising the Lead Employer Agent\n",
"\n",
"## If you wish to start at the beginning of the Doctor's in Training flow go [here](http://localhost:8889/notebooks/Part%201%20-%20Getting%20Started.ipynb).\n",
"## If you wish to start at the beginning of the Doctor's in Training flow go [here](http://localhost:8889/lab/tree/Part%201%20-%20Getting%20Started.ipynb).\n",
"\n",
"In this notebook you will register the DID of the Lead Employer agent on the Sovrin StagingNet and write the credential definitions for the schema the Lead Employer is responsible for issuing.\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"\n",
"## Before running through this notebook you should run through the following notebook - [Part 5.1](http://localhost:8892/notebooks/Part%205.1%20-%20Initialising%20the%20Lead%20Employer%20Agent.ipynb).\n",
"\n",
"## Or alternatively you can start at the beginning of the Doctors in Training flow [here](http://localhost:8889/notebooks/Part%201%20-%20Getting%20Started.ipynb).\n",
"## Or alternatively you can start at the beginning of the Doctors in Training flow [here](http://localhost:8889/lab/tree/Part%201%20-%20Getting%20Started.ipynb).\n",
"\n"
]
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/jupyter-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fi

cd $WORKSPACE
echo "HELLO THIS IS PORT $1"
jupyter notebook --ip=0.0.0.0 --port="$1" --allow-root
jupyter lab --ip=0.0.0.0 --port="$1" --allow-root
7 changes: 6 additions & 1 deletion scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
python3 ./scripts/parse_yml_env_variables.py -c ./configuration/aries-args-advanced.yaml;aca-py start --arg-file /tmp/agent_conf.yml
if [[ -z "${MULTITENANT_TUTORIAL}" ]]; then
echo $MULTITENANT_TUTORIAL
python3 ./scripts/parse_yml_env_variables.py -c ./configuration/aries-args-multitenant.yaml;aca-py start --arg-file /tmp/agent_conf.yml
else
python3 ./scripts/parse_yml_env_variables.py -c ./configuration/aries-args-advanced.yaml;aca-py start --arg-file /tmp/agent_conf.yml
fi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"By the end of this tutorial we hope you will have a strong grounding in the capabilities of SSI and the ability to use them in your own applications by leveraging the library we have developed. \n",
"\n",
"If you want to dive straight into the code start here:\n",
"* [Part 2 - Aries Basic Controller](http://localhost:8888/notebooks/Part%202%20-%20Aries%20Basic%20Controller.ipynb)"
"* [Part 2 - Aries Basic Controller](http://localhost:8888/lab/tree/1%20Basic%20Concepts%20and%201st%20Connection/Part%202%20-%20Aries%20Basic%20Controller.ipynb)"
]
},
{
Expand Down Expand Up @@ -147,9 +147,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Loading