Skip to content
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ The administrative API exposed by the agent for the controller to use must be pr
`--admin-insecure-mode` command line arg. The latter should not be used other than in development if the API
is not otherwise secured.


> Storage and some other modules were modified in aca-py to create this multi-tenant agency. This particular code base requires security and storage improvements!


## API

Follows same api as ACA-PY with additional parameters in header see 'Usage' section.
Expand Down
2 changes: 2 additions & 0 deletions aries_cloudagency/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ async def agency_middleware(request, handler):
self.context.injector.clear_binding(BaseStorage)

wallet_instance: BaseWallet = await agency_wallet.get(wallet_name, wallet_key)
if wallet_instance is None:
raise web.HTTPUnauthorized()
self.context.injector.bind_instance(BaseWallet, wallet_instance)

storage = IndyStorage(wallet_instance)
Expand Down
15 changes: 9 additions & 6 deletions aries_cloudagency/agency/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ async def close(name, key):


async def get(name, key):
wlt = open_wallets.get(name)
if wlt:
# print("Wallet already exist!")
return wlt
agency_storage = AgencyStorage()
wallet_info = await agency_storage.get_wallet(name, key)
if wallet_info is not None:
wlt = open_wallets.get(name)
if wlt:
return wlt
else:
return await open(name, key)
else:
# print("Opening new wallet!")
return await open(name, key)
return None
2 changes: 2 additions & 0 deletions aries_cloudagency/transport/pack_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ async def unpack(
context.injector.clear_binding(BaseStorage)

wallet_instance: BaseWallet = await agency_wallet.get(recipient_wallet_name, wallet_info['wallet_secret'])
if wallet_instance is None:
raise MessageParseError("Wallet doesn't exist in agency!")
context.injector.bind_instance(BaseWallet, wallet_instance)

storage = IndyStorage(wallet_instance)
Expand Down