Skip to content

Commit 96af2b5

Browse files
authored
Merge pull request #10 from TrustNetPK/dev
agency stable code
2 parents 0b77e56 + efd0435 commit 96af2b5

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ The administrative API exposed by the agent for the controller to use must be pr
4747
`--admin-insecure-mode` command line arg. The latter should not be used other than in development if the API
4848
is not otherwise secured.
4949

50+
51+
> 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!
52+
53+
5054
## API
5155

5256
Follows same api as ACA-PY with additional parameters in header see 'Usage' section.

aries_cloudagency/admin/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ async def agency_middleware(request, handler):
237237
self.context.injector.clear_binding(BaseStorage)
238238

239239
wallet_instance: BaseWallet = await agency_wallet.get(wallet_name, wallet_key)
240+
if wallet_instance is None:
241+
raise web.HTTPUnauthorized()
240242
self.context.injector.bind_instance(BaseWallet, wallet_instance)
241243

242244
storage = IndyStorage(wallet_instance)

aries_cloudagency/agency/wallet.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ async def close(name, key):
5050

5151

5252
async def get(name, key):
53-
wlt = open_wallets.get(name)
54-
if wlt:
55-
# print("Wallet already exist!")
56-
return wlt
53+
agency_storage = AgencyStorage()
54+
wallet_info = await agency_storage.get_wallet(name, key)
55+
if wallet_info is not None:
56+
wlt = open_wallets.get(name)
57+
if wlt:
58+
return wlt
59+
else:
60+
return await open(name, key)
5761
else:
58-
# print("Opening new wallet!")
59-
return await open(name, key)
62+
return None

aries_cloudagency/transport/pack_format.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ async def unpack(
131131
context.injector.clear_binding(BaseStorage)
132132

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

136138
storage = IndyStorage(wallet_instance)

0 commit comments

Comments
 (0)