Skip to content

Commit

Permalink
Merge branch 'main' into add-sherman
Browse files Browse the repository at this point in the history
  • Loading branch information
swcurran committed Jun 13, 2023
2 parents c226a1e + 7c15f1d commit a31db20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aries_cloudagent/wallet/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ async def wallet_create_did(request: web.BaseRequest):
info = None
async with context.session() as session:
did_methods = session.inject(DIDMethods)
method = did_methods.from_method(body.get("method", "")) or SOV

method = did_methods.from_method(body.get("method", "sov"))
if not method:
raise web.HTTPForbidden(
reason=(f"method {body.get('method')} is not supported by the agent.")
)

key_types = session.inject(KeyTypes)
# set default method and key type for backwards compat
key_type = (
Expand Down
11 changes: 11 additions & 0 deletions aries_cloudagent/wallet/tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ async def test_create_did(self):
)
assert result is json_response.return_value

async def test_create_did_unsupported_method(self):
self.request.json = async_mock.AsyncMock(
return_value={
"method": "madeupmethod",
"options": {"key_type": "bls12381g2"},
}
)

with self.assertRaises(test_module.web.HTTPForbidden):
await test_module.wallet_create_did(self.request)

async def test_create_did_unsupported_key_type(self):
self.request.json = async_mock.AsyncMock(
return_value={"method": "sov", "options": {"key_type": "bls12381g2"}}
Expand Down

0 comments on commit a31db20

Please sign in to comment.