-
Notifications
You must be signed in to change notification settings - Fork 19
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
Locally cached Context for OAv3 docs #234
Comments
(On a side note):
|
When we say the "context", can I presume it's referring to the URLs in the |
Yep, I do mean the JSON-LD files referred to in the @context section.
I realise now I haven't been clear above, sorry! I'm not thinking about using it in the browser here. In this case we are using OpenAttestation server-side, behind the VC-API. We're currently using AWS Lambda for this. Does the issue make more sense now? |
We're currently running OA as a serverless (Lambda) app, which breaks context pre-caching. That is, every call to wrapDocument() fetches all the named jsonld contexts. This makes for a lot of wasted time.
An obvious solution is to pull in these contexts at build time, and only fetch unusual contexts.
If this is something that makes sense to others, I would be happy to raise a PR. I think the most flexible approach is to allow the user to pass in a custom
documentLoader
function to the call tovalidateW3C
. In the current code, this would probably have to be included as n option inwrapDocument
An alternate, and easier option would be no dynamic loading at all, just use what's included in the build. I note this is the approach taken by DIDkit, where currently all contexts are baked in at compile time, This would be particularly simple, but of course it couldn't support new credential types without a re-build.
Any thoughts?
(edited for clarity)
The text was updated successfully, but these errors were encountered: