aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/helpers/custom-jsonld-signature.ts
blob: afb9606181970b8805a3be063bd32e7ff6c39599 (plain) (tree)



















                                                        
import * as AsyncLRU from 'async-lru'
import * as jsonld from 'jsonld'
import * as jsig from 'jsonld-signatures'

jsig.use('jsonld', jsonld)

const nodeDocumentLoader = jsonld.documentLoaders.node()

const lru = new AsyncLRU({
  max: 10,
  load: (key, cb) => {
    nodeDocumentLoader(key, cb)
  }
})

jsonld.documentLoader = (url, cb) => {
  lru.get(url, cb)
}

export { jsig }