Support for webfinger context within jsonld signature verification

main
Bob Mottram 2024-01-21 10:37:03 +00:00
parent da4f0f034e
commit a67fe05375
2 changed files with 28 additions and 1 deletions

View File

@ -19,7 +19,10 @@ VALID_CONTEXTS = (
"*/litepub-0.1.jsonld", "*/litepub-0.1.jsonld",
"https://litepub.social/litepub/context.jsonld", "https://litepub.social/litepub/context.jsonld",
"*/socialweb/webfinger", "*/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() -> {}: def getApschemaV1_10() -> {}:
# https://domain/apschema/v1.10 # https://domain/apschema/v1.10
return { return {

View File

@ -47,6 +47,7 @@ from context import get_litepub_social
from context import get_v1schema from context import get_v1schema
from context import get_v1security_schema from context import get_v1security_schema
from context import get_activitystreams_schema from context import get_activitystreams_schema
from context import get_webfinger_context
try: try:
from functools import cmp_to_key from functools import cmp_to_key
@ -439,6 +440,14 @@ def load_document(url):
'document': getLitepubV0_1() 'document': getLitepubV0_1()
} }
return doc 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': elif url == 'https://litepub.social/litepub/context.jsonld':
doc = { doc = {
'contextUrl': None, 'contextUrl': None,