Skip to main content

Feedback

Is this page helpful?

Version: 5.x

Signing Documents (CLI)

CLI

Code

Overview

Creating a DID

Creating Raw Document

Signing Documents - CLI

Signing Documents - Code

Revoking Documents

For the current step, you can either opt to use the CLI or Code.

Only while using bitstring for Credential Status, the list can be configured as either a revocation list or a suspension list, depending on the use case.

Each documents will be signed individually, and the proof of the signature will be appended into the signed documents.

Signing the documents

Installation

Install CLI:

Note Remember to install the cli globally

npm install -g @trustvc/trustvc-cli

Signing

Run the Command Execute the following command in your terminal:

trustvc w3c-sign

The CLI will guide you through an interactive signing process:

? Please enter the path to your Verifiable Credential JSON file: ./vc.json
? Please enter the path to your did key-pair JSON file: ./didKeyPairs.json
? Select the encryption algorithm used to generate the key pair:
❯ ECDSA-SD-2023 (Sign credential using ECDSA-SD-2023 suite)
BBS-2023 (Sign credential using BBS-2023 suite)
? Enter a directory to save the signed Verifiable Credential (optional): .

✔ success Verifiable Credential signed successfully
✔ success Signed verifiable credential saved to: ./signed_vc.json

Explanation of prompts:

  • Verifiable Credential path: Path to your unsigned VC JSON file
  • Key-pair path: Path to your DID key-pair file (generated from trustvc w3c key-pair-generation)
  • Encryption algorithm: Select the algorithm matching your key-pair (ECDSA-SD-2023 or BBS-2023)
  • Output directory: Where to save the signed credential (. indicates current directory)

The signed credential will be saved as signed_vc.json in the specified directory.

The CLI digitally signs a Verifiable Credential using the signW3C function from the @trustvc/trustvc package, ensuring that the credential is tamper-evident and can be trusted by external verifiers.

Additional information: Revocation of Verifiable Documents

Revoking of Verifiable Documents