]>
Commit | Line | Data |
---|---|---|
9a27cdc2 C |
1 | import * as AsyncLRU from 'async-lru' |
2 | import * as jsonld from 'jsonld' | |
3 | import * as jsig from 'jsonld-signatures' | |
4 | ||
5 | jsig.use('jsonld', jsonld) | |
6 | ||
7 | const nodeDocumentLoader = jsonld.documentLoaders.node() | |
8 | ||
9 | const lru = new AsyncLRU({ | |
10 | max: 10, | |
11 | load: (key, cb) => { | |
12 | nodeDocumentLoader(key, cb) | |
13 | } | |
14 | }) | |
15 | ||
16 | jsonld.documentLoader = (url, cb) => { | |
17 | lru.get(url, cb) | |
18 | } | |
19 | ||
20 | export { jsig } |