### Setup Trust Registry: Quick Start (No DIDComm) Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Command to generate default configurations and start the Trust Registry server with only the HTTP API enabled. This setup is suitable for environments where DIDComm is not required. ```bash # Generate default configurations cargo run --bin setup-trust-registry --features="dev-tools" # Start the Trust Registry server ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry # Server starts on http://localhost:3232 # Uses CSV file storage with sample data from ./sample-data/data.csv ``` -------------------------------- ### Test Environment Configuration Example Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Enables specific configurations suitable for testing within CI/CD pipeline environments. This option helps in setting up isolated and reproducible test runs. ```bash --test-in-pipeline true ``` -------------------------------- ### Setup: Quick Start (No DIDComm) Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Configure and run the Trust Registry without DIDComm, using default CSV file storage. This is suitable for basic setups or development environments. ```APIDOC ## Setup: Quick Start (No DIDComm) ### Description Run setup command to generate default configurations and start the Trust Registry with HTTP API only. Uses CSV file storage with sample data. ### Commands 1. **Generate default configurations:** ```bash cargo run --bin setup-trust-registry --features="dev-tools" ``` 2. **Start the Trust Registry server:** ```bash ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry ``` ### Notes - Server starts on `http://localhost:3232`. - Uses CSV file storage with sample data from `./sample-data/data.csv`. ``` -------------------------------- ### Admin DID Configuration Example Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Specifies the Decentralized Identifiers (DIDs) that have administrative privileges to manage Trust Registry records. Multiple DIDs can be provided as a comma-separated list. ```bash --admin-dids "did:peer:2.Vz6Mk...,did:peer:2.Vz6Mn..." ``` -------------------------------- ### Storage Backend Configuration Examples Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Selects the storage backend for trust records. Options include 'csv', 'ddb' (DynamoDB), and 'redis'. Specific configuration options like file path, DynamoDB table name, or Redis URL are required based on the chosen backend. ```bash --storage-backend csv --file-storage-path "./sample-data/data.csv" ``` ```bash --storage-backend ddb --ddb-table-name "trust-registry-records" ``` ```bash --storage-backend redis --redis-url "redis://localhost:6379" ``` -------------------------------- ### DID Method Configuration Examples Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Specifies the DID method to be used for generating Trust Registry DIDs. Options include 'peer', 'web', and 'webvh'. For 'web' or 'webvh', the `--didweb-url` option is mandatory to provide the URL where the DID document will be hosted. ```bash --did-method peer ``` ```bash --did-method web --didweb-url "https://example.com" ``` ```bash --did-method webvh --didweb-url "https://example.com" ``` -------------------------------- ### Profile Configuration Examples Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/README.md Examples demonstrating how to set the PROFILE_CONFIG environment variable using different URI schemes for loading configuration. ```bash # Direct value (local development) PROFILE_CONFIG='{"alias":"Trust Registry","did":"did:peer:2.VzDna...","secrets":[...]} # File-based configuration PROFILE_CONFIG='file:///etc/trust-registry/config.json' # AWS Secrets Manager PROFILE_CONFIG='aws_secrets://prod/trust-registry/profile' # AWS Parameter Store PROFILE_CONFIG='aws_parameter_store:///trust-registry/profile' ``` -------------------------------- ### Existing DID Configuration Examples Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Allows setting an existing DID for the Trust Registry instead of generating a new one. The `--tr-did` option specifies the DID, and `--tr-did-secret` provides the corresponding secret material, typically in JWK format. ```bash --tr-did "did:peer:2.Vz6Mk..." --tr-did-secret "[{"id":..., "privateKeyJwk":{...}}]" ``` -------------------------------- ### Profile Configuration Examples Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry profile, either by specifying a location to save a newly generated profile (when `--did-method` is used) or to load an existing one. Supports direct values, string protocols, file system paths, and AWS services like Secrets Manager and Parameter Store. ```bash --profile '{"alias":"Trust Registry","did":"did:peer:2.Vz6Dna...","secrets":[]}' ``` ```bash --profile 'string://{"alias":"Trust Registry","did":"did:peer:2.Vz6Dna...","secrets":[]}' ``` ```bash --profile 'file:///path/to/config.json' ``` ```bash --profile 'aws_secrets://my-secret-name' ``` ```bash --profile 'aws_parameter_store:///my-parameter-name' ``` -------------------------------- ### Install and Run Coverage with Cargo LLVM Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Installs the 'cargo-llvm-cov' tool and then generates an HTML coverage report for the trust-registry crate. Requires Docker Compose to be running for integration tests. ```bash # Install once cargo install cargo-llvm-cov docker compose -f docker-compose.test.yaml up -d cargo llvm-cov --html -p trust-registry open target/llvm-cov/html/index.html ``` -------------------------------- ### Basic Trust Registry Setup Command Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Executes the `setup-trust-registry` command with development tools features enabled. This is the fundamental command to initiate the trust registry setup process, accepting various options to customize the configuration. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- [OPTIONS] ``` -------------------------------- ### Setup and Run Trust Registry (Bash) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/README.md Commands to set up and run the Trust Registry server. It first generates default configurations using Cargo and then starts the server with DIDComm disabled and logging enabled. The server defaults to http://localhost:3232 with CSV storage. ```bash cargo run --bin setup-trust-registry --features="dev-tools" ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry ``` -------------------------------- ### Setup Trust Registry: With DynamoDB Storage Backend Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Guide to configuring the Trust Registry with AWS DynamoDB as the storage backend, suitable for cloud-native deployments. Requires AWS credentials to be configured. ```bash # Setup with DynamoDB backend cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=ddb \ --ddb-table-name=trust-registry-prod # Start Trust Registry (requires AWS credentials configured) ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry ``` -------------------------------- ### Run All Tests Manually with Cargo Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Runs all tests manually using Cargo after starting necessary services with Docker Compose. Ensure the storage backend is configured. ```bash docker compose -f docker-compose.test.yaml up -d cargo test -p trust-registry ``` -------------------------------- ### Docker Compose Deployment with Redis Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Example Docker Compose configuration for deploying the Trust Registry with a Redis storage backend. This setup simplifies deployment and management in containerized environments. ```yaml version: '3.8' services: redis: image: redis:7-alpine command: redis-server --requirepass your_password --appendonly yes ports: - "6379:6379" volumes: - redis-data:/data restart: unless-stopped trust-registry: build: . environment: - TR_STORAGE_BACKEND=redis - REDIS_URL=redis://:your_password@redis:6379 - ENABLE_DIDCOMM=false - CORS_ALLOWED_ORIGINS=http://localhost:3000 - AUDIT_LOG_FORMAT=json ports: - "3232:3232" depends_on: - redis restart: unless-stopped volumes: redis-data: ``` -------------------------------- ### Verify Rust and Cargo Installation Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/CONTRIBUTING.md This snippet demonstrates how to verify that the Rust compiler and Cargo build tool are installed and meet the minimum version requirements for the project. It takes no input and produces no output other than the version information. ```bash rustc --version cargo --version ``` -------------------------------- ### Setup Trust Registry (No DIDComm) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Sets up the Trust Registry with default settings and disables DIDComm integration. This is a basic setup that uses CSV storage and generates environment variables, including a .env file. ```bash cargo run --bin setup-trust-registry --features="dev-tools" ``` -------------------------------- ### DIDComm Mediator Configuration Example Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry to connect to a DIDComm mediator. The `--mediator-did` option specifies the DID of the mediator, enabling DIDComm functionality. The service endpoint is automatically resolved from the provided DID document. ```bash --mediator-did "did:web:mediator.goodcompany.com" ``` -------------------------------- ### Setup Trust Registry with Existing Profile Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Loads an existing Trust Registry profile configuration from a specified file path. This allows for pre-configured settings, including DIDComm integration, and generates a .env file based on the profile. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --profile='file:///path/to/profile.json' \ --mediator-did=did:web:mediator.goodcompany.com ``` -------------------------------- ### Docker Compose Build and Start Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Commands to build the Docker images and start the Trust Registry and Redis services using Docker Compose. The Trust Registry will be accessible at http://localhost:3232. ```bash # Build and start containers docker compose up --build # Trust Registry available at http://localhost:3232 ``` -------------------------------- ### Setup Trust Registry: With Redis Storage Backend Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Instructions for configuring the Trust Registry to use Redis as the storage backend for high-performance, low-latency data storage. Includes setup for authentication and verification. ```bash # Start Redis docker run -d -p 6379:6379 redis:7-alpine # Setup with Redis backend cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=redis \ --redis-url=redis://localhost:6379 # Start Trust Registry ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry # For Redis with authentication export REDIS_URL="redis://username:password@localhost:6379" # Verify Redis connectivity redis-cli -h localhost -p 6379 ping # Expected: PONG # View stored records redis-cli KEYS "*|*|*|*" ``` -------------------------------- ### Setup Trust Registry with Existing DID and Secrets Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Sets up the Trust Registry using a pre-existing DID and its associated secrets, rather than generating new ones. This is useful for integrating with existing identity infrastructure and enables DIDComm with the specified mediator and admin DIDs, creating a .env file. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --tr-did=did:peer:2.Vz6Mk... \ --tr-did-secret='[{"id":"did:peer:2.Vz6Mk...#key-1","privateKeyJwk":{"crv":"P-256","kty":"EC","x":"...","y":"..."},"type":"JsonWebKey2020"}]' \ --mediator-did=did:web:mediator.goodcompany.com \ --admin-dids=did:peer:2.Admin... ``` -------------------------------- ### Create Trust Record Response Example (JSON) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/DIDCOMM_PROTOCOLS.md An example of a JSON response to a create trust record request. It confirms the creation and includes key identifiers from the request. ```json { "id": "040d3b97-0be8-43f8-8a95-b3a926aadff2", "typ": "application/didcomm-plain+json", "type_": "https://affinidi.com/didcomm/protocols/tr-admin/1.0/create-record/response", "body": { "action": "action_xyz", "authority_id": "did:example:authority456", "entity_id": "did:example:entity123", "resource": "resource_abc" }, "from": "", "to": [ "" ], "thid": "6a627735-6743-4141-8cb7-1359d778936b" } ``` -------------------------------- ### Setup Trust Registry with DynamoDB Storage Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry to use DynamoDB as its storage backend. This command specifies the storage backend and the DynamoDB table name, generating a .env file with the relevant configuration. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=ddb \ --ddb-table-name=trust-registry-prod ``` -------------------------------- ### Setup Trust Registry with DIDComm Enabled Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry for DIDComm integration, specifying a mediator DID. This setup generates a Trust Registry DID, test user DIDs, configures ACLs on the mediator, and sets up environment variables for DIDComm, creating a .env file. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.goodcompany.com ``` -------------------------------- ### Setup Trust Registry with did:web Method Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry to use the `did:web` DID method for identity resolution. This command specifies the DID method, the DID Web URL, and the mediator DID for DIDComm integration, generating a .env file. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --did-method=web \ --didweb-url=https://example.com/.well-known/did.json \ --mediator-did=did:web:mediator.goodcompany.com ``` -------------------------------- ### Run All Tests Using Script Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Executes all unit and integration tests using the provided testing script. Assumes the environment is set up. ```bash bash testing/run_tests.sh --test-type all ``` -------------------------------- ### Setup Trust Registry with Redis Storage Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Sets up the Trust Registry to use Redis as its storage backend. This command specifies the storage backend and the Redis connection URL, generating a .env file with the Redis configuration. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=redis \ --redis-url=redis://localhost:6379 ``` -------------------------------- ### Setup: With Redis Storage Backend Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Configure the Trust Registry to use Redis as the storage backend for high-performance, low-latency data storage. ```APIDOC ## Setup: With Redis Storage Backend ### Description Configure Trust Registry to use Redis for high-performance, low-latency storage. ### Commands 1. **Start Redis (if not already running):** ```bash docker run -d -p 6379:6379 redis:7-alpine ``` 2. **Setup with Redis backend:** ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=redis \ --redis-url=redis://localhost:6379 ``` 3. **Start Trust Registry:** ```bash ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry ``` ### Redis with Authentication Set the `REDIS_URL` environment variable: ```bash export REDIS_URL="redis://username:password@localhost:6379" ``` ### Verify Redis Connectivity ```bash redis-cli -h localhost -p 6379 ping # Expected output: PONG ``` ### View Stored Records ```bash redis-cli KEYS "*|*|*|*" ``` ``` -------------------------------- ### Create Trust Record Request Example (JSON) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/DIDCOMM_PROTOCOLS.md An example of a JSON request to create a trust record in the Trust Registry. It includes fields like authority_id, entity_id, authorized, recognized, action, resource, and optional context. ```json { "id": "040d3b97-0be8-43f8-8a95-b3a926aadff1", "typ": "application/didcomm-plain+json", "type_": "https://affinidi.com/didcomm/protocols/tr-admin/1.0/create-record", "body": { "action": "action_xyz", "authority_id": "did:example:authority456", "authorized": true, "context": { "id": "https://governance.example.org/healthcare-framework", "type": "GovernanceFramework", "name": "Healthcare Trust Framework", "version": "1.0" }, "entity_id": "did:example:entity123", "recognized": true, "resource": "resource_abc" }, "from": "", "to": [ "" ], "thid": "6a627735-6743-4141-8cb7-1359d778936b" } ``` -------------------------------- ### Setup: With DynamoDB Storage Backend Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Configure the Trust Registry to use AWS DynamoDB as the storage backend, suitable for cloud-native deployments. ```APIDOC ## Setup: With DynamoDB Storage Backend ### Description Configure Trust Registry to use AWS DynamoDB for cloud-native deployments. ### Commands 1. **Setup with DynamoDB backend:** ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --storage-backend=ddb \ --ddb-table-name=trust-registry-prod ``` 2. **Start Trust Registry:** (Requires AWS credentials to be configured) ```bash ENABLE_DIDCOMM=false RUST_LOG=info cargo run --bin trust-registry ``` ``` -------------------------------- ### CSV Context Field Decoding Example Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Illustrates how to decode the Base64-encoded JSON context field found in the CSV storage format. Shows an example of decoding a specific Base64 string. ```bash # Context field is Base64-encoded JSON # eyJhZGRpdGlvbmFsIjogImNvbnRleHQifQ== decodes to {"additional": "context"} # Sample data location: ./sample-data/data.csv ``` -------------------------------- ### Query Authorization Response Message Example (JSON) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/DIDCOMM_PROTOCOLS.md An example JSON structure for a query authorization response message. This message is sent by the Trust Registry back to the Verifier, indicating whether the entity is authorized and providing details about the evaluation. ```json { "id": "040d3b97-0be8-43f8-8a95-b3a926aadff2", "typ": "application/didcomm-plain+json", "type_": "https://affinidi.com/didcomm/protocols/trqp/1.0/query-authorization/response", "body": { "action": "action_xyz", "authority_id": "did:example:authority456", "authorized": true, "context": { "id": "https://governance.example.org/healthcare-framework", "type": "GovernanceFramework", "name": "Healthcare Trust Framework", "version": "2.0" }, "entity_id": "did:example:entity123", "resource": "resource_abc", "record_type":"Authorization", "time_requested":"2025-12-09T05:33:52Z", "time_evaluated":"2025-12-09T05:33:52Z", "message": "did:example:entity123 authorized to action1+resource1 by did:example:authority456 to issue a certificate credential." }, "from": "", "to": [ "", ], "thid": "6a627735-6743-4141-8cb7-1359d778936b" } ``` -------------------------------- ### Setup Trust Registry with Custom Admin DIDs Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/SETUP_COMMAND_REFERENCES.md Configures the Trust Registry with specific DIDs for administrative access, particularly when DIDComm is enabled. This command sets the mediator DID and a comma-separated list of admin DIDs, generating a .env file. ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.goodcompany.com \ --admin-dids=did:peer:2.Admin1...,did:peer:2.Admin2... ``` -------------------------------- ### Setup: With DIDComm Enabled Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Configure the Trust Registry to enable DIDComm for secure admin operations and encrypted queries, specifying a DIDComm mediator. ```APIDOC ## Setup: With DIDComm Enabled ### Description Configure Trust Registry with DIDComm mediator for secure admin operations and encrypted queries. ### Commands 1. **Setup with DIDComm mediator:** ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.example.com ``` 2. **Setup with DIDComm mediator and private ACL mode:** (Only pre-authorized DIDs can send messages) ```bash cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.example.com \ --acl-mode=ExplicitAllow ``` 3. **Start the Trust Registry:** ```bash RUST_LOG=info cargo run --bin trust-registry ``` ``` -------------------------------- ### Run Integration Tests Using Script Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Executes only the integration tests using the testing script. Can specify storage backend like 'ddb'. ```bash bash testing/run_tests.sh --test-type int ``` ```bash bash testing/run_tests.sh --test-type int --storage-backend ddb ``` -------------------------------- ### Run Integration Tests Manually with Cargo Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Runs specific integration tests manually using Cargo after starting services with Docker Compose. Uses '--no-capture' to display test output. ```bash docker compose -f docker-compose.test.yaml up -d cargo test --test http_integration_test --test didcomm_integration_test --test didcomm_server_test -- --no-capture ``` -------------------------------- ### Query Authorization Request Message Example (JSON) Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/DIDCOMM_PROTOCOLS.md An example JSON structure for a query authorization request message. This message is sent by a Verifier to the Trust Registry to check if an entity is authorized for a specific action and resource by a given authority. ```json { "id": "040d3b97-0be8-43f8-8a95-b3a926aadff1", "typ": "application/didcomm-plain+json", "type_": "https://affinidi.com/didcomm/protocols/trqp/1.0/query-authorization", "body": { "action": "action_xyz", "authority_id": "did:example:authority456", "entity_id": "did:example:entity123", "resource": "resource_abc" }, "from": "", "to": [ "", ], "thid": "6a627735-6743-4141-8cb7-1359d778936b" } ``` -------------------------------- ### Setup Trust Registry: With DIDComm Enabled Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Commands to set up the Trust Registry with DIDComm mediator support for secure admin operations and encrypted queries. Includes options for private mode with explicit allowlist. ```bash # Setup with DIDComm mediator cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.example.com # For private mode (only pre-authorized DIDs can send messages) cargo run --bin setup-trust-registry --features="dev-tools" -- \ --mediator-did=did:web:mediator.example.com \ --acl-mode=ExplicitAllow # Start the Trust Registry RUST_LOG=info cargo run --bin trust-registry ``` -------------------------------- ### Build and Use TrustRecord Domain Model in Rust Source: https://context7.com/affinidi/affinidi-trust-registry-rs/llms.txt Demonstrates how to construct a TrustRecord using the builder pattern in Rust. It shows setting various fields like entity ID, authority ID, action, resource, and context, and how to access these fields after building. It also illustrates merging additional context into an existing record. ```rust use trust_registry::domain::{ Action, AuthorityId, Context, EntityId, RecordType, Resource, TrustRecord, TrustRecordBuilder, }; use serde_json::json; // Create a trust record using the builder pattern let record = TrustRecordBuilder::new() .entity_id(EntityId::new("did:example:entity123")) .authority_id(AuthorityId::new("did:example:authority456")) .action(Action::new("issue")) .resource(Resource::new("healthcare_credential")) .recognized(true) .authorized(true) .record_type(RecordType::Authorization) .context(Context::new(json!({ "framework": "Healthcare Trust Framework", "version": "1.0" }))) .build() .expect("Valid trust record"); // Access record fields assert_eq!(record.entity_id().as_str(), "did:example:entity123"); assert_eq!(record.authority_id().as_str(), "did:example:authority456"); assert!(record.is_authorized()); assert!(record.is_recognized()); assert_eq!(record.record_type().to_string(), "authorization"); // Merge additional context (additional context overrides base) let merged_record = record.merge_contexts(Context::new(json!({ "version": "2.0", "updated": true }))); // Result: {"framework": "Healthcare Trust Framework", "version": "2.0", "updated": true} ``` -------------------------------- ### Generate Coverage Report Using Script Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Generates a code coverage report using the testing script. The report can be viewed in a web browser. ```bash bash testing/run_tests.sh --coverage true ``` ```bash open target/llvm-cov/html/index.html ``` -------------------------------- ### Configure CSV Storage Backend Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Sets the TR_STORAGE_BACKEND environment variable to 'csv' to use CSV storage for tests. This is the default storage option. ```bash TR_STORAGE_BACKEND=csv ``` -------------------------------- ### Run Unit Tests Only Using Script Source: https://github.com/affinidi/affinidi-trust-registry-rs/blob/main/testing/README.md Executes only the unit tests using the testing script. This is useful for quickly verifying code changes. ```bash bash testing/run_tests.sh --test-type unit ```