The aim of this project is to collect here multiple verifiable credentials implementations.
It started by reusing the core code of vc-service.
To see how that was done, see FROM_VC_SERVICE_TO_HERE.md.
- Node v20 or higher
npm iBuild to generate Typescript output in the ./dist directory:
npm run buildBundle to generate one bundle for browser usage per implementation in the ./bundle directory:
npm run bundleGet help by executing:
node dist/cli.jsSome example commands (here for the solid implementation): run_cli_solid.sh
Please note that as long as this project is not published as a npm package, you may using methods such as npm link to refer to it from your project.
Proceed as follows:
-
Pick the implementation of your choice from: select it from the
exportsin package.json, for example:solid. -
Import common definitions, an
xxxApiand axxxConfiguration, as in this example for thesolidimplementation:import { ContentType, Document, VerificationResult, IIssuer, IVerifier } from "vc-prototyping-library"; import { SolidApi, SolidConfiguration } from "vc-prototyping-library/solid";
-
Construct an api object with the appropriate configuration and you're ready to go.
See the command line implementation and the test for implementations as a Typescript library for client code examples.
Proceed as follows:
-
Pick the bundle for the implementation of your choice: copy one of the js files in directory
bundleto your project. For example: copybundle/solid/api.jsto your project'svendors/vc/bundle/solid/api.js. -
Import an
xxxApi, as in this example for thesolidimplementation:import { SolidApi } from "./vendors/vc/bundle/solid/api.js";
-
Construct an api object with the appropriate configuration and you're ready to go.
See test for implementations as a Javascript browser bundle for a client code example.
Build on any source file change by running this in a separate shell:
npm run watchTo add a new implementation, use src/implementations/solid) as an example. This is how to proceed, step by step:
-
Create a new directory, whose name is the name of your implementation in src/implementations/).
-
In this directory, create a file
api.ts. It must start with the following import line:import { ContentType, Document, VerificationResult, IIssuer, IVerifier } from "../../api-spec.js";
-
In your
api.ts, define a new configuration and api implementation, similar toSolidConfigurationandSolidApiin src/implementations/solid/api.ts). -
Further implementation is up to you.
-
Do a global search in the project for "
To support extra implementations" and follow the instructions you find there.
The BasicConfiguration in the src/api-spec.ts defines a property that can be reused in any configuration
to define what JSON-LD documents to preload.
See src/implementations/solid/api.ts for a first implementation that uses it.
For the Solid implementation, you need to set up a Solid pod. Execute:
npm run setup:cssWe use Vitest. Execute:
npm run test