Skip to content

Commit f2aead2

Browse files
authored
Merge pull request #69 from didx-xyz/issue_57
Issue 57 - Multitenancy
2 parents 622d60c + 60496a1 commit f2aead2

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

configuration/aries-args-basic.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ wallet-key: !ENV ${WALLET_KEY}
3535
seed: !ENV ${WALLET_SEED}
3636
auto-provision: true
3737

38+
3839
## run a local postgres (docker) like:
3940
## docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres:10
4041
#wallet-storage-type: postgres_storage
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# For usage please consult https://github.com/hyperledger/aries-cloudagent-python/blob/main/Mediation.md
2+
3+
from .base import BaseController
4+
from aiohttp import ClientSession
5+
import logging
6+
from typing import List
7+
8+
logger = logging.getLogger("aries_controller.multitenancy")
9+
10+
11+
class MultitenancyController(BaseController):
12+
13+
def __init__(self, admin_url: str, client_session: ClientSession):
14+
super().__init__(admin_url, client_session)
15+
self.base_url = "/multitenancy"
16+
17+
def default_handler(self, payload):
18+
logger.debug("Multitenancy Message received", payload)
19+
20+
21+
# Create a subwallet
22+
async def create_subwallet(self, request):
23+
return await self.admin_POST(f"{self.base_url}/wallet", json_data=request)
24+
25+
26+
# Get a single subwallet
27+
async def get_single_subwallet_by_id(self, wallet_id: str):
28+
return await self.admin_GET(f"{self.base_url}/wallet/{wallet_id}")
29+
30+
31+
# Update a subwallet
32+
async def update_subwallet_by_id(self, request, wallet_id: str):
33+
return await self.admin_PUT(f"{self.base_url}/wallet/{wallet_id}", json_data=request)
34+
35+
36+
# Remove a subwallet
37+
async def remove_subwallet_by_id(self, request, wallet_id: str):
38+
return await self.admin_POST(f"{self.base_url}/wallet/{wallet_id}/remove", json_data=request)
39+
40+
41+
# Get auth token for a subwallet
42+
async def get_subwallet_authtoken_by_id(self, request, wallet_id: str):
43+
return await self.admin_POST(f"{self.base_url}/wallet/{wallet_id}/token", json_data=request)
44+
45+
46+
# Query subwallets
47+
async def query_subwallets(self, wallet_name: str = None):
48+
params = {}
49+
if wallet_name:
50+
params["wallet_name"] = wallet_name
51+
52+
return await self.admin_GET(f"{self.base_url}/wallets")
53+
54+
55+

0 commit comments

Comments
 (0)