Verifying Documents (CLI)
For the current step, you can either opt to use the CLI or Code.
This document provides a step-by-step guide on how to verify the authenticity and integrity of a signed document using the TrustVC CLI tool. The verification process works for both W3C Verifiable Credentials and OpenAttestation documents, ensuring that the document has not been tampered with and validates the issuer's signature.
Prerequisites
- Install the TrustVC CLI tool on your system
- Ensure you have the JSON file of the signed document (e.g.,
signed_vc.json)
Installation
Install CLI:
Note: Remember to install the CLI globally
npm install -g @trustvc/trustvc-cli
Verification Process
Run the verify command:
trustvc verify
The CLI will guide you through an interactive verification process:
? Please enter the path to your document: ./signed_vc.json
ℹ info Verifying W3C document...
✔ success DOCUMENT_INTEGRITY: VALID
✔ success DOCUMENT_STATUS: VALID
✔ success ISSUER_IDENTITY: VALID
Understanding the Verification Results
The verification process checks three key aspects:
- DOCUMENT_INTEGRITY: Validates that the cryptographic proofs are correct and the document has not been tampered with
- DOCUMENT_STATUS: Confirms the document's revocation/suspension status (if applicable)
- ISSUER_IDENTITY: Verifies the issuer's identity and signature
Possible Verification Statuses
- ✔ VALID: The verification check passed successfully
- ⚠ INVALID: The verification check failed
- ⚠ ERROR: An error occurred during verification
Example: OpenAttestation Document Verification
For OpenAttestation documents, the output will be similar:
? Please enter the path to your document: ./wrapped_document.json
ℹ info Verifying OpenAttestation document...
✔ success DOCUMENT_INTEGRITY: VALID
✔ success DOCUMENT_STATUS: VALID
✔ success ISSUER_IDENTITY: VALID
Handling Expired or Revoked Documents
If a document has expired or been revoked, you'll see warnings:
⚠ warning The document credential has expired.
✔ success DOCUMENT_INTEGRITY: VALID
⚠ warning DOCUMENT_STATUS: INVALID - Document has been revoked.
✔ success ISSUER_IDENTITY: VALID
Notes
- The CLI automatically detects whether the document is a W3C Verifiable Credential or an OpenAttestation document
- For transferable records or revokable documents, the CLI may automatically detect and use the appropriate blockchain network
- Ensure that the document file is in the correct JSON format
- If verification fails, double-check the file path and the format of the document JSON file