Privacy-preserving verifiable credential demo using BBS signatures (@digitalbazaar/bbs-signatures).
This project simulates three roles:
issuer: creates a signed credential for a holder.holder: selectively discloses requested fields and generates a proof.verifier: creates a request and verifies the holder's proof offline.
- A verifier can check that disclosed claims are signed by the issuer.
- The holder can reveal only policy-required fields (not the full credential).
- Verification includes proof validity and credential expiry check.
- Node.js 18+ (recommended)
- npm
npm installRun the single-runner menu:
npm startYou can run:
1) Issue ID2) Verifier creates request3) Holder responds4) Verifier verifies5) Full flow(recommended for a clean demo)
node issuer.jsWrites:
holder_store/credential.json
node verifier.js request 1A "E-Corp"Writes:
request.json
node holder.jsWrites:
presentation.json(if consent = yes)
node verifier.js verify "E-Corp"Writes:
verification_result.json
1A: validate age over 181B: validate age over 212A: validate age and name
Policy definitions are in utils.js under REQUEST_POLICIES.
interactive.js: menu runner for full workflowissuer.js: credential issuance and signingholder.js: selective disclosure + proof derivationverifier.js: request generation + proof verificationutils.js: crypto helpers and policy definitions
Output artifacts:
holder_store/credential.jsonrequest.jsonpresentation.jsonverification_result.json
verification_result.json includes:
verifiedProof: cryptographic proof verification resultnotExpired: whether disclosedexpiryis in the futurevalid:verifiedProof && notExpireddisclosed: disclosed key/value claimscomputedAge: only present whendobis disclosed (e.g.,2A)
- If verification fails, regenerate artifacts in order:
- issue
- request
- presentation
- verify
- Do not reuse old
presentation.jsonwith a newrequest.json. - Use interactive option
7to reset session files (request/presentation/verification) when testing repeatedly.
- This is a local proof-of-concept, not production credential infrastructure.
- No network transport, revocation, or DID resolution is implemented.