Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data model - JSON-LD Schema #93

Open
sudeshrshetty opened this issue May 9, 2021 · 4 comments
Open

New data model - JSON-LD Schema #93

sudeshrshetty opened this issue May 9, 2021 · 4 comments

Comments

@sudeshrshetty
Copy link
Contributor

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.

@sudeshrshetty
Copy link
Contributor Author

ping @OR13

@OR13
Copy link
Collaborator

OR13 commented May 13, 2021

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.

@OR13
Copy link
Collaborator

OR13 commented May 13, 2021

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.

@sudeshrshetty
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants