-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
What
pydid's DIDCommV1Service.recipient_keys are required to be DIDUrl, referencing a verificationMethod (ideally in the same document) however those id's are randomly generated.
Why
To use the didurl, a consumer of this API must repair the reference by making assumptions about the structure of the document. See my workaround implemented in acapy openwallet-foundation/acapy#2472 (comment)
def _resolve_peer_did_with_service_key_reference(
peer_did_2: Union[str, DID]
) -> DIDDocument:
try:
doc = resolve_peer_did(peer_did_2)
## WORKAROUND LIBRARY NOT REREFERENCING RECEIPIENT_KEY
services = doc.service
signing_keys = [
vm
for vm in doc.verification_method or []
if vm.type == "Ed25519VerificationKey2020"
]
if services and signing_keys:
services[0].__dict__["recipient_keys"] = [signing_keys[0].id]
else:
raise Exception("no recipient_key signing_key pair")
except Exception as e:
raise ValueError("pydantic validation error:" + str(e))
return doc
Success Criteria
After resolve_peer_did, calling dereference on the service.recipient_key should work with no modification. My example is one possible solution.
Metadata
Metadata
Assignees
Labels
No labels