@trustvc/w3c-cli v1.2.3
TrustVC W3C CLI
w3c-cli is a command-line interface tool designed to demonstrate how to interact with Verifiable Credentials (VCs) and Decentralized Identifiers (DIDs) using functions from the following repositories:
This CLI provides a quick and straightforward way for users to:
- Create key pairs
- Generate well-known DIDs
- Generate a signed Credential Status
- Sign and verify VCs via the command line.
Table of Contents
Installation
- Install CLI:
!NOTE Remember to install the cli globally
npm install -g @trustvc/w3c-cli- Run the CLI commands as needed:
w3c-cli <command>How It Works
Generating Key Pairs: The CLI utilizes the
generateKeyPairfunction from thew3c-issuerrepository to generate key pairs, These key pairs are essential for creating DIDs and signing VCs.Generating Well-Known DID: The CLI uses the
issueDIDfunction from thew3c-issuerrepository to generate a well-known DID. This allows users to self-host their DID as a unique identifier in decentralized systems.Signing Verifiable Credentials: The CLI digitally signs a Verifiable Credential using the
signCredentialfunction from thew3c-vcrepository, ensuring that the credential is tamper-evident and can be trusted by external verifiers.Verifying Verifiable Credentials: The CLI verifies the authenticity of a signed Verifiable Credential using the
verifyCredentialfunction from thew3c-vcrepository, checking the cryptographic proof to ensure the credential has not been altered and confirming the validity of the issuer's signature.Generating a Signed Credential Status: The CLI creates a Bitstring
StatusListfrom thew3c-credential-statusrepository and uses thecreateCredentialStatusPayloadfunction to generate the pre-signed VC. It is then signed with thesignCredentialfunction from thew3c-vcrepository, returning a signed Credential Status VC, which users can self-host.Updating a Signed Credential Status: The CLI updates a signed Credential Status VC by downloading the hosted Credential Status VC. It then validates and parses the Bitstring
StatusList, iteratively updating theStatusList, and signing the updated Credential Status using thesignCredentialfunction from thew3c-vcrepository. Finally, it returns an updated signed Credential Status VC, which users can self-host.
Commands
The CLI provides several commands to help users interact with DIDs and Verifiable Credentials:
w3c-cli key-pair
This command generates a DID key pair, importing functions from the w3c-issuer repository. The generated key pairs are used to create DIDs and sign VCs.
w3c-cli did
This command generates a well-known DID using functionality from the w3c-issuer repository, allowing users to self-host their own DID.
w3c-cli sign
The sign command digitally signs a Verifiable Credential, leveraging the w3c-vc repository to create cryptographic proofs for the credentials, ensuring that the data remains tamper-evident and can be verified by any party.
w3c-cli verify
This command verifies the authenticity of a signed Verifiable Credential using the cryptographic proofs generated by the w3c-vc repository. It ensures that the credential has not been altered and confirms the validity of the issuer’s signature.
w3c-cli credential-status create
This command creates a signed Credential Status VC using the Bitstring StatusList.
w3c-cli credential-status update
This command updates any existing Credential Status VC and resign the Credential Status after it has been updated.
Directory Structure
Each command file is located in the src/commands directory and imports relevant functions from the w3c-issuer, w3c-vc and w3c-credential-status repositories.
├── src
│ └── commands
│ ├── credentialStatus
│ | ├── create.ts
│ | └── update.ts
│ ├── credential-status.ts
│ ├── did.ts
│ ├── key-pair.ts
│ ├── sign.ts
│ └── verify.ts
├── package.json
└── README.md10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago