Api
Note: This documentation is mainly a copy from the SSI-SDK for your convenience
This module provides a W3C Verifiable Credential API, to allow issuance and verification of VCs and VPs.
VC API
For more information about the W3C VC API visit the W3C VC API Github. This module allows you to issue, persist, retrieve and verify Verifiable Credentials (other endpoints are not supported yet)
There are 3 modes of resolution, controlled by a query parameter, when calling the resolution endpoint. You can also set a default mode when no query parameter is being used.
The modes are:
- local: Only DIDs managed by the agent can be resolved. DID:web and it’s keys are translated to DID documents
- global: Resolves DIDs by using the supported resolvers of the agent, allowing external DID resolution
- hybrid (default): Tries to resolve locally first. If not found it will fallback to the global mode
Issuance example
The below example resolves the provided did:web DID using external resolution by looking up the domain from the provided host at https://ddip.sphereon.com.
Body:
Configure API
You can configure and build the API in multiple ways. This module also exposes functions for every endpoint, so you are
able to create your own Express router and then use functions to enable certain endpoints in your solution. The more
easy route is to use the VcApiServer
class. This class has configuration support, allowing to enable/disable
certain features, like for instance whether VCs can be created, persisted, and/or verified.
Note: You can have multiple instances of the VcApiServer, as long as you make sure that the basePaths differs for each instance and that the same express is being used.
Requirements
For this plugin a DID resolver is also required. A DID resolver can be added to the agent as plugin as seen in the example below. You can find resolvers in the Veramo project and our SSI-SDK-crypto-extensions