Migration Guide - OpenAttestation to TrustVC
OpenCerts v3 uses TrustVC, a comprehensive wrapper library that supports both W3C Verifiable Credentials (VC) and OpenAttestation Verifiable Documents. This guide covers the key changes and steps required to migrate to issuing W3C VCs.
Overview
| OpenCerts v2 (OA) | OpenCerts v3 (TrustVC) | |
|---|---|---|
| Standard | OpenAttestation v2 | W3C VC Data Model v2.0 |
| Document Format | OA Wrapped Document | W3C VC with Data Integrity Proofs |
| Identity | DNS-TXT record + Document Store | did:web hosted at /.well-known/did.json |
| Signing | Document wrapping (merkle tree) | ecdsa-sd-2023 or bbs-2023 cryptosuites |
| Issuance | Document Store (Smart Contract) | Direct DID-based signing |
| Revocation | Document Store revoke method (on-chain) | Bitstring Status List (off-chain, hosted) |
Key Changes
1. Document Format
OpenCerts v2 used the OpenAttestation wrapped document format. OpenCerts v3 adopts the W3C Verifiable Credentials Data Model v2.0 via TrustVC.
v2 (OA format):
{
"issuers": [
{
"name": "Example University",
"documentStore": "0x1234...",
"identityProof": {
"type": "DNS-TXT",
"location": "example.edu"
}
}
],
"$template": {
"name": "EXAMPLE_CERT",
"type": "EMBEDDED_RENDERER",
"url": "https://renderer.example.edu"
}
}
v3 (W3C VC format):
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/security/data-integrity/v2"
],
"type": ["VerifiableCredential"],
"issuer": "did:web:example.edu",
"validFrom": "2024-01-01T00:00:00Z",
"validUntil": "2029-12-31T23:59:59Z",
"credentialStatus": {
"id": "https://example.edu/credentials/statuslist/1#1",
"type": "BitstringStatusListEntry",
"statusPurpose": "revocation",
"statusListIndex": "1",
"statusListCredential": "https://example.edu/credentials/statuslist/1"
},
"credentialSubject": {
"name": "John Doe",
"course": "Bachelor of Science"
}
}
Note: W3C VC documents do not require wrapping. They are signed directly using
signW3C.
2. Identity
- v2: Used
DNS-TXTrecords pointing to a Document Store smart contract address. - v3: Issuers are identified using
did:webDecentralized Identifiers with Multikey verification methods. See Setting Updid:webIdentity for details.
3. Signing
- v2: Documents were wrapped using OA CLI, then issued by calling the
issuemethod on a Document Store smart contract. - v3: Documents are signed directly using
signW3Cwithecdsa-sd-2023(default) orbbs-2023cryptosuites. No on-chain transaction is required for issuance.
4. Verification
- v2: Used
@opencerts/verifybuilt on@govtechsg/oa-verifyfor fragment-based verification. - v3: Uses
verifyDocumentfrom@trustvc/trustvc, which auto-detects the document format and handles both OA and W3C VC verification.
5. Revocation
- v2: Revocation was done on-chain by calling the
revokemethod on the Document Store smart contract. - v3: Uses Bitstring Status Lists — an off-chain approach where a hosted status list tracks revoked credentials. See Setting Up Credential Revocation for details.
Migration Steps
Step 1: Update Dependencies
# Remove OA dependencies
npm uninstall @govtechsg/open-attestation @opencerts/verify @govtechsg/oa-verify
# Install TrustVC
npm install @trustvc/trustvc