A mock server and test suite for the VCALM (Verifiable Credential API Lifecycle Management) HTTP API, based on the W3C VC API and W3C VC Data Model 2.0.
Use it to develop against VCALM APIs without a real implementation, or as a learning tool for understanding the full VC lifecycle.
npm installnode src/index.jsThe server listens on port 3000 by default. Set PORT to override.
curl -X POST http://localhost:3000/credentials/issue \
-H 'Content-Type: application/json' \
-d '{
"credential": {
"@context": ["https://www.w3.org/ns/credentials/v2"],
"type": ["VerifiableCredential"],
"issuer": "did:example:alice",
"validFrom": "2024-01-01T00:00:00Z",
"credentialSubject": {"id": "did:example:bob", "name": "Bob"}
}
}'curl -X POST http://localhost:3000/credentials/verify \
-H 'Content-Type: application/json' \
-d '{"verifiableCredential": <vc>}'curl -X POST http://localhost:3000/credentials/derive \
-H 'Content-Type: application/json' \
-d '{
"verifiableCredential": <vc>,
"options": {
"selectivePointers": ["/@context", "/type", "/issuer", "/validFrom"]
}
}'| Method | Path | Description |
|---|---|---|
| POST | /credentials/issue |
Issue a credential with a mock proof |
| POST | /credentials/verify |
Verify a credential |
| POST | /credentials/derive |
Selective disclosure derivation |
| POST | /credentials/status |
Update a credential's status |
| GET | /credentials/:id |
Retrieve a stored credential |
| DELETE | /credentials/:id |
Soft-delete a credential |
| Method | Path | Description |
|---|---|---|
| POST | /presentations |
Create a presentation |
| POST | /presentations/verify |
Verify a presentation |
| GET | /presentations |
List stored presentations |
| GET | /presentations/:id |
Retrieve a presentation |
| DELETE | /presentations/:id |
Soft-delete a presentation |
| Method | Path | Description |
|---|---|---|
| POST | /challenges |
Issue a single-use nonce |
| POST | /status-lists |
Create a StatusList2021 credential |
| GET | /status-lists/:id |
Retrieve a status list (public, no auth) |
Exchanges are stateful. State transitions: pending → active → complete (or
invalid on error). See Design Notes for the full state
machine.
| Method | Path | Description |
|---|---|---|
| POST | /workflows |
Create a workflow |
| GET | /workflows/:id |
Retrieve a workflow |
| POST | /workflows/:id/exchanges |
Create an exchange |
| GET | /workflows/:id/exchanges/:id |
Get exchange state |
| POST | /workflows/:id/exchanges/:id |
Participate in an exchange |
| GET | /workflows/:id/exchanges/:id/protocols |
Get supported protocol URLs |
| Method | Path | Description |
|---|---|---|
| GET | /interactions/:id?iuv=1 |
Get interaction protocols (iuv=1 required) |
PORT — TCP port to listen on (default: 3000)
npm test # unit + integration + conformance tests
npm run test:conformance # conformance suite only (supports VCALM_BASE_URL)
npm run lint # lint src and test
npm run typecheck # JSDoc type checking via tscTo run the conformance suite against a real VCALM server:
VCALM_BASE_URL=https://your-server.example npm run test:conformanceThe full OpenAPI 3.0 spec is at spec/oas.yaml.
- No real cryptography. Proofs are deterministic SHA-256 hashes prefixed with
mock-proof-. Verification checks the prefix — sufficient for round-trip tests, not for production use. - In-memory store. All state is lost on restart.
- Single-use challenges. Nonces issued via
POST /challengesare consumed on first use at/presentations/verify. redirectUrlis not supported. Returns400per spec guidance that implementations should reject it.- Unsigned presentation
holderfield is ignored. A warning is logged whenholderis present but no presentation-level proof exists.
See the contribute file!
PRs accepted.
If editing the Readme, please conform to the standard-readme specification.
New BSD License (3-clause) © Digital Bazaar