Compare commits
4 Commits
fda78d7358
...
d3e8580d00
Author | SHA1 | Date |
---|---|---|
Cayo Puigdefabregas | d3e8580d00 | |
Cayo Puigdefabregas | fb6e1270ee | |
Cayo Puigdefabregas | 58d016f1cb | |
Cayo Puigdefabregas | 2f13c00dcd |
|
@ -26,7 +26,9 @@ def key_to_did(public_key_bytes, url):
|
||||||
u = urlparse(url)
|
u = urlparse(url)
|
||||||
domain = u.netloc
|
domain = u.netloc
|
||||||
path = u.path.strip("/").replace("/", ":")
|
path = u.path.strip("/").replace("/", ":")
|
||||||
return f"did:web:{domain}:{path}:{did}"
|
if path:
|
||||||
|
return f"did:web:{domain}:{path}:{did}"
|
||||||
|
return f"did:web:{domain}:{did}"
|
||||||
|
|
||||||
return f"did:key:{did}"
|
return f"did:key:{did}"
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ def requests_document_loader(secure=False, **kwargs):
|
||||||
headers = {
|
headers = {
|
||||||
'Accept': 'application/ld+json, application/json'
|
'Accept': 'application/ld+json, application/json'
|
||||||
}
|
}
|
||||||
response = requests.get(url, headers=headers, **kwargs)
|
# response = requests.get(url, headers=headers, **kwargs)
|
||||||
|
response = requests.get(url)
|
||||||
|
|
||||||
content_type = response.headers.get('content-type')
|
content_type = response.headers.get('content-type')
|
||||||
if not content_type:
|
if not content_type:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from pyvckit.sign import sign_proof
|
||||||
|
|
||||||
def sign(credential, key, issuer_did):
|
def sign(credential, key, issuer_did):
|
||||||
document = json.loads(credential)
|
document = json.loads(credential)
|
||||||
_did = issuer_did + "#" + issuer_did.split("did:key:")[1]
|
_did = issuer_did + "#" + issuer_did.split(":")[-1]
|
||||||
proof = json.loads(proof_tmpl)
|
proof = json.loads(proof_tmpl)
|
||||||
proof['verificationMethod'] = _did
|
proof['verificationMethod'] = _did
|
||||||
proof['created'] = now()
|
proof['created'] = now()
|
||||||
|
|
|
@ -12,7 +12,7 @@ def sign_vp(signing_key, holder_did, vc):
|
||||||
presentation["verifiableCredential"].append(json.loads(vc))
|
presentation["verifiableCredential"].append(json.loads(vc))
|
||||||
presentation["holder"] = holder_did
|
presentation["holder"] = holder_did
|
||||||
|
|
||||||
_did = holder_did + "#" + holder_did.split("did:key:")[1]
|
_did = holder_did + "#" + holder_did.split(":")[-1]
|
||||||
proof = json.loads(proof_tmpl)
|
proof = json.loads(proof_tmpl)
|
||||||
proof['verificationMethod'] = _did
|
proof['verificationMethod'] = _did
|
||||||
proof['created'] = now()
|
proof['created'] = now()
|
||||||
|
|
Loading…
Reference in New Issue