Fix some defaults values + indentation
[oweals/peertube.git] / server / helpers / custom-jsonld-signature.ts
1 import * as AsyncLRU from 'async-lru'
2 import * as jsonld from 'jsonld/'
3 import * as jsig from 'jsonld-signatures'
4
5 const nodeDocumentLoader = jsonld.documentLoaders.node()
6
7 const lru = new AsyncLRU({
8   max: 10,
9   load: (key, cb) => {
10     nodeDocumentLoader(key, cb)
11   }
12 })
13
14 jsonld.documentLoader = (url, cb) => {
15   lru.get(url, cb)
16 }
17
18 jsig.use('jsonld', jsonld)
19
20 export { jsig }