From e92269053e3fd0e9b9c155ded86a1668444f3d70 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 7 Jan 2020 15:24:27 +0100 Subject: Update http signature --- server/helpers/custom-jsonld-signature.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'server/helpers/custom-jsonld-signature.ts') 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({ }) } - nodeDocumentLoader(url, cb) + nodeDocumentLoader(url) + .then(value => cb(null, value)) + .catch(err => cb(err)) } }) -jsonld.documentLoader = (url, cb) => { - lru.get(url, cb) +jsonld.documentLoader = (url) => { + return new Promise((res, rej) => { + lru.get(url, (err, value) => { + if (err) return rej(err) + + return res(value) + }) + }) } export { jsonld } -- cgit v1.2.3