Skip to content

Commit 14e3402

Browse files
Initial commit
* Conforms to did:mydata method spec * Admin route to perform CRUD on did registry transactions * Admin route to initiate did:mydata method operations (create, read, delete) * MyData registry admin route to view verified did(s) Signed-off-by: George J Padayatti <[email protected]>
0 parents  commit 14e3402

Some content is hidden

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

49 files changed

+4421
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# IDE
2+
.vscode/
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
.DS_Store

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Aries Cloud Agent - Python Plugin for MyData DID DIDComm protcol
2+
3+
## ACA-Py Version Compatibility
4+
5+
To avoid a confusing pseudo-lock-step release, this plugin is
6+
versioned independent of ACA-Py. Plugin releases will follow standard
7+
[semver](semver.org) but each release will also be tagged with a mapping to an
8+
ACA-Py version with the format `acapy-X.Y.Z-J` where `X.Y.Z` corresponds to the
9+
ACA-Py version supported and `J` is an incrementing number for each new plugin
10+
release that targets the same version of ACA-Py.
11+
12+
You should look for the most recent release tagged with the version of ACA-Py
13+
you are using (with the highest value for `J`).
14+
15+
## Installation
16+
17+
Requirements:
18+
- Python 3.6 or higher
19+
- ACA-Py
20+
21+
### Setup Aries Cloud Agent - Python
22+
23+
If you already have an existing installation of ACA-Py, you can skip these steps
24+
and move on to [plugin installation](#plugin-installation). It is also worth
25+
noting that this is not the only way to setup an ACA-Py instance. For more setup
26+
configurations, see the [Aries Cloud Agent - Python
27+
repository](https://github.com/hyperledger/aries-cloudagent-python).
28+
29+
First, clone
30+
[ACA-Py](https://github.com/hyperledger/aries-cloudagent-python) and prepare a
31+
virtual environment:
32+
```sh
33+
$ git clone https://github.com/hyperledger/aries-cloudagent-python
34+
$ cd aries-cloudagent-python
35+
$ python3 -m venv env
36+
$ source env/bin/activate
37+
```
38+
39+
Install ACA-Py into the virtual environment:
40+
```sh
41+
$ pip install -e .
42+
```
43+
**Or** include the `indy` feature if you want to use Indy ledgers or wallets:
44+
```sh
45+
$ pip install -e .[indy]
46+
```
47+
48+
### Plugin Installation
49+
50+
Install this plugin into the virtual environment:
51+
52+
```sh
53+
$ pip install git+https://github.com/decentralised-dataexchange/acapy-mydata-did-protocol.git@master#egg=mydata_did
54+
```
55+
56+
**Note:** Depending on your version of `pip`, you may need to drop the
57+
`#egg=...` to install the plugin with the above command.
58+
59+
### Plugin Loading
60+
Start up ACA-Py with the plugin parameter:
61+
```sh
62+
$ aca-py start \
63+
-it http localhost 3000 -it ws localhost 3001 \
64+
-ot http \
65+
-e http://localhost:3000 ws://localhost:3001 \
66+
--plugin "mydata_did"
67+
```

manifest.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include requirements.txt
2+
recursive-include mydata_did *

mydata_did/__init__.py

Whitespace-only changes.

mydata_did/definition.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Version definitions for this protocol."""
2+
3+
versions = [
4+
{
5+
"major_version": 1,
6+
"minimum_minor_version": 0,
7+
"current_minor_version": 0,
8+
"path": "v1_0",
9+
}
10+
]

mydata_did/v1_0/__init__.py

Whitespace-only changes.

mydata_did/v1_0/handlers/__init__.py

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from aries_cloudagent.messaging.base_handler import BaseHandler, BaseResponder, RequestContext
2+
3+
from ..messages.create_did import CreateDID
4+
from ..manager import MyDataDIDManager
5+
6+
import json
7+
8+
9+
class CreateDIDHandler(BaseHandler):
10+
11+
async def handle(self, context: RequestContext, responder: BaseResponder):
12+
self._logger.info(
13+
f"CreateDIDHandler called with context {context}")
14+
assert isinstance(context.message, CreateDID)
15+
16+
self._logger.info(
17+
"Received create-did message: \n%s",
18+
json.dumps(context.message.serialize(), indent=4)
19+
)
20+
21+
if not context.connection_ready:
22+
self._logger.info(
23+
"Connection not active, skipping create-did handler: %s",
24+
context.message_receipt.sender_did,
25+
)
26+
return
27+
28+
mgr = MyDataDIDManager(context)
29+
await mgr.process_create_did_message(context.message, context.message_receipt)
30+
31+
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from aries_cloudagent.messaging.base_handler import BaseHandler, BaseResponder, RequestContext
2+
3+
from ..messages.create_did_response import CreateDIDResponse
4+
from ..manager import MyDataDIDManager
5+
6+
import json
7+
8+
9+
class CreateDIDResponseHandler(BaseHandler):
10+
11+
async def handle(self, context: RequestContext, responder: BaseResponder):
12+
self._logger.info(
13+
f"CreateDIDHandler called with context {context}")
14+
assert isinstance(context.message, CreateDIDResponse)
15+
16+
self._logger.info(
17+
"Received create-did-response message: \n%s",
18+
json.dumps(context.message.serialize(), indent=4)
19+
)
20+
21+
if not context.connection_ready:
22+
self._logger.info(
23+
"Connection not active, skipping create-did-response handler: %s",
24+
context.message_receipt.sender_did,
25+
)
26+
return
27+
28+
mgr = MyDataDIDManager(context)
29+
await mgr.process_create_did_response_message(context.message, context.message_receipt)
30+
31+
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from aries_cloudagent.messaging.base_handler import BaseHandler, BaseResponder, RequestContext
2+
3+
from ..messages.delete_did import DeleteDID
4+
from ..manager import MyDataDIDManager
5+
6+
import json
7+
8+
9+
class DeleteDIDHandler(BaseHandler):
10+
11+
async def handle(self, context: RequestContext, responder: BaseResponder):
12+
self._logger.info(
13+
f"DeleteDIDHandler called with context {context}")
14+
assert isinstance(context.message, DeleteDID)
15+
16+
self._logger.info(
17+
"Received delete-did message: \n%s",
18+
json.dumps(context.message.serialize(), indent=4)
19+
)
20+
21+
if not context.connection_ready:
22+
self._logger.info(
23+
"Connection not active, skipping create-did handler: %s",
24+
context.message_receipt.sender_did,
25+
)
26+
return
27+
28+
mgr = MyDataDIDManager(context)
29+
await mgr.process_delete_did_message(context.message, context.message_receipt)
30+
31+
32+

0 commit comments

Comments
 (0)