aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-jsonld-signature.ts14
-rw-r--r--server/helpers/peertube-crypto.ts2
2 files changed, 12 insertions, 4 deletions
diff --git a/server/helpers/custom-jsonld-signature.ts b/server/helpers/custom-jsonld-signature.ts
index cb07fa3b2..a407a9fec 100644
--- a/server/helpers/custom-jsonld-signature.ts
+++ b/server/helpers/custom-jsonld-signature.ts
@@ -70,12 +70,20 @@ const lru = new AsyncLRU({
70 }) 70 })
71 } 71 }
72 72
73 nodeDocumentLoader(url, cb) 73 nodeDocumentLoader(url)
74 .then(value => cb(null, value))
75 .catch(err => cb(err))
74 } 76 }
75}) 77})
76 78
77jsonld.documentLoader = (url, cb) => { 79jsonld.documentLoader = (url) => {
78 lru.get(url, cb) 80 return new Promise((res, rej) => {
81 lru.get(url, (err, value) => {
82 if (err) return rej(err)
83
84 return res(value)
85 })
86 })
79} 87}
80 88
81export { jsonld } 89export { jsonld }
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts
index 9eb782302..89c0ab151 100644
--- a/server/helpers/peertube-crypto.ts
+++ b/server/helpers/peertube-crypto.ts
@@ -51,7 +51,7 @@ function isHTTPSignatureVerified (httpSignatureParsed: any, actor: MActor): bool
51} 51}
52 52
53function parseHTTPSignature (req: Request, clockSkew?: number) { 53function parseHTTPSignature (req: Request, clockSkew?: number) {
54 return httpSignature.parse(req, { authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, clockSkew }) 54 return httpSignature.parse(req, { clockSkew })
55} 55}
56 56
57// JSONLD 57// JSONLD