HTTP endpoint to export policy execution results
Motivation
The endpoint will be used by external organizations to receive JSON data formatted as Verifiable Credentials (VC) and Verifiable Presentations (VP).
Details
GET /v1/export/{exportName}
Different kinds of exports will be predefined and described by JSON configuration files stored in a MongoDB collection. Example format of export configuration could be:
{
"exportName": "myexport",
"context": ["https://www.w3.org/2018/credentials/v1","..."],
"did": "did:web:sd....",
"policies": {
"group/example/1.0":{"hello": "world"},
"group/example/2.0":{"hello": "world"}
}
}
The above example should trigger the export of the results from the execution of two policies.
Both results should be created as separate Verifiable Credentials and should be grouped in the final response as a Verifiable Presentation containing both credentials.
The input to the policy execution engine is statically predefined in the configuration for each policy (if any).
For example, when executing policy group/example/1.0
the input for the call in the body of the request is:
{"hello":"world"}
After policies are executed, their results are stored in the cache as separate entries and are combined when the final VP has to be created.
Scenarious
- Export name doesn't exist.
The service returns HTTP 404 Not Found error.
- There are no results in the cache which can be used to create VP and return it.
The service triggers the execution of the given policies asynchronously and returns HTTP 202 result to the caller.
- There are results in the cache which can be used to create VP.
The service creates a VP and returns it.