diff --git a/docs/how-tos/deployment.md b/docs/how-tos/deployment.md index ad10014..a4e7a0d 100644 --- a/docs/how-tos/deployment.md +++ b/docs/how-tos/deployment.md @@ -4,51 +4,89 @@ title: Deployment sidebar_label: Deployment --- -### TDocDeployer - -TDocDeployer is a **deployer** contract for transferable documents using minimal proxy clones. It allows the deployment of contract instances based on predefined implementations while associating each implementation with a **titleEscrowFactory**. - -#### Key Features - -- Cloning Mechanism: Uses OpenZeppelin’s Clones library for efficient contract deployment. -- Implementation Management: Allows the owner to register, update, and remove implementations. -- Deployment Control: Ensures only registered implementations can be deployed. -- Upgradeability: Supports UUPS proxy pattern for future upgrades. - #### deploy Function Explanation The **deploy** function creates a new contract instance by cloning an existing implementation of **Token Registry**. -### Installing tradetrust-cli +### Installing TrustVC CLI > **⚠️ DISCLAIMER** > -> The TradeTrust CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. +> The TrustVC CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. > > It should not be used for production issuance or live document management, as it lacks security, scalability, and operational controls required for real-world environments. #### Binary -To install the binary, simply download the binary from the [CLI release page](https://github.com/TradeTrust/tradetrust-cli/releases) for your OS. +To install the binary, simply download the binary from the [CLI release page](https://github.com/TrustVC/trustvc-cli/releases) for your OS. We are aware that the size of the binaries must be reduced and we have tracked the issue in Github. We hope to find a solution in a near future and any help is welcomed. #### NPM -Alternatively for Linux or MacOS users, if you have npm installed on your machine, you may install the cli using the following command: +For Linux or MacOS users, if you have npm installed on your machine, you may install the CLI using the following command: ```bash -npm install -g @tradetrust-tt/tradetrust-cli +npm install -g @trustvc/trustvc-cli ``` -The above command will install the TradeTrust CLI to your machine. You will need to have node.js installed to be able to run the command. +The above command will install the TrustVC CLI to your machine. You will need to have node.js installed to be able to run the command. You can also opt to use npx: ```bash -npx -p @tradetrust-tt/tradetrust-cli tradetrust +npx @trustvc/trustvc-cli ``` +## Document Store + +The document store is a smart contract on the blockchain that records the issuance and revocation status of verifiable documents. You can deploy a document store contract using the TrustVC CLI. + +### Deploying via CLI + +```bash +trustvc deploy document-store +``` + +The CLI will interactively prompt you for: + +1. **Store name**: Enter the name of the document store (e.g., "My First Document Store") +2. **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +3. **Owner address**: Enter the owner address (optional - uses deployer address if not provided) +4. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable + +Example session: + +```bash +trustvc deploy document-store + +? Enter the name of the document store: My First Document Store +? Select a network: sepolia +? Enter the owner address (optional, press Enter to use deployer address): +? Select wallet type: Environment Variable (OA_PRIVATE_KEY) + +ℹ info Deploying document store My First Document Store +✔ success Document store My First Document Store deployed at 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... +``` + +**Save the document store address.** You will need this address for issuing and revoking documents. + +## TDocDeployer + +TDocDeployer is a **deployer** contract for transferable documents using minimal proxy clones. It allows the deployment of contract instances based on predefined implementations while associating each implementation with a **titleEscrowFactory**. + +### Key Features + +- Cloning Mechanism: Uses OpenZeppelin's Clones library for efficient contract deployment. +- Implementation Management: Allows the owner to register, update, and remove implementations. +- Deployment Control: Ensures only registered implementations can be deployed. +- Upgradeability: Supports UUPS proxy pattern for future upgrades. + +### deploy Function Explanation + +The **deploy** function creates a new contract instance by cloning an existing implementation of **Token Registry**. + ## TitleEscrowFactory The **TitleEscrowFactory** contract is responsible for deploying and managing instances of **TitleEscrow** contracts. It follows a factory pattern that enables the deterministic creation of title escrow instances using the Clones library from OpenZeppelin. This approach ensures gas efficiency and allows for easy management of multiple title escrow contracts. @@ -58,9 +96,14 @@ The Title Escrow Factory contract is already registered in our **TDocDeployer** Here's how: ```bash -tradetrust deploy title-escrow-factory --network sepolia +trustvc deploy title-escrow-factory ``` +The CLI will interactively prompt you for: + +- **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +- **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable + ## Token Registry You can deploy a Token Registry contract on the blockchain either as a standalone deployment or through a Factory Contract(tDocDeployer). If a Factory Contract has been deployed using the Token Registry, you can use the factory address flag to interact with it. Additionally, you have the flexibility to deploy the Token Registry using both the CLI and code, depending on your preferred approach. @@ -69,23 +112,49 @@ You can deploy a Token Registry contract on the blockchain either as a standalon #### 1) Deploying via CLI -Now we will see performing the deployment using tDocDeployer via the command line - +Now we will see performing the deployment using tDocDeployer via the command line. -- tDocDeployer can have multiple implementations added as option. The `--token-implementation-address` flag explicitly provides a custom token implementation address. It will look for this implementation address inside tDocDeployer. -- If no implementation is passed, **tDocDeployer** will automatically pick the **default implementation**. +The TrustVC CLI uses an interactive prompt system that guides you through the deployment process: ```bash -tradetrust deploy token-registry --token-implementation-address --network +trustvc deploy token-registry ``` -Example - with private key set in OA_PRIVATE_KEY environment variable (recommended). +The CLI will interactively prompt you for: -```bash -tradetrust deploy token-registry "My Sample Token" MST --network sepolia +1. **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +2. **Registry name**: Enter the name of the token registry (e.g., "My Sample Token") +3. **Registry symbol**: Enter the symbol of the token registry (e.g., "MST") +4. **Deployment type**: Choose between standalone or factory deployment + - If **factory deployment** (default): You can optionally provide: + - Token registry implementation address (optional - uses default if not provided) + - Deployer contract address (optional - uses default if not provided) +5. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable -✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 +Example session: + +```bash +trustvc deploy token-registry + +? Select a network: sepolia +? Enter the name of the token registry: My Sample Token +? Enter the symbol of the token registry: MST +? Is this a standalone deployment? No +? Enter the token registry implementation address (optional, press Enter to use default): +? Enter the deployer contract address (optional, press Enter to use default): +? Select wallet type: Environment Variable (OA_PRIVATE_KEY) + +ℹ info Deploying token registry My Sample Token +✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... ``` +**Notes:** + +- tDocDeployer can have multiple implementations added as options +- If no implementation address is provided, **tDocDeployer** will automatically pick the **default implementation** +- The CLI will perform a dry run on Ethereum and Polygon networks to estimate gas costs before deployment + #### 2) Deploying via code ##### Installation @@ -130,36 +199,83 @@ const initParam = v5Utils.encodeInitParams({ const tx = await connectedDeployer.deploy(implAddress, initParam); ``` -### StandAlone +### Standalone Deployment -If you want to deploy the Token Registry as a standalone contract instead of using TDocDeployer, you will need the Title Escrow Factory contract address. Below is the CLI command for deployment: +If you want to deploy the Token Registry as a standalone contract instead of using TDocDeployer, you will need the Title Escrow Factory contract address. ```bash -tradetrust deploy token-registry --factory-address --standalone --network +trustvc deploy token-registry ``` -Example - with private key set in OA_PRIVATE_KEY environment variable (recommended). +The CLI will interactively prompt you for: -```bash -tradetrust deploy token-registry "My Sample Token" MST --factory-address 0xfcafea839e576967b96ad1FBFB52b5CA26cd1D25 --standalone --network sepolia +1. **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +2. **Registry name**: Enter the name of the token registry (e.g., "My Sample Token") +3. **Registry symbol**: Enter the symbol of the token registry (e.g., "MST") +4. **Deployment type**: Choose **Yes** for standalone deployment + - If **standalone**: You can optionally provide: + - Factory address (optional - uses default Title Escrow Factory if not provided) +5. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable + +Example session: -✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 +```bash +trustvc deploy token-registry + +? Select a network: sepolia +? Enter the name of the token registry: My Sample Token +? Enter the symbol of the token registry: MST +? Is this a standalone deployment? Yes +? Enter the factory address (optional, press Enter to use default): 0xfcafea839e576967b96ad1FBFB52b5CA26cd1D25 +? Select wallet type: Environment Variable (OA_PRIVATE_KEY) + +ℹ info Deploying token registry My Sample Token +✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842 +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... ``` ## TitleEscrow ### Mint document to token registry -Mint a hash to a token registry deployed on the blockchain. The tokenId option would be used to indicate the document hash, and the to option to indicate the title escrow address the document is mapped to. Every minting of a new document will also create a new Title Escrow Contract . +Mint a hash to a token registry deployed on the blockchain. The tokenId is used to indicate the document hash, and the beneficiary and holder options indicate the title escrow ownership. Every minting of a new document will also create a new Title Escrow Contract. ```bash -tradetrust token-registry mint --network --address --tokenId --beneficiary --holder +trustvc token-registry mint ``` -Example - with private key set in OA_PRIVATE_KEY environment variable (recommended). +The CLI will interactively prompt you for: -```bash -tradetrust token-registry mint --network sepolia --address 0x6133f580aE903b8e79845340375cCfd78a45FF35 --tokenId 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c --beneficiary 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 --holder 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +1. **Document path**: Path to the wrapped document file (JSON) + - The CLI automatically extracts the token registry address, token ID, and network from the document + - Verifies the document signature before proceeding +2. **Beneficiary address**: The initial recipient/owner of the document +3. **Holder address**: The initial holder of the document (can be the same as beneficiary) +4. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable +5. **Remark** (optional, V5 only): Additional remarks to be encrypted and stored with the token + +Example session: -✔ success Token with hash 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c has been issued on 0x6133f580aE903b8e79845340375cCfd78a45FF35 with the initial recipient being 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 and initial holder 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +```bash +trustvc token-registry mint + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the beneficiary address: 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +? Enter the holder address: 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +? Select wallet type: Environment Variable (OA_PRIVATE_KEY) +? Enter remarks (optional, press Enter to skip): + +ℹ info Issuing 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c to the initial recipient 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 and initial holder 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 in the registry 0x6133f580aE903b8e79845340375cCfd78a45FF35 +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Token with hash 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c has been minted on 0x6133f580aE903b8e79845340375cCfd78a45FF35 with the initial recipient being 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 and initial holder 0xB26B4941941C51a4885E5B7D3A1B861E54405f90 +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... ``` + +**Key Features:** + +- **Automatic extraction**: Token registry address, token ID, and network are automatically extracted from the wrapped document +- **Document verification**: The CLI verifies the document signature before minting +- **Encrypted remarks**: Remarks (if provided) are encrypted using the document ID as the encryption key +- **Gas estimation**: Automatic dry run on Ethereum and Polygon networks to estimate gas costs +- **Title Escrow creation**: A new Title Escrow contract is automatically created during the minting process diff --git a/docs/how-tos/issuer/did-web.md b/docs/how-tos/issuer/did-web.md index bebc3d6..fde3513 100644 --- a/docs/how-tos/issuer/did-web.md +++ b/docs/how-tos/issuer/did-web.md @@ -106,42 +106,54 @@ Before you begin, ensure you have Node.js installed on your system. - + - > **Note**: The CLI currently only supports BLS keys. For ECDSA-SD-2023 or BBS-2023 keys, use the code approach above. + > **Note**: The CLI supports both ECDSA-SD-2023 and BBS-2023 key generation. 1. Install the CLI: ```bash - npm install -g @trustvc/w3c-cli + npm install -g @trustvc/trustvc-cli ``` 2. Generate a key pair: ```bash - w3c-cli key-pair + trustvc w3c key-pair-generation ``` - Output: + + You will be prompted to: ``` - ? Please select an encryption algorithm: Bls12381G2Key2020 - ? Please enter a seed in base58 format (optional): - ? Please specify a directory to save your key file (optional): . - File written successfully to ./keypair.json + ? Select an encryption algorithm for your new key pair: + ❯ ECDSA-SD-2023 (Generate KeyPair for ECDSA-SD-2023 suite) + BBS-2023 (Generate KeyPair for BBS-2023 suite) + + ? Enter a seed in base58 format (optional): [only for BBS-2023] + ? Enter a directory to save the generated key file (optional): . + + ✔ success Generated key pair successfully + ℹ info Saved to: ./keypair.json + + ⚠ warning IMPORTANT: Never share this file publicly - it contains secret keys! ``` 3. Generate the DID document: ```bash - w3c-cli did + trustvc w3c did-web ``` - Output: + + You will be prompted to: ``` - ? Please enter the path to your key pair JSON file: ./keypair.json - ? Please enter your domain for hosting the did-web public key (e.g., - https://example.com/.well-known/did.json): https://example.com/.well-known/did.json - ? Please specify a directory path to save the DID token file (optional): . - File written successfully to ./wellknown.json - File written successfully to ./didKeyPairs.json + ? Enter the path to your key pair JSON file: ./keypair.json + ? Enter the domain where your did:web public key will be hosted (e.g., https://example.com/.well-known/did.json): https://example.com/.well-known/did.json + ? Enter a directory to save the generated DID token file (optional): . + + ✔ success Generated DID files successfully + ℹ info ./wellknown.json → Publish at /.well-known/did.json + ℹ info ./didKeyPairs.json → Keep private (contains secret keys) + + ⚠ warning IMPORTANT: Never share didKeyPairs.json publicly! ``` @@ -245,34 +257,46 @@ Before adding new keys: - + - > **Note**: The CLI currently only supports BLS keys. For ECDSA-SD-2023 or BBS-2023 keys, use the code approach above. + > **Note**: The CLI supports both ECDSA-SD-2023 and BBS-2023 key generation. 1. Generate a new key pair: ```bash - w3c-cli key-pair + trustvc w3c key-pair-generation ``` - Output: + + You will be prompted to: ``` - ? Please select an encryption algorithm: Bls12381G2Key2020 - ? Please enter a seed in base58 format (optional): - ? Please specify a directory to save your key file (optional): . - File written successfully to ./keypair.json + ? Select an encryption algorithm for your new key pair: + ❯ ECDSA-SD-2023 (Generate KeyPair for ECDSA-SD-2023 suite) + BBS-2023 (Generate KeyPair for BBS-2023 suite) + + ? Enter a seed in base58 format (optional): [only for BBS-2023] + ? Enter a directory to save the generated key file (optional): . + + ✔ success Generated key pair successfully + ℹ info Saved to: ./keypair.json + + ⚠ warning IMPORTANT: Never share this file publicly - it contains secret keys! ``` 2. Add the new key to your existing `did:web`, providing the same `did:web`: ```bash - w3c-cli did + trustvc w3c did-web ``` - Output: + + You will be prompted to: ``` - ? Please enter the path to your key pair JSON file: ./keypair.json - ? Please enter your domain for hosting the did-web public key (e.g., - https://example.com/.well-known/did.json): https://example.com/.well-known/did.json - ? Please specify a directory path to save the DID token file (optional): . - File written successfully to ./wellknown.json - File written successfully to ./didKeyPairs.json + ? Enter the path to your key pair JSON file: ./keypair.json + ? Enter the domain where your did:web public key will be hosted (e.g., https://example.com/.well-known/did.json): https://example.com/.well-known/did.json + ? Enter a directory to save the generated DID token file (optional): . + + ✔ success Generated DID files successfully + ℹ info ./wellknown.json → Publish at /.well-known/did.json + ℹ info ./didKeyPairs.json → Keep private (contains secret keys) + + ⚠ warning IMPORTANT: Never share didKeyPairs.json publicly! ``` @@ -358,7 +382,7 @@ did:web:: ```bash # Generate DID for a specific path - w3c-cli did + trustvc w3c did-web ``` diff --git a/docs/how-tos/open-attestation/prerequisites.md b/docs/how-tos/open-attestation/prerequisites.md index f37775c..9f3f411 100644 --- a/docs/how-tos/open-attestation/prerequisites.md +++ b/docs/how-tos/open-attestation/prerequisites.md @@ -8,46 +8,46 @@ Please keep in mind that we have more than one method to achieve our goal and th In most of our tutorial we will be using: -- Method 1: TradeTrust CLI +- Method 1: TrustVC CLI - Method 2: Code integration (using our library to achieve the same result) -Before we get started, to make sure you have a good experience with the tutorial, you will need to install our TradeTrust CLI. +Before we get started, to make sure you have a good experience with the tutorial, you will need to install our TrustVC CLI. -### What TradeTrust CLI does +### What TrustVC CLI does -The [TradeTrust CLI](https://github.com/TradeTrust/tradetrust-cli) is a tool that allows users to run many operation on their machine to get a valid TradeTrust documents. It can be used for both Verifiable Documents and Transferable Records. +The [TrustVC CLI](https://github.com/TrustVC/trustvc-cli) is a tool that allows users to run many operations on their machine to get valid TrustVC documents. It can be used for both Verifiable Documents and Transferable Records. The CLI uses an interactive prompt system that guides you through each operation step-by-step. -### Installation of TradeTrust CLI +### Installation of TrustVC CLI > **⚠️ DISCLAIMER** > -> The TradeTrust CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. +> The TrustVC CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. > > It should not be used for production issuance or live document management, as it lacks security, scalability, and operational controls required for real-world environments. #### Binary -To install the binary, simply download the binary from the [CLI release page](https://github.com/TradeTrust/tradetrust-cli/releases/) for your OS. +To install the binary, simply download the binary from the [CLI release page](https://github.com/TrustVC/trustvc-cli/releases/) for your OS. > We are aware that the size of the binaries must be reduced and we have tracked the issue in [Github](https://github.com/Open-Attestation/open-attestation-cli/issues/68). We hope to find a solution in a near future and any help is welcomed. #### NPM -Alternatively for Linux or MacOS users, if you have `npm` installed on your machine, you may install the cli using the following command: +For Linux or MacOS users, if you have `npm` installed on your machine, you may install the CLI using the following command: ```bash -npm install -g @tradetrust-tt/tradetrust-cli +npm install -g @trustvc/trustvc-cli ``` -The above command will install the TradeTrust CLI to your machine. You will need to have node.js installed to be able to run the command. +The above command will install the TrustVC CLI to your machine. You will need to have node.js installed to be able to run the command. You can also opt to use npx: ```bash -npx -p @tradetrust-tt/tradetrust-cli tradetrust +npx @trustvc/trustvc-cli ``` -> In all the guides, we will refer to the CLI as `tradetrust` when running a command. That means we will assume the CLI is available in your execution path. If it's not the case, you will to change `tradetrust` by the full path to the executable. +> In all the guides, we will refer to the CLI as `trustvc` when running a command. That means we will assume the CLI is available in your execution path. If it's not the case, you will need to change `trustvc` to the full path to the executable. --- @@ -56,25 +56,55 @@ npx -p @tradetrust-tt/tradetrust-cli tradetrust To check if the setup is working correctly, run the following command: ```bash -tradetrust --version +trustvc --version ``` -> In the event you need to change the binary name or the path to the binary, makes sure to change the command above accordingly as well as all the commands we will run throughout the guide. +> In the event you need to change the binary name or the path to the binary, make sure to change the command above accordingly as well as all the commands we will run throughout the guide. + +### Interactive Prompt System + +The TrustVC CLI uses an interactive prompt system that guides you through each operation. Instead of providing all parameters as command-line flags, the CLI will ask you for the required information step-by-step. This makes it easier to use and reduces the chance of errors. + +For example, when deploying a token registry, instead of: + +```bash +# Old style (not used in TrustVC CLI) +tradetrust deploy token-registry "My Registry" MYR --network sepolia -f key.txt +``` + +You simply run: + +```bash +trustvc deploy token-registry +``` + +And the CLI will interactively prompt you for: + +- Network selection +- Registry name +- Registry symbol +- Deployment type +- Wallet selection ## Wallet Creation -Now that the TradeTrust CLI has been installed successfully, the first thing you will need is an [ethereum wallet](https://ethereum.org/en/wallets/). +Now that the TrustVC CLI has been installed successfully, the first thing you will need is an [ethereum wallet](https://ethereum.org/en/wallets/). -They can be created either by using our TradeTrust CLI or with [ethers.js](https://docs.ethers.org/v5/api/signer/#Wallet) or via [metamask](https://support.metamask.io/hc/en-us/articles/360059952212-MetaMask-is-a-self-custodial-wallet) browser extension. +They can be created either by using our TrustVC CLI or with [ethers.js](https://docs.ethers.org/v5/api/signer/#Wallet) or via [metamask](https://support.metamask.io/hc/en-us/articles/360059952212-MetaMask-is-a-self-custodial-wallet) browser extension. -### Method 1: Using TradeTrust CLI +### Method 1: Using TrustVC CLI The first step that we will need to go through, is the [wallet](/docs/glossary#wallet) creation: ```bash -tradetrust wallet create --output-file wallet.json +trustvc wallet create ``` +The CLI will interactively prompt you for: + +- Output file path (e.g., `wallet.json`) +- Password to encrypt the wallet + During the creation, you will be prompted for a password. Make sure to remember it for the following steps. You will see a message after completion of the command: ```text @@ -224,4 +254,4 @@ const signerFromMnemonic = Wallet.fromMnemonic("MNEMONIC-HERE"); signerFromMnemonic.connect(provider); ``` -Now that you have a basic understand, let us begin our journey to create a TradeTrust document! +Now that you have a basic understanding, let us begin our journey to create a TrustVC document! diff --git a/docs/how-tos/open-attestation/transferable-records/issuing-document/issuing-document-cli.mdx b/docs/how-tos/open-attestation/transferable-records/issuing-document/issuing-document-cli.mdx index f5452cc..db3eace 100644 --- a/docs/how-tos/open-attestation/transferable-records/issuing-document/issuing-document-cli.mdx +++ b/docs/how-tos/open-attestation/transferable-records/issuing-document/issuing-document-cli.mdx @@ -18,30 +18,42 @@ In this final step, we will mint the transferable record and initialize the firs You will require the following: -- [token registry address](/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli) -- [wallet private key file](/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli#creating-the-key-file) (key.txt) -- [merkle root](/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli) of the wrapped transferable record +- [Wrapped transferable record](/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli) (JSON file from the wrapping step) +- Wallet with private key (via encrypted wallet file, key file, or environment variable) ## Minting a Transferable Record -In the example, we will use `0x6FFeD6E6591b808130a9b248fEA32101b5220eca` wallet address as the initial owner and holder. You will need to replace this value with a wallet address you control to be able to perform different actions on the transferable records later. +The TrustVC CLI uses an interactive prompt system that automatically extracts the token registry address, token ID (merkle root), and network from your wrapped document. To mint the transferable record, simply run the following command: ```sh -tradetrust token-registry mint --address 0x8431012Bc040942B59e3C5bf428221eab0b2f723 --tokenId 0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --remark "This is a test remark" --encryptionKey "testEncryptionKey" --network sepolia -f key.txt +trustvc token-registry mint ``` -Note to replace the following values: +The CLI will interactively prompt you for: -- --address: `0x8431012Bc040942B59e3C5bf428221eab0b2f723` with your token registry contract address -- --tokenId: `0x0d9839a8034cb783d98bd57bcbaafb4dc3614c4193d2edf8a655c1ec6635b7ea` with your merkle root (with a `0x` prefix) -- --beneficiary: `0x6FFeD6E6591b808130a9b248fEA32101b5220eca` with your owner wallet addresses -- --holder: `0x6FFeD6E6591b808130a9b248fEA32101b5220eca` with your holder wallet addresses -- --remark: `This is a test remark` with your mint remark -- --encryptionKey: `testEncryptionKey` with your encryption key +1. **Document path**: Path to your wrapped document file (e.g., `./wrapped-documents/document-1.json`) + - The CLI automatically extracts the token registry address, token ID, and network from the document + - Verifies the document signature before proceeding +2. **Beneficiary address**: The initial owner/recipient of the document (e.g., `0x6FFeD6E6591b808130a9b248fEA32101b5220eca`) +3. **Holder address**: The initial holder of the document (can be the same as beneficiary) +4. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable +5. **Remark** (optional, V5 only): Additional remarks to be encrypted and stored with the token -> Note: remark and encryptionKey are optional. +Example session: + +```sh +trustvc token-registry mint + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the beneficiary address: 0x6FFeD6E6591b808130a9b248fEA32101b5220eca +? Enter the holder address: 0x6FFeD6E6591b808130a9b248fEA32101b5220eca +? Select wallet type: Private Key File +? Enter the path to the private key file: ./key.txt +? Enter remarks (optional, press Enter to skip): This is a test remark +``` Once the document has been minted, you will be able to see an output similar to the following: diff --git a/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli.mdx b/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli.mdx index 55425e5..b601789 100644 --- a/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli.mdx +++ b/docs/how-tos/open-attestation/transferable-records/token-registry/token-registry-cli.mdx @@ -20,12 +20,24 @@ In this guide, we will deploy a token registry smart contract on the Ethereum bl ## Prerequisite -- [TradeTrust CLI](/docs/how-tos/open-attestation/prerequisites#installation-of-tradetrust-cli) installed +- [TrustVC CLI](/docs/how-tos/open-attestation/prerequisites#installation-of-trustvc-cli) installed - Private key to an [Ethereum wallet](/docs/how-tos/open-attestation/prerequisites#wallet-creation) with sufficient ethers -## Deploying via TradeTrust CLI +## Deploying via TrustVC CLI -### Creating the key file +The TrustVC CLI uses an interactive prompt system that guides you through the deployment process. You can provide your wallet credentials via an encrypted wallet file, a private key file, or an environment variable. + +### Option 1: Using Environment Variable (Recommended) + +Set your private key as an environment variable: + +```sh +export OA_PRIVATE_KEY=d8f30c982fc23245a2cc4ec8271edcb4637f539d490ce750cdb5085241ffb41c +``` + +> Do not share your private key with anyone else! + +### Option 2: Using a Key File Create a file `key.txt` with the private key of your Ethereum wallet and save it in your working directory. If you are using Metamask, you may retrieve this key from the extension in [this guide](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key). @@ -39,13 +51,36 @@ d8f30c982fc23245a2cc4ec8271edcb4637f539d490ce750cdb5085241ffb41c ### Deploying the token registry -Simply run the following command. You may replace the `` and `` with a suitable name and symbol (usually 3 characters). +Simply run the following command: + +```sh +trustvc deploy token-registry +``` + +The CLI will interactively prompt you for: + +1. **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +2. **Registry name**: Enter the name of the token registry (e.g., "My Token Registry") +3. **Registry symbol**: Enter the symbol of the token registry (usually 3 characters, e.g., "MTR") +4. **Deployment type**: Choose between standalone or factory deployment (default: factory) +5. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable + +Example session: ```sh -tradetrust deploy token-registry "" -n sepolia -f key.txt +trustvc deploy token-registry + +? Select a network: sepolia +? Enter the name of the token registry: My Token Registry +? Enter the symbol of the token registry: MTR +? Is this a standalone deployment? No +? Enter the token registry implementation address (optional, press Enter to use default): +? Enter the deployer contract address (optional, press Enter to use default): +? Select wallet type: Private Key File +? Enter the path to the private key file: ./key.txt ``` -This will deploy the token registry on the `sepolia` network. You should see a similar output when the deployment is successful: +You should see a similar output when the deployment is successful: ```txt ℹ info Deploying token registry My Token Registry diff --git a/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli.mdx b/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli.mdx index 9bbc1e3..d9a5fee 100644 --- a/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli.mdx +++ b/docs/how-tos/open-attestation/transferable-records/wrapping-document/wrapping-document-cli.mdx @@ -45,7 +45,7 @@ wrapped-documents In the `wrapped-document` directory, you will find the wrapped document which can be sent to the recipient later once the `merkleRoot` has been issued to the token registry. -> Visit our github page to learn more about [TradeTrust CLI wrapping](https://github.com/TradeTrust/tradetrust-cli/#wrapping-documents)! +> Visit our github page to learn more about [TrustVC CLI wrapping](https://github.com/trustvc/trustvc-cli/#wrapping-documents)! Now let us take a look at a wrapped document. diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-did/create.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-did/create.mdx index 226bf5f..67bd714 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-did/create.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-did/create.mdx @@ -14,20 +14,29 @@ The creation of an `ethr` DID is identical to the creation of a wallet, as it re - Using the [wallet created in the prerequisite step](/docs/how-tos/open-attestation/prerequisites#wallet-creation), we run this command on the CLI to retrieve the private key: ```bash - tradetrust wallet decrypt wallet.json + trustvc wallet decrypt ``` + The CLI will interactively prompt you for: + - **Wallet file path**: Path to your encrypted wallet JSON file (default: `./wallet.json`) + - **Wallet password**: Password to decrypt the wallet + - **Risk confirmation**: Confirmation that you understand the risks of revealing the private key + + Example session: + ```text - ⚠ warning You are about to reveal the private key of your wallet. Please type the following word into the terminal to prove that you understand the risks: environmental-maroon-scorpion - ? ack: environmental-maroon-scorpion - ℹ info User consented to risks - ? Wallet password [hidden] - … awaiting Decrypting Wallet [====================] [100/100%] - ℹ info Wallet successfully decrypted - ✔ success Wallet information: - - address: 0xaCc51f664D647C9928196c4e33D46fd98FDaA91D - - public key: 0x041582ae06ae170b4c5610599c8a5fee37414da84f7e2a3b3c48789199c3202f2c7673f3e32dfead4543247ccb792aa4f54dbd3e701172723434e88f770dd64823 - - private key 0x7b227ac59116f3eeb2b265422cf3cbfbd244c525961fb297eb52153ec62aa845 + ? Enter the path to your encrypted wallet JSON file: ./wallet.json + ? Enter your wallet password: [hidden] + ⚠ warning ⚠️ You are about to reveal the private key of your wallet. + ? Do you understand the risks and want to proceed? Yes + ℹ info Decrypting wallet... + + ℹ info Wallet Address: 0xaCc51f664D647C9928196c4e33D46fd98FDaA91D + ℹ info Private Key: 0x7b227ac59116f3eeb2b265422cf3cbfbd244c525961fb297eb52153ec62aa845 + ℹ info Mnemonic Phrase: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about + + ⚠ warning IMPORTANT: Never share your private key or mnemonic phrase with anyone! + ⚠ warning IMPORTANT: Store this information securely and delete it from your terminal history! ``` There are two information to keep very importantly for the next steps: diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-did/dns.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-did/dns.mdx index d672a53..4eebc4e 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-did/dns.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-did/dns.mdx @@ -23,6 +23,10 @@ If you prefer to use your own domain name for the identity, you may skip the ste ## Creating Temporary DNS Proof with CLI +:::note Legacy Method +This method uses the legacy OpenAttestation approach. It is recommended to use the legacy CLI tool (tradetrust-cli) to run this command. For new implementations, we recommend adopting the newer document issuance method. Please refer to this guide: Issuing W3C VCs (link to issuing W3C VC). +::: + With your DID string, `"did:ethr:"`, that we get in the previous step, we now run the following command: ```bash diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-did/revoking-document.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-did/revoking-document.mdx index 6e0789d..f07508c 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-did/revoking-document.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-did/revoking-document.mdx @@ -58,21 +58,28 @@ It's possible to revoke a signed document only if you fulfill certain **prerequi -```bash -tradetrust document-store revoke --address --hash --network --encrypted-wallet-path -``` +The TrustVC CLI uses an interactive prompt system: -In the example above: - -- `--address` is the document store address, for instance the one created with the [Deploying Document Store](/docs/how-tos/open-attestation/verifiable-documents/dns-did/advanced/document-store/deploying-document-store/document-store-cli) guide. -- `--hash` is the value of `targetHash` field of one of the [previously wrapped documents](/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli) (open one of the file, head to the bottom and check for the `targetHash` in the `signature` object.) +```bash +trustvc document-store revoke -You will be prompted for the password that you used while creating the wallet. You will see a message after completion of the command: +? Enter the document store address: +? Enter the hash of the document to revoke: +? Select the network: sepolia +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] -```bash +ℹ info Connecting to document store at +⠋ awaiting Waiting for transaction 0x... to be mined ✔ success Document/Document Batch with hash 0x1e0c5e93c04032ed6571b31c785b963f0a27776041f35bdcc98cd8dfe073adc0 has been revoked on 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b ``` +In the example above: + +- The **document store address** is the address created with the [Deploying Document Store](/docs/how-tos/open-attestation/verifiable-documents/dns-did/advanced/document-store/deploying-document-store/document-store-cli) guide. +- The **hash** is the value of `targetHash` field of one of the [previously wrapped documents](/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli) (open one of the file, head to the bottom and check for the `targetHash` in the `signature` object.) + diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli.mdx index 4aacaff..67b2fd9 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-did/wrapping-document/wrapping-document-cli.mdx @@ -47,7 +47,7 @@ wrapped-documents In the `wrapped-document` directory, you will find the wrapped document which can be sent to the recipient later once the `merkleRoot` has been issued to the document store. -> Visit our github page to learn more about [TradeTrust CLI wrapping](https://github.com/TradeTrust/tradetrust-cli/#wrapping-documents)! +> Visit our github page to learn more about [TrustVC CLI wrapping](https://github.com/trustvc/trustvc-cli/#wrapping-documents)! Now let us take a look at a wrapped document. diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli.mdx index b7289fc..ffdee3e 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli.mdx @@ -12,29 +12,45 @@ import Flow from "../flow.mdx"; > For the current step, you can either opt to use the [CLI](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli) or [Code](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code). -The document store is a smart contract on the blockchain network that records the issuance and revocation status of TradeTrust documents. In this guide, we will deploy a document store smart contract on the Ethereum blockchain, `sepolia` network, which is a test network that does not require actual [ethers](/docs/glossary#ether) for transactions. - -In this guide, we will deploy a document store smart contract on the Ethereum blockchain, `sepolia` network which is a test network that does not require actual ethers for transactions +The document store is a smart contract on the blockchain network that records the issuance and revocation status of TrustVC documents. In this guide, we will deploy a document store smart contract on the Ethereum blockchain, `sepolia` network, which is a test network that does not require actual [ethers](/docs/glossary#ether) for transactions. ## Prerequisite -- [TradeTrust CLI](/docs/how-tos/open-attestation/prerequisites#installation-of-tradetrust-cli) installed +- [TrustVC CLI](/docs/how-tos/open-attestation/prerequisites#installation-of-trustvc-cli) installed - Private key to an [Ethereum wallet](/docs/how-tos/open-attestation/prerequisites#wallet-creation) with sufficient ethers -## Deploying via TradeTrust CLI +## Deploying via TrustVC CLI + +The TrustVC CLI uses an interactive prompt system that guides you through the deployment process. ```bash -tradetrust deploy document-store "My first document store" --network sepolia --encrypted-wallet-path wallet.json +trustvc deploy document-store +``` + +The CLI will interactively prompt you for: + +1. **Store name**: Enter the name of the document store (e.g., "My first document store") +2. **Network selection**: Choose from available networks (e.g., sepolia, polygon-amoy) +3. **Owner address** (optional): Enter the owner address or press Enter to use the deployer address +4. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable + +Example session: + +```bash +trustvc deploy document-store + +? Enter the name of the document store: My first document store +? Select a network: sepolia +? Enter the owner address (optional, press Enter to use deployer address): +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] ``` -You will be prompted for the password that you used while creating the wallet. Once your document store smart contract has been successfully deployed, you will see the success message with the document store address. +Once your document store smart contract has been successfully deployed, you will see the success message with the document store address: ```text ℹ info Deploying document store My first document store -? Wallet password [hidden] -… awaiting Decrypting Wallet [====================] [100/100%] -ℹ info Wallet successfully decrypted -... ✔ success Document store My first document store deployed at 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b ℹ info Find more details at https://sepolia.etherscan.io/address/0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b ``` diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code.mdx index bcc35f3..b9d7118 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code.mdx @@ -15,7 +15,7 @@ import Flow from "../flow.mdx"; ## Installation ```sh -npm install --save @tradetrust-tt/document-store +npm install --save @trustvc/trustvc @trustvc/document-store ``` --- @@ -28,36 +28,82 @@ Refer to the [pre-requisite](/docs/how-tos/open-attestation/prerequisites#unders ### Deploy new document store +The TrustVC library supports both ethers v5 and v6, and provides two types of document stores: + +1. **Standard Document Store** (default): For immutable documents that cannot be transferred +2. **Transferable Document Store**: For documents that can change ownership + ```ts -import { DocumentStoreFactory } from "@tradetrust-tt/document-store"; -import { TransactionReceipt } from "@ethersproject/abstract-provider"; +import { deployDocumentStore, CHAIN_ID } from "@trustvc/trustvc"; import { Wallet, ethers } from "ethers"; -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); -const walletAddress = await wallet.getAddress(); +// Setup wallet and provider +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); +const walletAddress = await signer.getAddress(); + +// Deploy standard document store +const receipt = await deployDocumentStore( + "My Document Store", + walletAddress, + signer, + { + chainId: CHAIN_ID.SEPOLIA, + maxFeePerGas: "50000000000", // Optional: EIP-1559 gas settings + maxPriorityFeePerGas: "2000000000" + } +); + +console.log(`Document Store deployed at: ${receipt.contractAddress}`); +// Document Store deployed at: 0x63A223E025256790E88778a01f480eBA77731D04 +``` + +### Deploy transferable document store + +For documents that need to support ownership transfers: -const factory = new DocumentStoreFactory(wallet); -const transaction = await factory.deploy("Demo Document Store", walletAddress); -const transactionReceipt = await transaction.deployTransaction.wait(); -const documentStoreAddress = transactionReceipt.contractAddress; -console.log(documentStoreAddress); // 0x63A223E025256790E88778a01f480eBA77731D04 +```ts +import { deployDocumentStore, CHAIN_ID } from "@trustvc/trustvc"; +import { Wallet, ethers } from "ethers"; + +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); +const walletAddress = await signer.getAddress(); + +// Deploy transferable document store +const receipt = await deployDocumentStore( + "My Transferable Document Store", + walletAddress, + signer, + { + chainId: CHAIN_ID.SEPOLIA, + isTransferable: true // Enable transferability + } +); + +console.log(`Transferable Document Store deployed at: ${receipt.contractAddress}`); ``` ### Connect to existing document store ```ts -import { DocumentStoreFactory } from "@tradetrust-tt/document-store"; -import { TransactionReceipt } from "@ethersproject/abstract-provider"; +import { DocumentStore__factory } from "@trustvc/document-store"; import { Wallet, ethers } from "ethers"; -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); + +// Connect to existing document store +const documentStore = DocumentStore__factory.connect( + "0x63A223E025256790E88778a01f480eBA77731D04", + signer +); -const documentStore = DocumentStoreFactory.connect("0x63A223E025256790E88778a01f480eBA77731D04", wallet); -console.log(`Document Store Name: ${await documentStore.name()}`); // Document Store Name: DemoDocumentStore +console.log(`Document Store Name: ${await documentStore.name()}`); +// Document Store Name: My Document Store ``` Congratulations! You have successfully deployed a document store. diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-cli.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-cli.mdx index 5cc7f34..f18861b 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-cli.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-cli.mdx @@ -16,21 +16,42 @@ After wrapping the documents and obtaining a merkle root, the documents are read ## Issuing the documents +The TrustVC CLI uses an interactive prompt system that automatically extracts the document store address, merkle root hash, and network from your wrapped document. + ```bash -tradetrust document-store issue --address 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b --hash 0x80cc53b77c0539fc383f8d434ac5ffad281f3d64ae5a0e59e9f36f19548e1fff --network sepolia --encrypted-wallet-path wallet.json +trustvc document-store issue ``` -In the example above: +The CLI will interactively prompt you for: -- `--address` is the document store address, for instance the one created with the [Deploying Document Store](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli) guide. -- `--hash` is the merkle root hash, for instance generated while [Wrapping Documents](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli) +1. **Document path**: Path to the wrapped document file (JSON) + - The CLI automatically extracts the document store address, merkle root (hash), and network from the document + - Verifies the document signature before proceeding +2. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable -You will be prompted for the password that you used while creating the wallet. You will see a message after completion of the command: +Example session: -```text -✔ success Document/Document Batch with hash 0x80cc53b77c0539fc383f8d434ac5ffad281f3d64ae5a0e59e9f36f19548e1fff has been issued on 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +```bash +trustvc document-store issue + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] + +ℹ info Issuing 0x80cc53b77c0539fc383f8d434ac5ffad281f3d64ae5a0e59e9f36f19548e1fff to the document store 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Token with hash 0x80cc53b77c0539fc383f8d434ac5ffad281f3d64ae5a0e59e9f36f19548e1fff has been issued on 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... ``` +**Key Features:** + +- **Automatic extraction**: Document store address, merkle root hash, and network are automatically extracted from the wrapped document +- **Document verification**: The CLI verifies the document signature before issuing +- **Gas estimation**: Automatic dry run on Ethereum and Polygon networks to estimate gas costs + ## Verifying the documents Head over to [dev.tradetrust.io](https://dev.tradetrust.io/verify), drag and drop in one of the issued documents. The document will be verified, then displayed. diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-code.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-code.mdx index c5e4f7b..c6bdbef 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-code.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/issuing-document/issuing-document-code.mdx @@ -15,7 +15,7 @@ import Flow from "../flow.mdx"; ## Installation ```sh -npm install --save @tradetrust-tt/document-store +npm install --save @trustvc/trustvc ``` --- @@ -26,33 +26,56 @@ To use the package, you will need to provide your own Web3 [provider](https://do Refer to the [pre-requisite](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code) on document store deployment. -### Connect to existing document store +### Issuing on document store + +The TrustVC library provides a `documentStoreIssue` function that supports both ethers v5 and v6, and automatically detects the document store type (standard, transferable, or legacy TT document store). ```ts -import { DocumentStoreFactory } from "@tradetrust-tt/document-store"; +import { documentStoreIssue } from "@trustvc/trustvc"; import { Wallet, ethers } from "ethers"; -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); -const documentStore = DocumentStoreFactory.connect("0x63A223E025256790E88778a01f480eBA77731D04", wallet); -console.log(`Document Store Name: ${await documentStore.name()}`); // Document Store Name: DemoDocumentStore +// Setup wallet and provider +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); + +// Issue a document hash to the document store +const tx = await documentStoreIssue( + "0x63A223E025256790E88778a01f480eBA77731D04", // Document store address + "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39", // Document hash (merkle root) + signer, + { + maxFeePerGas: "50000000000", // Optional: EIP-1559 gas settings + maxPriorityFeePerGas: "2000000000", + }, +); + +const receipt = await tx.wait(); +console.log(`Document issued in transaction: ${receipt.hash}`); ``` -### Issuing on document store +### Verify document issuance + +After issuing, you can verify that the document has been issued: ```ts -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); +import { DocumentStore__factory } from "@trustvc/trustvc"; +import { Wallet, ethers } from "ethers"; -const documentStore = DocumentStoreFactory.connect("0x63A223E025256790E88778a01f480eBA77731D04", wallet); +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); -const tx = await documentStore.issue("0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39"); -const receipt = await tx.wait(); -console.log(`Issue Transaction: ${JSON.stringify(receipt)}`); +// Connect to the document store +const documentStore = DocumentStore__factory.connect( + "0x63A223E025256790E88778a01f480eBA77731D04", + signer +); -const isIssued = await documentStore.isIssued("0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39"); +// Check if document is issued +const isIssued = await documentStore.isIssued( + "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39" +); console.log(`Has been Issued: ${isIssued}`); // Has been Issued: true // Issue Transaction: diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-cli.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-cli.mdx index dbe3888..efdf6b3 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-cli.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-cli.mdx @@ -21,21 +21,44 @@ After issuing a document, you might want to revoke it for any reason: ## Revoking a document +The TrustVC CLI uses an interactive prompt system that automatically extracts the document store address, target hash, and network from your wrapped document. + ```bash -tradetrust document-store revoke --address 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b --hash 0x1e0c5e93c04032ed6571b31c785b963f0a27776041f35bdcc98cd8dfe073adc0 --network sepolia --encrypted-wallet-path wallet.json +trustvc document-store revoke ``` -In the example above: +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file (JSON) + - The CLI automatically extracts the document store address, target hash, and network from the document + - Verifies the document signature before proceeding +2. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable -- `--address` is the document store address, for instance the one created with the [Deploying Document Store](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-cli) guide. -- `--hash` is the value of `targetHash` field of one of the [previously wrapped documents](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli) (open one of the file, head to the bottom and check for the `targetHash` in the `signature` object. +> **Note**: The hash used for revocation is the `targetHash` field from the wrapped document (found in the `signature` object at the bottom of the file). You can revoke using either the `targetHash` (revokes single document) or `merkleRoot` (revokes entire batch). -You will be prompted for the password that you used while creating the wallet. You will see a message after completion of the command: +Example session: -```text -✔ success Document/Document Batch with hash 0x1e0c5e93c04032ed6571b31c785b963f0a27776041f35bdcc98cd8dfe073adc0 has been revoked on 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +```bash +trustvc document-store revoke + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] + +ℹ info Revoking 0x1e0c5e93c04032ed6571b31c785b963f0a27776041f35bdcc98cd8dfe073adc0 from the document store 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Token with hash 0x1e0c5e93c04032ed6571b31c785b963f0a27776041f35bdcc98cd8dfe073adc0 has been revoked from 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b +ℹ info Find more details at https://sepolia.etherscan.io/tx/0x... ``` +**Key Features:** + +- **Automatic extraction**: Document store address, target hash, and network are automatically extracted from the wrapped document +- **Document verification**: The CLI verifies the document signature before revoking +- **Gas estimation**: Automatic dry run on Ethereum and Polygon networks to estimate gas costs + ## Verifying the document Head to [dev.tradetrust.io](https://dev.tradetrust.io/verify) and drag and drop the revoked document. An error will be displayed by the portal. diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-code.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-code.mdx index fc94a23..35a0fc1 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-code.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/revoking-document/revoking-document-code.mdx @@ -15,7 +15,7 @@ import Flow from "../flow.mdx"; ## Installation ```sh -npm i @tradetrust-tt/document-store +npm install --save @trustvc/trustvc ``` --- @@ -26,90 +26,60 @@ To use the package, you will need to provide your own Web3 [provider](https://do Refer to the [pre-requisite](/docs/how-tos/open-attestation/verifiable-documents/dns-txt/deploying-document-store/document-store-code) on document store deployment. -### Connect to existing document store +### Revoking on document store + +The TrustVC library provides a `documentStoreRevoke` function that supports both ethers v5 and v6, and automatically detects the document store type (standard, transferable, or legacy TT document store). ```ts -import { DocumentStoreFactory } from "@tradetrust-tt/document-store"; +import { documentStoreRevoke } from "@trustvc/trustvc"; import { Wallet, ethers } from "ethers"; -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); +// Setup wallet and provider +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); + +// Revoke a document hash from the document store +const tx = await documentStoreRevoke( + "0x63A223E025256790E88778a01f480eBA77731D04", // Document store address + "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39", // Document hash (targetHash) + signer, + { + maxFeePerGas: "50000000000", // Optional: EIP-1559 gas settings + maxPriorityFeePerGas: "2000000000", + }, +); -const documentStore = DocumentStoreFactory.connect("0x63A223E025256790E88778a01f480eBA77731D04", wallet); -console.log(`Document Store Name: ${await documentStore.name()}`); // Document Store Name: DemoDocumentStore +const receipt = await tx.wait(); +console.log(`Document revoked in transaction: ${receipt.hash}`); ``` -### Revocation on document store +### Verify document revocation -```ts -const unconnectedWallet = new Wallet("privateKey"); -const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545"); // Local network -const wallet = unconnectedWallet.connect(provider); +After revoking, you can verify that the document has been revoked: -const documentStore = DocumentStoreFactory.connect("0x63A223E025256790E88778a01f480eBA77731D04", wallet); +```ts +import { DocumentStore__factory } from "@trustvc/trustvc"; +import { Wallet, ethers } from "ethers"; -const tx = await documentStore.revoke("0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39"); -const receipt = await tx.wait(); -console.log(`Revoke Transaction: ${JSON.stringify(receipt)}`); - -const isIssued = await documentStore.isRevoked("0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39"); -console.log(`Has been Revoked: ${isIssued}`); // Has been Revoked: true - -// Revoke Transaction: -{ - "to": "0x63A223E025256790E88778a01f480eBA77731D04", - "from": "0xe0A71284EF59483795053266CB796B65E48B5124", - "contractAddress": null, - "transactionIndex": 0, - "gasUsed": { "type": "BigNumber", "hex": "0xbb6c" }, - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000040000000000000000000000100000000400000000000000000000000000000000000000800000000000000000000000000000", - "blockHash": "0x7ba420b317c537731de1c70b9b1075213b40b6b69dcde48c592e1b3ab7926e95", - "transactionHash": "0xe15b2f8fda95ff29338722458be80fe14817019f565c82cd24115fda3bc36ae2", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 4742644, - "transactionHash": "0xe15b2f8fda95ff29338722458be80fe14817019f565c82cd24115fda3bc36ae2", - "address": "0x63A223E025256790E88778a01f480eBA77731D04", - "topics": [ - "0x7283b5ab9758f7fba773279e4fd50ea7b136bd1d8371dcae9c5ce529c55343d7", - "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x7ba420b317c537731de1c70b9b1075213b40b6b69dcde48c592e1b3ab7926e95" - } - ], - "blockNumber": 4742644, - "confirmations": 1, - "cumulativeGasUsed": { "type": "BigNumber", "hex": "0xbb6c" }, - "effectiveGasPrice": { "type": "BigNumber", "hex": "0x0184d5b7b1" }, - "status": 1, - "type": 2, - "byzantium": true, - "events": [ - { - "transactionIndex": 0, - "blockNumber": 4742644, - "transactionHash": "0xe15b2f8fda95ff29338722458be80fe14817019f565c82cd24115fda3bc36ae2", - "address": "0x63A223E025256790E88778a01f480eBA77731D04", - "topics": [ - "0x7283b5ab9758f7fba773279e4fd50ea7b136bd1d8371dcae9c5ce529c55343d7", - "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39" - ], - "data": "0x", - "logIndex": 0, - "blockHash": "0x7ba420b317c537731de1c70b9b1075213b40b6b69dcde48c592e1b3ab7926e95", - "args": ["0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39"], - "event": "DocumentRevoked", - "eventSignature": "DocumentRevoked(bytes32)" - } - ] -} +const wallet = new Wallet("privateKey"); +const provider = new ethers.JsonRpcProvider("https://sepolia.infura.io/v3/YOUR_INFURA_KEY"); +const signer = wallet.connect(provider); + +// Connect to the document store +const documentStore = DocumentStore__factory.connect( + "0x63A223E025256790E88778a01f480eBA77731D04", + signer +); + +// Check if document is revoked +const isRevoked = await documentStore.isRevoked( + "0x8dcf358a9436bca6654f565e3c5843d91c0052d3a2eff37bbd380038e8a1fa39" +); +console.log(`Has been Revoked: ${isRevoked}`); // Has been Revoked: true ``` -Please refer to [Document-Store](https://github.com/Open-Attestation/Document-Store) repository on other interfaces available on the smart contracts; +Please refer to [TrustVC Document-Store](https://github.com/TrustVC/document-store) repository for more information on available interfaces and methods. ## Verifying the document diff --git a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli.mdx b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli.mdx index ee21009..3b76d18 100644 --- a/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli.mdx +++ b/docs/how-tos/open-attestation/verifiable-documents/dns-txt/wrapping-document/wrapping-document-cli.mdx @@ -47,7 +47,7 @@ wrapped-documents In the `wrapped-document` directory, you will find the wrapped document which can be sent to the recipient later once the `merkleRoot` has been issued to the document store. -> Visit our github page to learn more about [TradeTrust CLI wrapping](https://github.com/TradeTrust/tradetrust-cli/#wrapping-documents)! +> Visit our github page to learn more about [TrustVC CLI wrapping](https://github.com/trustvc/trustvc-cli/#wrapping-documents)! Now let us take a look at a wrapped document. diff --git a/docs/how-tos/transactions.md b/docs/how-tos/transactions.md index 4cd668a..690085c 100644 --- a/docs/how-tos/transactions.md +++ b/docs/how-tos/transactions.md @@ -156,42 +156,52 @@ await connectedTitleEscrow.returnToIssuer(remark); > **⚠️ DISCLAIMER** > -> The TradeTrust CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. +> The TrustVC CLI helps developers prototype and test how document issuance and verification work before integrating the TrustVC core into their own systems. > > It should not be used for production issuance or live document management, as it lacks security, scalability, and operational controls required for real-world environments. #### Binary -To install the binary, simply download the binary from the [CLI release page](https://github.com/TradeTrust/tradetrust-cli/releases) for your OS. +To install the binary, simply download the binary from the [CLI release page](https://github.com/trustvc/trustvc-cli/releases) for your OS. We are aware that the size of the binaries must be reduced and we have tracked the issue in Github. We hope to find a solution in a near future and any help is welcomed. #### NPM -Alternatively for Linux or MacOS users, if you have npm installed on your machine, you may install the cli using the following command: +For Linux or MacOS users, if you have npm installed on your machine, you may install the CLI using the following command: ```bash -npm install -g @tradetrust-tt/tradetrust-cli +npm install -g @trustvc/trustvc-cli ``` -The above command will install the TradeTrust CLI to your machine. You will need to have node.js installed to be able to run the command. +The above command will install the TrustVC CLI to your machine. You will need to have node.js installed to be able to run the command. You can also opt to use npx: ```bash -npx -p @tradetrust-tt/tradetrust-cli tradetrust +npx @trustvc/trustvc-cli ``` -Now we will see performing the same transactions via the command line +Now we will see performing the same transactions via the command line. + +> **Note**: All TrustVC CLI commands use an interactive prompt system. The CLI will automatically extract information from your wrapped document and guide you through the required inputs. ### Mint document to token registry -Mint a hash to a token registry deployed on the blockchain. The tokenId option would be used to indicate the document hash, and the to option to indicate the title escrow address the document is mapped to. +Mint a hash to a token registry deployed on the blockchain. The CLI automatically extracts the token registry address, token ID, and network from the wrapped document. ```bash -tradetrust token-registry mint --network --address --tokenId --beneficiary --holder [options] +trustvc token-registry mint ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file (JSON) +2. **Beneficiary address**: The initial recipient/owner of the document +3. **Holder address**: The initial holder of the document +4. **Wallet selection**: Choose between encrypted wallet, private key file, or environment variable +5. **Remark** (optional, V5 only): Additional remarks to be encrypted and stored + ### Transfer/Reject of Holdership #### Transfer Holdership: @@ -199,17 +209,30 @@ tradetrust token-registry mint --network --address --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file (automatically extracts token registry, token ID, and network) +2. **New holder address**: The address of the new holder +3. **Wallet selection**: Choose your wallet type +4. **Remark** (optional, V5 only): Additional remarks + #### Reject Holdership: Declines a request for holdership transfer, preventing an unauthorized or invalid transaction. ```bash -tradetrust title-escrow reject-transfer-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-holder ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **Wallet selection**: Choose your wallet type +3. **Remark** (optional, V5 only): Additional remarks + ### Transfer/Reject of Ownership #### Transfer Ownership: @@ -217,41 +240,75 @@ tradetrust title-escrow reject-transfer-holder --token-registry --tokenId --newOwner --newHolder -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-owner-holder ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **New owner address**: The address of the new beneficiary (owner) +3. **New holder address**: The address of the new holder +4. **Wallet selection**: Choose your wallet type +5. **Remark** (optional, V5 only): Additional remarks + #### Reject Ownership Transfer: Prevents a transfer of ownership to an incorrect or unauthorized party. ```bash -tradetrust title-escrow reject-transfer-owner-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-owner-holder ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **Wallet selection**: Choose your wallet type +3. **Remark** (optional, V5 only): Additional remarks + ### Nominate Owner Allows an entity to propose a new owner for the asset, initiating the process for ownership transfer, pending acceptance by the nominated party. ```bash -tradetrust title-escrow nominate-change-owner --token-registry --tokenId --newOwner -n sepolia --key --remark --encryption-key +trustvc title-escrow nominate-transfer-owner ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **New beneficiary address**: The address of the new beneficiary (owner) to nominate +3. **Wallet selection**: Choose your wallet type +4. **Remark** (optional, V5 only): Additional remarks + ### Endorse Owner Confirms and approves the proposed ownership, affirming the nominated individual or entity as the rightful new owner. ```bash -tradetrust title-escrow endorse-transfer-owner --token-registry --tokenId --newBeneficiary -n sepolia --key --remark --encryption-key +trustvc title-escrow endorse-transfer-owner ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **New beneficiary address**: The address of the new beneficiary to endorse +3. **Wallet selection**: Choose your wallet type +4. **Remark** (optional, V5 only): Additional remarks + ### Return to Issuer Initiates the process of returning the asset to its original issuer (Token Registry), relinquishing all holdership or ownership rights. ```bash -tradetrust title-escrow return-to-issuer --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow return-to-issuer ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **Wallet selection**: Choose your wallet type +3. **Remark** (optional, V5 only): Additional remarks + ### Accept/Reject Return to Issuer #### Accept Return to Issuer: @@ -259,13 +316,25 @@ tradetrust title-escrow return-to-issuer --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow accept-return-to-issuer ``` +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **Wallet selection**: Choose your wallet type +3. **Remark** (optional, V5 only): Additional remarks + #### Reject Return to Issuer: Declines the return of the asset, maintaining the current holdership or ownership status. ```bash -tradetrust title-escrow reject-returned --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-return-to-issuer ``` + +The CLI will interactively prompt you for: + +1. **Document path**: Path to the wrapped document file +2. **Wallet selection**: Choose your wallet type +3. **Remark** (optional, V5 only): Additional remarks diff --git a/docs/introduction/key-components-of-tradetrust/transferability/title-transfer-example.md b/docs/introduction/key-components-of-tradetrust/transferability/title-transfer-example.md index e0bddd7..492a744 100644 --- a/docs/introduction/key-components-of-tradetrust/transferability/title-transfer-example.md +++ b/docs/introduction/key-components-of-tradetrust/transferability/title-transfer-example.md @@ -56,8 +56,23 @@ We will do **endorse change of ownership** first. What this command does is it sets the states (holder and owner) of the token to a given address, in this case we will endorse the change of ownership to Charlie. -``` -tradetrust title-escrow endorse-change-owner --token-registry --tokenId --newOwner --newHolder -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new owner address: +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to new owner and holder ``` If this transaction is mined and successful, the state of the transferable record will be different. @@ -88,8 +103,21 @@ We will do **reject change of ownership** now. What this command does is it sets the states (holder and owner) of the token to it's previous holder and owner address, in this case we will reject the change of ownership back to Alice. -``` -tradetrust title-escrow reject-transfer-owner-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow reject-transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of owner and holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's owner and holder has been successfully rejected to previous owner and holder ``` If this transaction is mined and successful, the state of the transferable record will be different. @@ -123,11 +151,25 @@ What this command does is it just sets the holder state to a new address. In this case we will set the holder state to `Bob`, owner state remains as `Charlie` address +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow change-holder --token-registry --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to change the holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully changed to holder with address: ``` -Do take note that the private key supplied should be that of Charlie instead of Alice since Charlie currently holds and owns the token. +Do take note that the wallet supplied should be that of Charlie instead of Alice since Charlie currently holds and owns the token. If this command is successful, we will yet again advance the state of the token. @@ -155,11 +197,24 @@ Now we will do the **reject change of holder** command. What this command does is it just sets the holder state to it's previous holder address. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow reject-transfer-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully rejected to previous holder ``` -Do take note that the private key supplied should be that of Bob instead of Charlie since Bob currently holds the token and Charlie owns the token. +Do take note that the wallet supplied should be that of Bob instead of Charlie since Bob currently holds the token and Charlie owns the token. If this command is successful, we will yet again advance the state of the token. @@ -190,8 +245,22 @@ In this case we will suggest `Alice` to be the new owner. Does this lead to any change in state (holder, owner)? The answer is no, not yet. -``` -tradetrust title-escrow nominate-change-owner --token-registry --tokenId --newOwner -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow nominate-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to nominate the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully nominated to new owner with address ``` If this action is successful, then an additional action should be present on `Bob`. @@ -220,8 +289,22 @@ That is what we will do, and we will now perform **endorse transfer of ownership What the command does is that it allows `Bob` to allow and complete the nominated change of ownership from `Charlie` to `Alice`. -``` -tradetrust title-escrow endorse-transfer-owner --token-registry --tokenId -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow endorse-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to approved beneficiary at ``` --- @@ -246,9 +329,21 @@ Now we will do the **reject change of owner** command. What this command does is it just sets the owner state to it's previous owner address. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow reject-transfer-owner --token-registry --tokenId -n sepolia --key --remark --encryp -tion-key +trustvc title-escrow reject-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's owner has been successfully rejected to previous owner ``` --- @@ -273,8 +368,22 @@ If the prev command worked as intended, then the new owner state of the token wi we will wrap up this demonstration by changing the holder to `Alice` so we will come full circle. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow change-holder --token-registry --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to change the holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully changed to holder with address: ``` --- diff --git a/docs/introduction/key-components-of-tradetrust/transferability/transactions.md b/docs/introduction/key-components-of-tradetrust/transferability/transactions.md index a6aed11..098df94 100644 --- a/docs/introduction/key-components-of-tradetrust/transferability/transactions.md +++ b/docs/introduction/key-components-of-tradetrust/transferability/transactions.md @@ -56,8 +56,23 @@ We will do **endorse change of ownership** first. What this command does is it sets the states (holder and owner) of the token to a given address, in this case we will endorse the change of ownership to Charlie. -``` -tradetrust title-escrow endorse-change-owner --token-registry --tokenId --newOwner --newHolder -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new owner address: +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to new owner and holder ``` If this transaction is mined and successful, the state of the transferable record will be different. @@ -88,8 +103,21 @@ We will do **reject change of ownership** now. What this command does is it sets the states (holder and owner) of the token to it's previous holder and owner address, in this case we will reject the change of ownership back to Alice. -``` -tradetrust title-escrow reject-transfer-owner-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow reject-transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of owner and holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's owner and holder has been successfully rejected to previous owner and holder ``` If this transaction is mined and successful, the state of the transferable record will be different. @@ -123,11 +151,25 @@ What this command does is it just sets the holder state to a new address. In this case we will set the holder state to `Bob`, owner state remains as `Charlie` address +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow change-holder --token-registry --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to change the holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully changed to holder with address: ``` -Do take note that the private key supplied should be that of Charlie instead of Alice since Charlie currently holds and owns the token. +Do take note that the wallet supplied should be that of Charlie instead of Alice since Charlie currently holds and owns the token. If this command is successful, we will yet again advance the state of the token. @@ -155,11 +197,24 @@ Now we will do the **reject change of holder** command. What this command does is it just sets the holder state to it's previous holder address. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow reject-transfer-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully rejected to previous holder ``` -Do take note that the private key supplied should be that of Bob instead of Charlie since Bob currently holds the token and Charlie owns the token. +Do take note that the wallet supplied should be that of Bob instead of Charlie since Bob currently holds the token and Charlie owns the token. If this command is successful, we will yet again advance the state of the token. @@ -190,8 +245,22 @@ In this case we will suggest `Alice` to be the new owner. Does this lead to any change in state (holder, owner)? The answer is no, not yet. -``` -tradetrust title-escrow nominate-change-owner --token-registry --tokenId --newOwner -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow nominate-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to nominate the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully nominated to new owner with address ``` If this action is successful, then an additional action should be present on `Bob`. @@ -220,8 +289,22 @@ That is what we will do, and we will now perform **endorse transfer of ownership What the command does is that it allows `Bob` to allow and complete the nominated change of ownership from `Charlie` to `Alice`. -``` -tradetrust title-escrow endorse-transfer-owner --token-registry --tokenId -n sepolia --key --remark --encryption-key +The TrustVC CLI uses an interactive prompt system: + +```bash +trustvc title-escrow endorse-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to approved beneficiary at ``` --- @@ -246,9 +329,21 @@ Now we will do the **reject change of owner** command. What this command does is it just sets the owner state to it's previous owner address. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow reject-transfer-owner --token-registry --tokenId -n sepolia --key --remark --encryp -tion-key +trustvc title-escrow reject-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's owner has been successfully rejected to previous owner ``` --- @@ -273,8 +368,22 @@ If the prev command worked as intended, then the new owner state of the token wi we will wrap up this demonstration by changing the holder to `Alice` so we will come full circle. +The TrustVC CLI uses an interactive prompt system: + ```bash -tradetrust title-escrow change-holder --token-registry --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to change the holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully changed to holder with address: ``` --- @@ -296,7 +405,19 @@ This demonstration does not cover any return to issuer actions that could happen Enables the transfer of holdership rights to another party, allowing them to take temporary possession of the asset. ```bash -tradetrust title-escrow change-holder --token-registry --tokenId --to -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to change the holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully changed to holder with address: ``` #### Reject Holdership: @@ -304,7 +425,18 @@ tradetrust title-escrow change-holder --token-registry Declines a request for holdership transfer, preventing an unauthorized or invalid transaction. ```bash -tradetrust title-escrow reject-transfer-holder --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully rejected to previous holder ``` ### Transfer/Reject of Ownership @@ -314,7 +446,20 @@ tradetrust title-escrow reject-transfer-holder --token-registry --tokenId --newOwner --newHolder -n sepolia --key --remark --encryption-key +trustvc title-escrow transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new owner address: +? Enter the new holder address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to new owner and holder ``` #### Reject Ownership Transfer: @@ -322,7 +467,18 @@ tradetrust title-escrow endorse-change-owner --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-transfer-owner-holder + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject the change of owner and holder... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's owner and holder has been successfully rejected to previous owner and holder ``` ### Nominate Owner @@ -330,7 +486,19 @@ tradetrust title-escrow reject-transfer-owner-holder --token-registry --tokenId --newOwner -n sepolia --key --remark --encryption-key +trustvc title-escrow nominate-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to nominate the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully nominated to new owner with address ``` ### Endorse Owner @@ -338,7 +506,19 @@ tradetrust title-escrow nominate-change-owner --token-registry --tokenId --newBeneficiary -n sepolia --key --remark --encryption-key +trustvc title-escrow endorse-transfer-owner + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Enter the new beneficiary address: +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to endorse the change of owner... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's holder has been successfully endorsed to approved beneficiary at ``` ### Return to Issuer @@ -346,7 +526,18 @@ tradetrust title-escrow endorse-transfer-owner --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow return-to-issuer + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to return to issuer... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record has been successfully returned to issuer ``` ### Accept/Reject Return to Issuer @@ -356,7 +547,18 @@ tradetrust title-escrow return-to-issuer --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow accept-return-to-issuer + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to accept return to issuer... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's return to issuer has been successfully accepted ``` #### Reject Return to Issuer: @@ -364,5 +566,16 @@ tradetrust title-escrow accept-returned --token-registry --tokenId -n sepolia --key --remark --encryption-key +trustvc title-escrow reject-return-to-issuer + +? Enter the path to the wrapped document: ./wrapped-documents/document-1.json +ℹ info Document signature verified successfully +? Select wallet type: Encrypted Wallet JSON +? Enter the path to your encrypted wallet JSON file: ./wallet.json +? Enter your wallet password: [hidden] +? Enter a remark (optional): + +ℹ info Connecting to the registry and attempting to reject return to issuer... +⠋ awaiting Waiting for transaction 0x... to be mined +✔ success Transferable record's return to issuer has been successfully rejected ``` diff --git a/docs/introduction/key-components-of-tradetrust/w3c-vc/signing-documents/signing-document-cli.mdx b/docs/introduction/key-components-of-tradetrust/w3c-vc/signing-documents/signing-document-cli.mdx index 6c1f902..a2d9de7 100644 --- a/docs/introduction/key-components-of-tradetrust/w3c-vc/signing-documents/signing-document-cli.mdx +++ b/docs/introduction/key-components-of-tradetrust/w3c-vc/signing-documents/signing-document-cli.mdx @@ -23,7 +23,7 @@ Install CLI: > Note Remember to install the cli globally ```bash -npm install -g @trustvc/w3c-cli +npm install -g @trustvc/trustvc-cli ``` ### Signing @@ -32,48 +32,32 @@ Run the Command Execute the following command in your terminal: ```bash -w3c-cli sign +trustvc w3c w3c-sign ``` -The tool will prompt you to provide the path to your key pair file. +The CLI will guide you through an interactive signing process: ```bash -? Please enter the path to your key pair JSON file: ./didKeyPairs.json +? 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 ``` -Next, you will be asked to provide the path to your Verifiable Credential file. +**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) - ```bash - ? Please enter the path to your credential JSON file: ./vc.json - ``` +The signed credential will be saved as `signed_vc.json` in the specified directory. -Provide the directory path where the signed credential will be saved. - - ```bash - ? 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. - -```bash -Signed credential saved successfully to ./signed_vc.json -``` - -In this example, the signed credential is saved as signed_vc.json in the current directory. - -```bash -$ 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: +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 diff --git a/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-documents-cli.mdx b/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-documents-cli.mdx index aeff11d..6676f24 100644 --- a/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-documents-cli.mdx +++ b/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-documents-cli.mdx @@ -6,56 +6,83 @@ sidebar_label: Verifying Documents (CLI) > For the current step, you can either opt to use the [CLI](/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-document-cli) or [Code](/docs/introduction/key-components-of-tradetrust/w3c-vc/verifying-documents/verifying-document-code). -This document provides a step-by-step guide on how to verify the authenticity and integrity of a signed Verifiable Credential (VC) using the w3c-cli tool. The verification process ensures that the credential has not been tampered with and validates the issuer’s signature. +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: +## Prerequisites -- Install the w3c-cli tool on your system. -- Ensure you have the JSON file of the signed Verifiable Credential (e.g., signed_vc.json). +- Install the TrustVC CLI tool on your system +- Ensure you have the JSON file of the signed document (e.g., `signed_vc.json`) -### Installation +## Installation Install CLI: -> Note Remember to install the cli globally +> Note: Remember to install the CLI globally ```bash -npm install -g @trustvc/w3c-cli +npm install -g @trustvc/trustvc-cli ``` -### Verification Process - -Open a terminal or command prompt on your system. +## Verification Process Run the verify command: ```bash -w3c-cli verify +trustvc verify ``` -Provide the path to your Verifiable Credential JSON file when prompted: +The CLI will guide you through an interactive verification process: ```bash -? Please enter the path to your verifiable credential JSON file: ./signed_vc.json +? 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 ``` -Replace ./signed_vc.json with the path to your credential file if it is located in a different directory. +### Understanding the Verification Results + +The verification process checks three key aspects: + +1. **DOCUMENT_INTEGRITY**: Validates that the cryptographic proofs are correct and the document has not been tampered with +2. **DOCUMENT_STATUS**: Confirms the document's revocation/suspension status (if applicable) +3. **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 -`View the verification result:` After running the command, you will receive an output similar to the following: +### Example: OpenAttestation Document Verification + +For OpenAttestation documents, the output will be similar: ```bash -Verification result: true -Credential status verification result: "revocation:false" -``` +? Please enter the path to your document: ./wrapped_document.json -Verification result: true indicates that the cryptographic proofs in the credential are valid and the credential has not been altered. +ℹ info Verifying OpenAttestation document... +✔ success DOCUMENT_INTEGRITY: VALID +✔ success DOCUMENT_STATUS: VALID +✔ success ISSUER_IDENTITY: VALID +``` -Credential status verification result: "revocation:false" confirms that the credential has not been revoked. +### Handling Expired or Revoked Documents -### Notes +If a document has expired or been revoked, you'll see warnings: -Ensure that the credential file is in the correct JSON format and adheres to the W3C Verifiable Credentials Data Model. +```bash +⚠ warning The document credential has expired. +✔ success DOCUMENT_INTEGRITY: VALID +⚠ warning DOCUMENT_STATUS: INVALID - Document has been revoked. +✔ success ISSUER_IDENTITY: VALID +``` -If the verification fails, double-check the file path and the format of the credential JSON file. +## Notes -If the status verification shows revocation:true, it means the credential has been revoked and is no longer valid. +- 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