From 764d1e5f0370c520d4459184b43bd0407e0f051f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 14 Feb 2024 18:35:34 +0100 Subject: [PATCH] fix encode decode base64 --- idhub/views.py | 6 +++++- utils/idhub_ssikit/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/idhub/views.py b/idhub/views.py index e5b90ce..0d0ee68 100644 --- a/idhub/views.py +++ b/idhub/views.py @@ -118,7 +118,11 @@ def serve_did(request, did_id): # revoked_credential_indexes.append(credential.revocationBitmapIndex) # TODO: Conditionally add "service" to DID document only if the DID has issued any VC revocation_bitmap = pyroaring.BitMap(revoked_credential_indexes) - encoded_revocation_bitmap = base64.b64encode(zlib.compress(revocation_bitmap.serialize())) + encoded_revocation_bitmap = base64.b64encode( + zlib.compress( + revocation_bitmap.serialize() + ) + ).decode('utf-8') revocation_service = [{ # This is an object within a list. "id": f"{id_did}#revocation", "type": "RevocationBitmap2022", diff --git a/utils/idhub_ssikit/__init__.py b/utils/idhub_ssikit/__init__.py index 81a2599..d97848b 100644 --- a/utils/idhub_ssikit/__init__.py +++ b/utils/idhub_ssikit/__init__.py @@ -117,7 +117,7 @@ def verify_credential(vc): return valid, reason # Credential passes basic signature verification. Now check it against its schema. # TODO: check agasint schema - pass + # pass # Credential verifies against its schema. Now check revocation status. vc = json.loads(vc) if "credentialStatus" in vc: @@ -130,7 +130,7 @@ def verify_credential(vc): revocation_bitmap = BitMap.deserialize( zlib.decompress( base64.b64decode( - issuer_revocation_list["serviceEndpoint"].rsplit(",")[1] + issuer_revocation_list["serviceEndpoint"].rsplit(",")[1].encode('utf-8') ) ) )