Open sudeshrshetty opened 3 years ago
ping @OR13
I love this idea, we have a similar issue with all types returned by a documentLoader.
This will take some thought to sort out, but I will try and add my thoughts on how we have been doing this with our documentLoaders.
We have a documentLoader pattern we use that looks like this:
export const getDocumentLoader = (wallet: UniversalWallet) => {
return async (iri: string) =>{
if (iri in cached contexts){
return wallet.get(iri);
}
if (iri in wallet cache for dids){
return wallet.get(iri);
}
if (iri in allowed did methods){
return wallet.resolve(iri);
}
}
}
This proposal would essentially be to allow different wallet instances to produce different cache enabled document loaders.
We have similar document loader cache in aries.
I agree with the plan of having different cache enabled document loader for different wallet instances. Wallet should be able to import the added context directly into cached document loader. I will push a PR shortly.
A proposal to introduce new data model for caching JSON-LD context documents locally in wallet.
If a wallet is aware of list of JSON LD contexts it is going to encounter more often, then those context documents can be added/cached locally. This will help wallet in many ways like offline access to contexts, resolving performance bottleneck of loading context each time from network etc.