fix encode decode base64

This commit is contained in:
Cayo Puigdefabregas 2024-02-14 18:35:34 +01:00
parent 0fed4b914d
commit 764d1e5f03
2 changed files with 7 additions and 3 deletions

View file

@ -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",

View file

@ -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')
)
)
)