Compare commits

...

4 Commits

Author SHA1 Message Date
Cayo Puigdefabregas d3e8580d00 fix not path in did web 2024-06-04 17:56:34 +02:00
Cayo Puigdefabregas fb6e1270ee up version 2024-06-04 17:54:22 +02:00
Cayo Puigdefabregas 58d016f1cb fix more generic request 2024-06-04 17:54:06 +02:00
Cayo Puigdefabregas 2f13c00dcd fix signs did web 2024-06-04 17:53:48 +02:00
5 changed files with 8 additions and 5 deletions

View File

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

View File

@ -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:

View File

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

View File

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

View File

@ -9,7 +9,7 @@ test_requires = [
setup( setup(
name="pyvckit", name="pyvckit",
version="0.0.7", version="0.0.8",
packages=['pyvckit'], packages=['pyvckit'],
install_requires=[ install_requires=[
"jsonref", "jsonref",