aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-jsonld-signature.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-jsonld-signature.ts')
-rw-r--r--server/helpers/custom-jsonld-signature.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/helpers/custom-jsonld-signature.ts b/server/helpers/custom-jsonld-signature.ts
new file mode 100644
index 000000000..afb960618
--- /dev/null
+++ b/server/helpers/custom-jsonld-signature.ts
@@ -0,0 +1,20 @@
1import * as AsyncLRU from 'async-lru'
2import * as jsonld from 'jsonld'
3import * as jsig from 'jsonld-signatures'
4
5jsig.use('jsonld', jsonld)
6
7const nodeDocumentLoader = jsonld.documentLoaders.node()
8
9const lru = new AsyncLRU({
10 max: 10,
11 load: (key, cb) => {
12 nodeDocumentLoader(key, cb)
13 }
14})
15
16jsonld.documentLoader = (url, cb) => {
17 lru.get(url, cb)
18}
19
20export { jsig }