Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#21 from krzosa/master
Browse files Browse the repository at this point in the history
Fix an issue where /get_from returned data in wrong format, add oca_schema_dri in pds/save
  • Loading branch information
Krzosa Karol authored Apr 16, 2021
2 parents 5abb7fb + 08659b8 commit 24edd56
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aries-services-plugin
4 changes: 3 additions & 1 deletion aries_cloudagent/issuer/pds.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ async def create_credential(
revoc_reg_id: str = None,
tails_file_path: str = None,
) -> Tuple[str, str]:
credential = await self.create_credential_ex(credential_values, schema.get("credential_type"))
credential = await self.create_credential_ex(
credential_values, schema.get("credential_type")
)
return [credential, None]

async def create_credential_ex(
Expand Down
4 changes: 2 additions & 2 deletions aries_cloudagent/pdstorage_thcf/own_your_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aiohttp import ClientSession, ClientConnectionError, ClientError
from aries_cloudagent.aathcf.credentials import assert_type, assert_type_or
import time
from collections import OrderedDict


LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -163,7 +163,7 @@ async def load(self, dri: str) -> dict:
url, headers={"Authorization": "Bearer " + self.token["access_token"]}
)
result = await unpack_response(result)
result_dict: dict = json.loads(result, object_pairs_hook=OrderedDict)
result_dict: dict = json.loads(result)

return result_dict

Expand Down
9 changes: 6 additions & 3 deletions aries_cloudagent/pdstorage_thcf/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from marshmallow import fields, validate, Schema
from .base import BasePDS
from .api import pds_load, pds_save, load_multiple
from .api import pds_load, pds_save, pds_save_a, load_multiple
from .error import PDSError
from ..connections.models.connection_record import ConnectionRecord
from ..wallet.error import WalletError
Expand All @@ -24,8 +24,10 @@

OCA_DATA_CHUNKS = "tda.oca_chunks"


class SaveRecordSchema(Schema):
payload = fields.Str(required=True)
oca_schema_dri = fields.Str(required=False)


class SetActiveStorageTypeSchema(Schema):
Expand Down Expand Up @@ -56,7 +58,9 @@ async def save_record(request: web.BaseRequest):
body = await request.json()

try:
payload_id = await pds_save(context, body.get("payload"))
payload_id = await pds_save_a(
context, body.get("payload"), table=body.get("oca_schema_dri")
)
except PDSError as err:
raise web.HTTPInternalServerError(reason=err.roll_up)

Expand Down Expand Up @@ -193,7 +197,6 @@ async def get_settings(request: web.BaseRequest):
try:
saved_pds = await SavedPDS.query(context)
assert isinstance(saved_pds, list), f"not list {saved_pds}, {type(saved_pds)}"
print("get_settings saved_pds:", saved_pds)
except StorageError as err:
raise web.HTTPInternalServerError(reason=err.roll_up)

Expand Down

0 comments on commit 24edd56

Please sign in to comment.