]>
Commit | Line | Data |
---|---|---|
9a27cdc2 | 1 | import * as AsyncLRU from 'async-lru' |
df66d815 | 2 | import * as jsonld from 'jsonld' |
9a27cdc2 C |
3 | import * as jsig from 'jsonld-signatures' |
4 | ||
9a27cdc2 C |
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 | ||
ce33ee01 C |
18 | jsig.use('jsonld', jsonld) |
19 | ||
df66d815 | 20 | export { jsig, jsonld } |