diff --git a/context.py b/context.py index 80ac79df9..f75982842 100644 --- a/context.py +++ b/context.py @@ -19,7 +19,10 @@ VALID_CONTEXTS = ( "*/litepub-0.1.jsonld", "https://litepub.social/litepub/context.jsonld", "*/socialweb/webfinger", - "*/socialweb/webfinger.jsonld" + "*/socialweb/webfinger.jsonld", + "https://www.w3.org/ns/did/v1", + "https://w3id.org/security/multikey/v1", + "https://w3id.org/security/data-integrity/v1" ) @@ -160,6 +163,21 @@ def getApschemaV1_20() -> {}: } +def get_webfinger_context() -> {}: + # https://domain/socialweb/webfinger.jsonld + # https://domain/socialweb/webfinger + return { + "@context": { + "wf": "https://purl.archive.org/socialweb/webfinger#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "webfinger": { + "@id": "wf:webfinger", + "@type": "xsd:string" + } + } + } + + def getApschemaV1_10() -> {}: # https://domain/apschema/v1.10 return { diff --git a/pyjsonld.py b/pyjsonld.py index e800a1fca..4a514ee84 100644 --- a/pyjsonld.py +++ b/pyjsonld.py @@ -47,6 +47,7 @@ from context import get_litepub_social from context import get_v1schema from context import get_v1security_schema from context import get_activitystreams_schema +from context import get_webfinger_context try: from functools import cmp_to_key @@ -439,6 +440,14 @@ def load_document(url): 'document': getLitepubV0_1() } return doc + elif (url.endswith('/socialweb/webfinger') or + url.endswith('/socialweb/webfinger.jsonld')): + doc = { + 'contextUrl': None, + 'documentUrl': url, + 'document': get_webfinger_context() + } + return doc elif url == 'https://litepub.social/litepub/context.jsonld': doc = { 'contextUrl': None,