summaryrefslogtreecommitdiffstats
path: root/core/ld.py
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-06 13:48:04 -0700
committerAndrew Godwin2022-11-06 13:48:04 -0700
commitdbe57075d386d7474bafc208b654507d9a2d769e (patch)
tree96b779d17753669f42b7569ec4ec66834b0673f4 /core/ld.py
parent8aec395331a1e9ec4ef1ea38aa20b8517131133b (diff)
downloadtakahe-dbe57075d386d7474bafc208b654507d9a2d769e.tar.gz
takahe-dbe57075d386d7474bafc208b654507d9a2d769e.tar.bz2
takahe-dbe57075d386d7474bafc208b654507d9a2d769e.zip
Rework to a domains model for better vhosting
Diffstat (limited to 'core/ld.py')
-rw-r--r--core/ld.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/ld.py b/core/ld.py
index 38e436a..28ff65a 100644
--- a/core/ld.py
+++ b/core/ld.py
@@ -252,7 +252,7 @@ def builtin_document_loader(url: str, options={}):
)
-def canonicalise(json_data):
+def canonicalise(json_data, include_security=False):
"""
Given an ActivityPub JSON-LD document, round-trips it through the LD
systems to end up in a canonicalised, compacted format.
@@ -264,5 +264,12 @@ def canonicalise(json_data):
raise ValueError("Pass decoded JSON data into LDDocument")
return jsonld.compact(
jsonld.expand(json_data),
- ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
+ (
+ [
+ "https://www.w3.org/ns/activitystreams",
+ "https://w3id.org/security/v1",
+ ]
+ if include_security
+ else "https://www.w3.org/ns/activitystreams"
+ ),
)