2017-11-17 15:20:42 +01:00
|
|
|
import * as AsyncLRU from 'async-lru'
|
2018-10-23 11:38:48 +02:00
|
|
|
import * as jsonld from 'jsonld'
|
2017-11-17 15:20:42 +01:00
|
|
|
import * as jsig from 'jsonld-signatures'
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2017-12-18 11:53:04 +01:00
|
|
|
jsig.use('jsonld', jsonld)
|
|
|
|
|
2018-10-23 11:38:48 +02:00
|
|
|
export { jsig, jsonld }
|