Trust Engine search-file

Search for a file by its content hash
The search-file command allows you to search for a file in the Trust Engine registry by uploading the file and checking if its content hash exists on the blockchain. You can search for all registrations of a file or filter by a specific wallet address. To use it, run the following command from your terminal
trust-engine-cli search-file [options]

Options

OptionDescription
-f, --file <path>Path to the file to search for
-w, --walletAddress <address>Wallet address to search for (Solana public key)
--jsonOutput the result as JSON

Examples

Search for a file:
trust-engine-cli search-file --file ./document.pdf
After running the command, you’ll see search results:
✅ Found 1 registration(s) for your file content.

Search Information:
  - Search Mode: content_hash
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
  - Total Results: 1

Registration Details:

--- Registration 1 ---
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
  - PDA Address: 9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR
  - IPFS CID: QmExampleCidForYourFileMetadata123
  - Registered By: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
  - User ID: user_12345
  - Timestamp: 2024-01-15T10:30:45.123Z
  - Status: Registered
  - Explorer URL: https://explorer.solana.com/address/8kQv2gFhgRmHq7ZPBx4N9TqJbSx3jDw5mVpL1WzNfEtY?cluster=devnet
  - IPFS Data: {}
  - On Chain Data: {}
You can also search for files registered by a specific wallet:
trust-engine-cli search-file --file ./document.pdf --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
If no registrations are found:
✅ File search completed.

Search Information:
  - Search Mode: content_hash
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
  - Total Results: 0

No registrations found for this content.
For automation purposes, use the JSON output:
trust-engine-cli search-file --file ./document.pdf --json
This will return:
{
  "message": "Found 1 registration(s) for your file content.",
  "searchMode": "content_hash",
  "searchCriteria": {
    "contentHash": "abc123def456789ghi012jkl345mno678pqr901"
  },
  "totalResults": 1,
  "registrations": [
    {
      "title": "Test File",
      "contentHash": "abc123def456789ghi012jkl345mno678pqr901",
      "pdaAddress": "9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR",
      "ipfsCid": "QmExampleCidForYourFileMetadata123",
      "registeredBy": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "userID": "user_12345",
      "timestamp": "2024-01-15T10:30:45.123Z",
      "status": "registered",
      "explorerUrl": "https://explorer.solana.com/address/8kQv2gFhgRmHq7ZPBx4N9TqJbSx3jDw5mVpL1WzNfEtY?cluster=devnet",
      "metadata": "Test File Metadata", 
      "identity_data": {
        "verified_name": "John Doe",
        "verified_nationality": "United States",
        "verified_date_of_birth": "1990-01-01",
        "verified_gender": null,
        "verified_passport_number": null,
        "verified_issuing_state": null,
        "verified_expiry_date": null,
        "verified_at": "2024-01-15T14:30:25.000Z",
        "provider": "self"
      }
    }
  ]
}