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 +++++++++++--- server/helpers/peertube-crypto.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'server/helpers') 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 } 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 } function parseHTTPSignature (req: Request, clockSkew?: number) { - return httpSignature.parse(req, { authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, clockSkew }) + return httpSignature.parse(req, { clockSkew }) } // JSONLD -- cgit v1.2.3