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

Allow extension of DocumentLoader cache #145

Open
lemoustachiste opened this issue Apr 29, 2024 · 2 comments
Open

Allow extension of DocumentLoader cache #145

lemoustachiste opened this issue Apr 29, 2024 · 2 comments
Milestone

Comments

@lemoustachiste
Copy link

Hi,

I'm facing an issue with loading of remote context urls, and while I have found this: https://github.com/filip26/iron-verifiable-credentials/blob/main/src/main/java/com/apicatalog/vc/loader/StaticContextLoader.java#L39, there does not seem to be a way to extend that cached list with a customer's dedicated list.

I'm going to write my own DocumentLoader as I can specify one here https://github.com/filip26/iron-verifiable-credentials/blob/main/src/main/java/com/apicatalog/vc/holder/Holder.java#L54 (thanks for that) but as it seems I will have redundant properties and it would have been nice to leverage the one that is already available in the library.

Nothing critical but I think it would be a nice-to-have

@filip26 filip26 added this to the 0.15.0 milestone Jun 28, 2024
@filip26
Copy link
Owner

filip26 commented Jul 23, 2024

What do you think about this?

// Extend StaticContextLoader application wide
static {
  // pre-load resource from classpath
  StaticContextLoader.set(url, SomeClass.class, "name.jsonld");
  // set JSON document directly
  StaticContextLoader.set(url, document);   
}

@lemoustachiste
Copy link
Author

It's been a while but that looks like an easy enough API to consume.

The expectation would be that later on, by injecting the StaticContextLoader as DocumentLoader, any url/document pair set would be available for retrieval (through .loadDocument (https://github.com/filip26/iron-verifiable-credentials/blob/main/src/main/java/com/apicatalog/vc/loader/StaticContextLoader.java#L28)).

DigitalBazaar's API is named addStatic (https://github.com/digitalbazaar/security-document-loader/blob/main/lib/security-loader.js#L22) so that's another option but set is understandable enough in the context of this class (by opposition to get).

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