Credential Management

Wallet Server stores Verifiable Credentials (VCs) per user. You can import, list, fetch, and delete credentials.

Endpoints

  • POST /credentials

    • Imports a credential JSON. Validates schema, proof, and (by default) that the subject matches the holder DID.

    • Body:

      • credential: VC JSON

      • allowForeignSubject (boolean, default false): if true, skip subject‑equals‑holder check

  • GET /credentials

    • Returns { count, credentials } with optional filters:

      • network: mainnet | testnet (derived from VC id DID)

      • type: VC type

      • status: W3C StatusPurpose

      • issuedAt: ISO date

      • version: 1 | 2

  • GET /credentials/:id

    • Returns a specific credential by id.

  • DELETE /credentials

    • Deletes all credentials for the authenticated user.

  • DELETE /credentials/:id

    • Deletes a specific credential by id.

Examples

Import a credential:

curl -X POST http://localhost:3000/credentials \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"credential": { ... }, "allowForeignSubject": false}'

List testnet credentials of a given type:

curl -H 'Authorization: Bearer <token>' \
  'http://localhost:3000/credentials?network=testnet&type=UniversityDegreeCredential'

Fetch by id:

curl -H 'Authorization: Bearer <token>' http://localhost:3000/credentials/<vc-id>

Delete all:

curl -X DELETE -H 'Authorization: Bearer <token>' http://localhost:3000/credentials

Delete by id:

curl -X DELETE -H 'Authorization: Bearer <token>' http://localhost:3000/credentials/<vc-id>

Validation Rules (high level)

  • Credential must have a recipient (holder)

  • Unless allowForeignSubject=true, credentialSubject.id must equal holder DID

  • Credential must have a credentialSchema

  • Proof verification and schema validation must pass

Last updated