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/w3c-cli

Signing

Run the Command Execute the following command in your terminal:

w3c-cli sign

The tool will prompt you to provide the path to your key pair file.

? Please enter the path to your key pair JSON file: ./didKeyPairs.json

Next, you will be asked to provide the path to your Verifiable Credential file.

? Please enter the path to your credential JSON file: ./vc.json

Provide the directory path where the signed credential will be saved.

? Please specify a directory path to save your signed verifiable credential: .

The . indicates the current directory. You can specify a different path if needed.

Once the process is complete, the signed credential will be saved to the specified location.

Signed credential saved successfully to ./signed_vc.json

In this example, the signed credential is saved as signed_vc.json in the current directory.

$ w3c-cli sign
? Please enter the path to your key pair JSON file: ./didKeyPairs.json
? Please enter the path to your credential JSON file: ./vc.json
? Please specify a directory path to save your signed verifiable credential: .
Signed credential saved successfully to ./signed_vc.json

The CLI digitally signs a Verifiable Credential using the signCredential function from the w3c-vc repository, ensuring that the credential is tamper-evident and can be trusted by external verifiers.

Commands The CLI provides several commands to help users interact with DIDs and Verifiable Credentials:

Additional information: Revocation of Verifiable Documents

Revoking of Verifiable Documents