]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/custom-jsonld-signature.ts
Use RsaSignature2017
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-jsonld-signature.ts
CommitLineData
9a27cdc2 1import * as AsyncLRU from 'async-lru'
ce33ee01 2import * as jsonld from 'jsonld/'
9a27cdc2
C
3import * as jsig from 'jsonld-signatures'
4
9a27cdc2
C
5const nodeDocumentLoader = jsonld.documentLoaders.node()
6
7const lru = new AsyncLRU({
8 max: 10,
9 load: (key, cb) => {
10 nodeDocumentLoader(key, cb)
11 }
12})
13
14jsonld.documentLoader = (url, cb) => {
15 lru.get(url, cb)
16}
17
ce33ee01
C
18jsig.use('jsonld', jsonld)
19
9a27cdc2 20export { jsig }