Skip to content

Commit 8555e1a

Browse files
committed
Merge branch 'main' into improvement/yoma_193_presentation_tests
Contaisn improvements of Presentation class and testing for it
2 parents 35d67b9 + 9d4348d commit 8555e1a

File tree

251 files changed

+909
-32652
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+909
-32652
lines changed

.DS_Store

-6 KB
Binary file not shown.

.github/workflows/main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'CI'
2+
on:
3+
push:
4+
tags:
5+
- 'v.*'
6+
7+
jobs:
8+
release:
9+
if: startsWith(github.ref, 'refs/tags/')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Build Changelog
13+
id: github_release
14+
uses: mikepenz/release-changelog-builder-action@v1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Create Release
19+
uses: actions/create-release@v1
20+
with:
21+
tag_name: ${{ github.ref }}
22+
release_name: ${{ github.ref }}
23+
body: ${{steps.github_release.outputs.changelog}}
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/python-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.x'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine
25+
- name: Build and publish
26+
env:
27+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
twine upload dist/*
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
# Trigger the workflow on push or pull request,
8+
# but only for the main branch
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- main
15+
16+
jobs:
17+
deploy:
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.x'
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install setuptools wheel twine pylint
31+
- name: Analysing the code with pylint
32+
run: |
33+
python -m pylint --fail-under=10 `find -regextype egrep -regex '(.*.py)$'` |
34+
tee pylint.txt
35+
- name: Upload pylint.txt as artifact
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: pylint report
39+
path: pylint.txt
40+
- name: Build and publish
41+
env:
42+
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
43+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
44+
run: |
45+
python setup.py sdist bdist_wheel
46+
twine upload --repository testpypi dist/*

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ build
99
__pycache__/
1010

1111
**/received_files/*
12-
libs/om-aries-controller/demo/bob/image_received.png
1312

1413
.vscode/
1514
# exception to the rule
16-
!libs/om-aries-controller/demo/bob/received_files/.gitkeep
1715

1816
**/model.pt
1917
**/trained_model.pt
2018
**/untrained_model.pt
2119
**/part_trained.pt
20+
.venv
File renamed without changes.

README.md

Lines changed: 8 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,18 @@
1-
![om-logo](https://github.com/OpenMined/design-assets/blob/master/logos/OM/horizontal-primary-trans.png)
2-
![Tests](https://github.com/OpenMined/PyVertical/workflows/Tests/badge.svg?branch=master)
3-
![License](https://img.shields.io/github/license/OpenMined/PyVertical)
4-
![OpenCollective](https://img.shields.io/opencollective/all/openmined)
1+
[![Upload Test Python Package](https://github.com/didx-xyz/aries-cloudcontroller-python/actions/workflows/python-test-publish.yml/badge.svg)](https://github.com/didx-xyz/aries-cloudcontroller-python/actions/workflows/python-test-publish.yml)
52

3+
# Aries Cloud Controller - Python
64

7-
# PyDentity
5+
A simple pip installable package for controlling aries agents through admin API calls.
86

9-
In this repo we are creating a set of libraries to facilitate education and experimentation with the Hyperledger Aries framework for implementing secure identification and authentication procedures using Decentralised Identifiers(DIDs) and Verifiable Credentials (VCs).
7+
# Install
108

11-
Ultimately we are exploring how to create a [Distributed Trust System for Privacy Preserving Machine Learning](https://arxiv.org/abs/2006.02456) that can work with PySyft. We're using HL-Aries Agents to establish an end-end encrypted channel which will facilitate syft communications. We can then extend this with credentials and governance systems.
9+
Current version 0.1
1210

13-
![Endgame](./images/endgame.png)
11+
`python3 -m pip install aries_cloudcontroller`
1412

15-
**This is very experimental at this stage.**
1613

17-
## Requirements
18-
This project is written in Python and is displayed in jupyter notebooks.
14+
## Tutorial
1915

20-
You need to install:
21-
1. [Docker](https://docs.docker.com/get-docker/)
22-
2. [docker-compose](https://docs.docker.com/compose/install/)
23-
3. The **source-to-image** (s2i) tool is also required to build the docker images used in the demo. S2I can be downloaded [here](https://github.com/openshift/source-to-image). The website gives instructions for installing on other platforms like MACOS, Linux, Windows.
24-
Verify that **s2i** is in your PATH. If not, then edit your PATH and add the directory where **s2i** is installed. The **manage** script will look for the **s2i** executable on your PATH. If it is not found you will get a message asking you to download and set it on your PATH.
25-
- If you are using a Mac and have Homebrew installed, the following command will install s2i: `brew install source-to-image`
26-
- If you are using Linux, go to the [releases](https://github.com/openshift/source-to-image/releases/latest) page and download the correct distribution for your machine. Choose either the linux-386 or the linux-amd64 links for 32 and 64-bit, respectively. Unpack the downloaded tar with `tar -xvf "Release.tar.gz"`
27-
- If you are not sure about your Operating System you can visit [this](https://whatsmyos.com/) and/or follow the instructions.
28-
- You should now see an executable called s2i. Either add the location of s2i to your PATH environment variable, or move it to a pre-existing directory in your PATH. For example, `sudo cp /path/to/s2i /usr/local/bin` will work with most setups. You can test it using `s2i version`.
16+
Find out how to use this package by taking our [jupyter notebook tutorial series](https://github.com/OpenMined/PyDentity/tree/master/tutorials).
2917

30-
Ensure that Docker is running. If it is not try `sudo dockerd` in another terminal.
3118

32-
You should now be able to run any of the tutorials or projects within this repo.
33-
34-
E.g for the main tutorial on the aries-basic-controller
35-
1. Navigate to the root directory of the tutorial
36-
`cd tutorials/aries-basic-controller`
37-
2. Spin up the docker-compose configuration
38-
`./manage start`
39-
3. Get the urls and tokens for the juypter notebook instances within the project
40-
**From the root PyDentity folder**
41-
`./scripts/get_URLS.sh`
42-
4. Navigate to the urls this spits out and follow the instructions within the notebooks.
43-
44-
## Tutorials
45-
46-
In the tutorials folder you will find a set of series of juypter notebook tutorials walking through how to use the libraries contained within this repository. Each tutorial series can be run from it's folder using `./manage start`
47-
48-
### [SSI Basics with Hyperledger](./tutorials/aries-basic-controller)
49-
50-
This series introduces Self-Sovereign Identity and provides all the information needed to get started developing with the Hyperledger SSI stack using the aries-basic-controller library we developed to provide code examples within the notebooks.
51-
52-
**This is a great place to start!**
53-
54-
### [Making SSI "Real"](./tutorials/aries-stagingnet)
55-
56-
In this series you will learn how to move your solutions from a local test network onto the publicly accessible internet by connecting to the Sovrin StagingNet.
57-
58-
## Libraries
59-
60-
61-
### [aries-basic-controller](./libs/aries-basic-controller)
62-
63-
This is the core library in this repository. It is a simple python wrapper for the swagger api interface to an [aca-py ssi agent](https://github.com/hyperledger/aries-cloudagent-python).
64-
65-
### [acapy-protocol-example](./libs/acapy-protocol-example)
66-
67-
This library gives a very basic example of how to extend the core set of protocols that an aca-py agent understand with a custom protocol.
68-
69-
### [attachment-protocol](./libs/attachment-protocol)
70-
71-
This library implements a basic attachment acapy protocol plugin using decorators.
72-
73-
### [attachment-controller](./libs/attachment-controller)
74-
75-
This library extends the basic controller to include the attachment protocol endpoints.
76-
77-
## Projects
78-
79-
### [Aries-FL](./projects/aries-fl)
80-
81-
An example of authenticated federated learning mediated by aries agents communicating over DIDComm.
82-
83-
### [Opus](./projects/opus)
84-
85-
SSI Third Party Credential Onboarding.
86-
87-
### [PryVote](./projects/pryvote)
88-
89-
SSI voting system.
90-
91-
### [Doctors in Training](./projects/doctors-in-training)
92-
93-
A real life use case of SSI developed as part of an NHS INTEROpen hackathon.
94-
95-
### [Single Agent](./project/single-agent)
96-
97-
This spins up a single agent (with attachment capability) pointing to the Sovrin StagingNet and publicly exposed using Ngrok. It includes an associated notebook. Our thought is you could use this to experiment with interoperability of other aries agents. For example aca-pico.

aries_cloudcontroller/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from aries_cloudcontroller.aries_controller import AriesAgentController
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
from dataclasses import dataclass
2+
3+
from .aries_controller_base import AriesAgentControllerBase
4+
from .aries_webhook_server import AriesWebhookServer
5+
from .controllers.multitenant import MultitenancyController
6+
7+
import logging
8+
9+
logger = logging.getLogger("aries_controller")
10+
11+
12+
@dataclass
13+
class AriesAgentController(AriesAgentControllerBase):
14+
"""The Aries Agent Controller class
15+
16+
This class allows you to interact with Aries by exposing the aca-py API.
17+
18+
Attributes:
19+
----------
20+
is_multitenant : bool
21+
Initialise the multitenant interface (default is False)
22+
"""
23+
24+
is_multitenant: bool = False
25+
26+
def __post_init__(self):
27+
"""Constructs additional attributes and logic
28+
Creates headers, instantiates a client sessions and initialises
29+
the controller interfaces for the aries swagger API.
30+
"""
31+
32+
super().__post_init__()
33+
34+
if self.is_multitenant:
35+
self.multitenant = MultitenancyController(
36+
self.admin_url,
37+
self.client_session)
38+
39+
def init_webhook_server(
40+
self,
41+
webhook_host: str = None,
42+
webhook_port: int = None,
43+
webhook_base: str = ""):
44+
"""Create a webhooklisteners
45+
46+
Args:
47+
----
48+
webhook_host : str
49+
The url of the webhook host (default is None)
50+
webhook_port : int
51+
The exposed port for webhooks on the host (default is None)
52+
webhook_base : str
53+
The base url for webhooks (default is "")
54+
"""
55+
self.webhook_server: AriesWebhookServer = AriesWebhookServer(
56+
webhook_host=webhook_host,
57+
webhook_port=webhook_port,
58+
webhook_base=webhook_base,
59+
is_multitenant=self.is_multitenant)
60+
61+
async def listen_webhooks(self):
62+
try:
63+
await self.webhook_server.listen_webhooks()
64+
logger.info("Webhook server started.")
65+
except AttributeError:
66+
logger.warning("Webhook server not initialised.")
67+
except Exception as exc:
68+
logger.warning(
69+
f"Listening webhooks failed! {exc!r} occurred.")

0 commit comments

Comments
 (0)