### Component Setup Actions Overview Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/README.md This table summarizes the setup actions for each component in the Ayra Card Demo App. These actions typically involve dependency installation, tunnel creation, and configuration file generation or updates. ```markdown | Component | Setup Actions | | ---------------------- | --------------------------------------------------------------------------------------------- | | **domain-setup** | Installs npm dependencies, starts ngrok tunnels, generates `domains.json` with public URLs | | **issuer-portal** | Clones repository, updates `.env` with domains and DIDs | | **verifier-portal** | Clones repository, configures VDSP endpoints | | **trust-registry-api** | Clones repository, generates `tr-data.csv` with issuer domains | | **trust-registry-ui** | Clones repository, updates `registries.ts` with API endpoints | | **mobile-app** | Clones repository, configures `.env`, updates organization endpoints, copies Firebase configs | ``` -------------------------------- ### Execute Main Setup Script Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This bash script initiates the overall setup process for the Ayra project, which includes running the domain setup component. It's the recommended way to get all services configured and running. ```bash # From project root ./setup-ayra.sh ``` -------------------------------- ### Initialize Page Instance and Setup Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/hotel.html Asynchronous function to initialize the page instance, fetch client data, and set up QR codes and WebSockets. It relies on `createPageInstance`, `fetchClients`, `createQRCode`, and `setupWebSocket` functions. The `clientId` is used to filter client data. ```javascript var pageInstance; async function init() { pageInstance = createPageInstance() pageInstance.initializeDOMElements(); const clients = await fetchClients(); clients.forEach((client) => { if (client.id != clientId) return; pageInstance.clientsData[client.id] = client; createQRCode(`main-qrcode`, client); setupWebSocket(client.id, pageInstance); }); } ``` -------------------------------- ### Initialize Page Instance and DOM Elements (JavaScript) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/building.html Initializes a page instance, sets up DOM elements, fetches client data, creates QR codes, and sets up WebSocket connections. This function is called when the demo starts and is responsible for the core setup of the application's data and UI. ```javascript async function init() { pageInstance = createPageInstance() pageInstance.initializeDOMElements(); const clients = await fetchClients(); clients.forEach((client) => { if (client.id != 'kiosk') return; pageInstance.clientsData[client.id] = client; createQRCode(`main-qrcode`, client); setupWebSocket(client.id, pageInstance); }); } ``` -------------------------------- ### Install Application Components using CMake Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/windows/CMakeLists.txt This section details the installation rules for the application executable, libraries, and assets. It configures the installation prefix, defines destination directories for data and libraries, and specifies which files to install based on build configurations and component types. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Dependencies with npm Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/code/README.md Installs the necessary project dependencies using the Node Package Manager (npm). Ensure you have Node.js and npm installed before running this command. ```bash npm install ``` -------------------------------- ### Start Tunnel Server with npm Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This command executes the Node.js server script responsible for creating and maintaining the ngrok tunnels. It should be run from the `code` directory within `domain-setup`. ```bash cd code npm start ``` -------------------------------- ### Develop Issuer Portal Locally with Dart Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/issuer-portal/README.md Instructions for setting up and running the Issuer Portal locally for development purposes using Dart. This includes installing dependencies with `dart pub get` and starting the development server with `dart run bin/server.dart`. It also covers running tests and generating code coverage reports. ```bash # Navigate to the code directory cd code # Install Dart dependencies dart pub get # Run the development server dart run bin/server.dart # Run tests dart test # Run tests with coverage dart test --coverage=coverage ``` -------------------------------- ### Setup Issuer Portal with Shell Script Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/issuer-portal/README.md Automates the setup process for the Issuer Portal, including running its setup script, verifying code, configuring environment variables, updating DID:web domains, and preparing for Docker deployment. This script is recommended for a streamlined setup. ```bash #!/bin/bash # Navigate to the issuer-portal directory cd issuer-portal # Execute the setup script ./setup.sh # Navigate back to the project root (optional, depending on context) cd .. ``` -------------------------------- ### Start and Monitor Trust Registry API Service Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Commands to start the Trust Registry API service using Docker Compose and to follow its logs in real-time. Ensure Docker is installed and the project is in the root directory. ```bash # From project root docker compose up -d trust-registry-api # Check logs docker compose logs -f trust-registry-api ``` -------------------------------- ### CMake Installation Configuration Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/linux/CMakeLists.txt Configures the installation process, setting the install prefix to a bundle directory and ensuring a clean build bundle directory on each install. It defines destinations for data and library files. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Manually Run Domain Setup Script Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This bash script allows for the manual execution of the domain setup process independently. It navigates into the `domain-setup` directory and runs the primary setup script. ```bash cd domain-setup ./setup.sh ``` -------------------------------- ### Setup Script for Trust Registry UI Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/README.md This bash script automates the setup process for the Trust Registry UI. It verifies the presence of UI code, copies configuration templates, updates issuer domains with ngrok information, URL-encodes these domains for proper DID resolution, and configures the API endpoint. ```bash #!/bin/bash # This script automates the setup and configuration of the Trust Registry UI. # --- Configuration --- TRUST_REGISTRY_UI_DIR="./code" REGISTRIES_TEMPLATE="./registries.ts" REGISTRIES_CONFIG="${TRUST_REGISTRY_UI_DIR}/src/data/registries.ts" # --- Functions --- # Function to display messages log() { echo "[INFO] $1" } error() { echo "[ERROR] $1" >&2 exit 1 } # Function to URL-encode strings url_encode() { echo "$1" | sed 's/:/%3A/g; s///%2F/g; s/?/%3F/g; s/#/%23/g; s/&/%26/g; s/=/%3D/g; s/+/%2B/g; s/@/%40/g' } # --- Main Script --- log "Starting Trust Registry UI setup..." # 1. Verify Trust Registry UI code presence if [ ! -d "${TRUST_REGISTRY_UI_DIR}" ]; then error "Trust Registry UI code not found at ${TRUST_REGISTRY_UI_DIR}. Please ensure the code is present." fi log "Trust Registry UI code verified." # 2. Copy registries.ts template log "Copying registries.ts template to ${REGISTRIES_CONFIG}..." cp "${REGISTRIES_TEMPLATE}" "${REGISTRIES_CONFIG}" log "registries.ts copied." # 3. Update with issuer domains from ngrok (example - replace with actual logic) # This is a placeholder. In a real scenario, you would fetch ngrok domains dynamically. NGROK_DOMAIN="ghi789.ngrok-free.app" ISSUER_DOMAIN_TEMPLATE="abc123.ngrok-free.app:8080" # Example: Update specific issuer domains (replace with actual dynamic update logic) # For demonstration, we'll use a simple substitution. log "Updating issuer domains..." # URL-encode the issuer domain parts ENCODED_NGROK_DOMAIN=$(url_encode ${NGROK_DOMAIN}) ENCODED_ISSUER_DOMAIN="${ENCODED_NGROK_DOMAIN}%3A8080" # Update the registries.ts file with encoded domains sed -i "s|did:web:abc123.ngrok-free.app:8080:sweetlane-bank|did:web:${ENCODED_ISSUER_DOMAIN}:sweetlane-bank|g" "${REGISTRIES_CONFIG}" sed -i "s|did:web:abc123.ngrok-free.app:8080:sweetlane-group|did:web:${ENCODED_ISSUER_DOMAIN}:sweetlane-group|g" "${REGISTRIES_CONFIG}" sed -i "s|did:web:abc123.ngrok-free.app:8080:ayra-forum|did:web:${ENCODED_ISSUER_DOMAIN}:ayra-forum|g" "${REGISTRIES_CONFIG}" log "Issuer domains updated and encoded." # 4. Configure API endpoint (example - replace with actual logic) API_ENDPOINT="https://${NGROK_DOMAIN}" log "Setting Trust Registry API endpoint to ${API_ENDPOINT}..." sed -i "s|apiEndpoint: \"https://ghi789.ngrok-free.app\"|apiEndpoint: \"${API_ENDPOINT}\"|g" "${REGISTRIES_CONFIG}" log "API endpoint configured." log "Trust Registry UI setup completed successfully." exit 0 ``` -------------------------------- ### Setup Script for Trust Registry API Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Shell script to automate the setup process for the Trust Registry API. It clones the repository, prepares data files, and configures environment variables. It's recommended to run this from the project root. ```bash ./setup-ayra.sh ``` ```bash cd trust-registry-api ./setup.sh ``` -------------------------------- ### Build and Run Development Server (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/README.md Instructions for building and running the development server for the Ayra Card Demo App. This involves navigating to the code directory, installing Dart dependencies, and executing the server script. ```bash cd code # Install dependencies dart pub get # Run development server dart run bin/server.dart ``` -------------------------------- ### Initialize Kiosk for Hotel Template Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/hotel.html Initializes the Kiosk manager for the Hotel template after the DOM is fully loaded. It configures modal IDs and event handlers for toggle presses and demo start. Dependencies include the Kiosk API and potentially other global functions like `window.init`. ```javascript let templateManager; let clientId = "check-in-desk" document.addEventListener('DOMContentLoaded', function () { Kiosk.initializeKioskPage('Hotel', { modalIds: ['identityModal', 'payloadDetailsModal'], onTogglePressed: function (mode, isChecked) { console.log('šŸ”„ Toggle pressed! Mode:', mode, 'Checked:', isChecked); const clients = pageInstance?.clientsData; if (clients) { Object.keys(clients).forEach(clientKey => { console.log('Triggering mock response for client:', clientKey); }); } }, onDemoStart: function () { console.log('šŸ›ŽļøšŸ›ŽļøšŸ›ŽļøšŸ›ŽļøšŸ›ŽļøšŸ›ŽļøšŸ›ŽļøšŸ›Žļø Hotel demo started'); if (typeof window.init === 'function') { window.init(); } else { console.warn('āš ļø init function is not defined.'); } } }); }); ``` -------------------------------- ### Start Development Server with Hot Reload (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/README.md Command to start the development server with hot reload enabled, allowing for real-time updates during development. The server is accessible at http://localhost:3001. ```bash # Start with hot reload npm run dev # Access at http://localhost:3001 ``` -------------------------------- ### CMake Install Targets and Files Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/linux/CMakeLists.txt Installs the application executable, ICU data file, Flutter library, bundled libraries, and native assets to their respective destinations within the installation bundle. This ensures all necessary components are included for runtime. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Build and Run Development Server (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/README.md Commands to install dependencies, run the development server with hot reload, build for production, and preview the production build. These are essential for local development and deployment. ```bash cd code # Install dependencies npm install # Run development server npm run dev # Build for production npm run build # Preview production build npm run preview ``` -------------------------------- ### Run Development Server with npm Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/code/README.md Starts the development server for the Trust Registry UI application. This command is typically used during development to preview changes locally. The application will be accessible at http://localhost:3000. ```bash npm run dev ``` -------------------------------- ### CMake Install Flutter Assets Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/linux/CMakeLists.txt Installs the Flutter assets directory, ensuring it's copied fresh on each build to avoid stale files. The assets are placed in the data directory of the installation bundle. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Generate Tunnels with npm (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This command generates tunnels and creates a `domains.json` file. It's a one-time setup useful for CI/CD or automated testing environments. The command exits immediately after generation. ```bash cd code npm run generate ``` -------------------------------- ### Firebase iOS Configuration (XML/Plist) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/README.md Shows an example of the `GoogleService-Info.plist` file for Firebase integration on iOS. It includes the client ID and other necessary configuration details. ```xml CLIENT_ID 123456789-abc123.apps.googleusercontent.com ``` -------------------------------- ### Setup ngrok Tunnels with Node.js Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This script sets up and manages ngrok tunnels for the Ayra ecosystem services. It requires the '@ngrok/ngrok' and 'dotenv' Node.js packages. The script creates three tunnels for the Issuer Portal, Verifier Portal, and Trust Registry UI, outputting their public URLs to the console and generating a `domains.json` file. ```javascript import ngrok from '@ngrok/ngrok'; import dotenv from 'dotenv'; import fs from 'fs'; dotenv.config(); const NGROK_AUTH_TOKEN = process.env.NGROK_AUTH_TOKEN; async function setupTunnels() { if (!NGROK_AUTH_TOKEN) { console.error('NGROK_AUTH_TOKEN is not set in .env file.'); process.exit(1); } try { await ngrok.authtoken(NGROK_AUTH_TOKEN); const issuerTunnel = await ngrok.connect({ port: 8080 }); const verifierTunnel = await ngrok.connect({ port: 8081 }); const trustRegistryTunnel = await ngrok.connect({ port: 3001 }); console.log('šŸš€ Starting ngrok tunnels for Ayra services...'); console.log(`Issuer Portal: ${issuerTunnel}`); console.log(`Verifier Portal: ${verifierTunnel}`); console.log(`Trust Registry UI: ${trustRegistryTunnel}`); const domainsData = { issuer: { domain: issuerTunnel.replace('https://', ''), url: issuerTunnel, didweb: { sweetlane_bank: `${issuerTunnel.replace('https://', '')}/sweetlane-bank`, sweetlane_group: `${issuerTunnel.replace('https://', '')}/sweetlane-group`, ayra_forum: `${issuerTunnel.replace('https://', '')}/ayra-forum` } }, verifier: { domain: verifierTunnel.replace('https://', ''), url: verifierTunnel }, trustRegistry: { domain: trustRegistryTunnel.replace('https://', ''), url: trustRegistryTunnel } }; fs.writeFileSync('domains.json', JSON.stringify(domainsData, null, 2)); console.log('āœ… All tunnels are running!'); console.log('šŸ“ domains.json has been generated'); // Keep tunnels alive process.on('SIGINT', async () => { console.log('Shutting down ngrok tunnels...'); await ngrok.disconnect(issuerTunnel); await ngrok.disconnect(verifierTunnel); await ngrok.disconnect(trustRegistryTunnel); process.exit(0); }); console.log('\nāš ļø Keep this terminal open to maintain the tunnels\nPress Ctrl+C to stop all tunnels'); } catch (error) { console.error('Error setting up ngrok tunnels:', error); process.exit(1); } } setupTunnels(); ``` -------------------------------- ### GET /api/oob/clients Source: https://context7.com/affinidi/affinidi-labs-ayra-card-demo-app/llms.txt Retrieves a list of all configured verifier clients, including their OOB (Out-of-Band) invitation URLs. ```APIDOC ## GET /api/oob/clients ### Description Returns all configured verifier clients with their OOB invitation URLs. This endpoint is useful for understanding available verification services and how to initiate connections. ### Method GET ### Endpoint `/api/oob/clients` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the verifier client. - **name** (string) - Display name of the verifier client. - **type** (string) - Type of the verifier client (e.g., 'internal', 'external'). - **description** (string) - A brief description of the verifier client's purpose. - **purpose** (string) - Detailed explanation of what credentials can be shared for. - **permanentDid** (string) - The permanent DID associated with the verifier client. - **oobUrl** (string) - The Out-of-Band invitation URL for initiating a connection. #### Response Example ```json [ { "id": "kiosk", "name": "Building Access", "type": "internal", "description": "Secure access control for office building", "purpose": "Share your credentials to get secure access to the building", "permanentDid": "did:key:z6MkqR...", "oobUrl": "https://mediator.example.com/oob?_oob=..." }, { "id": "roundtable", "name": "Strategy Session", "type": "internal", "description": "Secure access control for 6th floor session", "purpose": "Share your credentials to have session in secure area", "permanentDid": "did:key:z6MknS...", "oobUrl": "https://mediator.example.com/oob?_oob=..." } ] ``` ``` -------------------------------- ### Build and Run Rust Application Locally Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Commands to build and run the Rust-based Trust Registry API service locally. This includes building the release version, running tests, and starting the development server. Assumes the user is in the 'code' directory. ```bash cd code # Build Rust application cargo build --release # Run tests cargo test # Run development server cargo run ``` -------------------------------- ### Build and Run Flutter Mobile Application Source: https://context7.com/affinidi/affinidi-labs-ayra-card-demo-app/llms.txt This collection of Flutter CLI commands covers essential tasks for the mobile application, including installing dependencies, generating code, localizing strings, running the app on a device/emulator, building for Android and iOS, running tests, and analyzing code quality. ```bash # Navigate to mobile app cd mobile-app/code # Install dependencies flutter pub get # Generate code (models, serializers) dart run build_runner build --delete-conflicting-outputs # Generate localized strings flutter gen-l10n # Run on connected device/emulator flutter run --dart-define-from-file=configurations/.env # Build for Android flutter build apk --dart-define-from-file=configurations/.env # Build for iOS flutter build ios --dart-define-from-file=configurations/.env # Run tests flutter test --coverage # Analyze code dart analyze . ``` -------------------------------- ### Initialize Page Instance and Data Fetching (JavaScript) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/coffeeshop.html Initializes the page instance, sets up DOM elements, fetches client data, and configures QR code generation and WebSocket connections. This function is crucial for setting up the demo's core functionalities upon page load. ```javascript var pageInstance; async function init() { pageInstance = createPageInstance() pageInstance.initializeDOMElements(); const clients = await fetchClients(); clients.forEach((client) => { if (client.id != 'coffeeshop') return; pageInstance.clientsData[client.id] = client; createQRCode(`main-qrcode`, client); setupWebSocket(client.id, pageInstance); }); } ``` -------------------------------- ### Test New Trust Registry Entries with cURL and jq Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Examples demonstrating how to test newly added trust registry entries. It shows how to verify all issuers and test a specific issuer query using cURL, with the output formatted by `jq` for readability. ```bash # Verify new entries curl http://localhost:3000/issuers | jq # Test specific query curl "http://localhost:3000/issuers?did=did:web:neworg.com" | jq ``` -------------------------------- ### Verify Tunnel Setup with curl (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This command verifies if the ngrok tunnels are running by making an HTTP request to the tunnel URL. A successful response should be a 200 status code or a redirect. ```bash # Check if tunnels are running curl -I https://your-tunnel-url.ngrok-free.app # Should return 200 or redirect response ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/android/fastlane/README.md Ensures the latest version of Xcode command line tools are installed, which is a prerequisite for using Fastlane. This command is run directly in the terminal. ```shell xcode-select --install ``` -------------------------------- ### Initialize Page Instance and Fetch Clients (JavaScript) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/session.html Initializes a page instance and fetches client data asynchronously. It then iterates through the clients, storing their data and creating QR codes for specific clients (e.g., 'roundtable'). WebSocket connections are also set up for each client. ```javascript var pageInstance; async function init() { pageInstance = createPageInstance() pageInstance.initializeDOMElements(); const clients = await fetchClients(); clients.forEach((client) => { if (client.id != 'roundtable') return; pageInstance.clientsData[client.id] = client; createQRCode(`main-qrcode`, client); setupWebSocket(client.id, pageInstance); }); } ``` -------------------------------- ### CMake Install AOT Library Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/code/linux/CMakeLists.txt Conditionally installs the Ahead-Of-Time (AOT) compiled library on non-Debug builds. This optimizes performance for release and profile builds by including pre-compiled code. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Generated domains.json Structure Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/domain-setup/README.md This JSON file is automatically generated by the domain setup script. It contains the public URLs for the Issuer Portal, Verifier Portal, and Trust Registry UI, along with DID Web configurations for the issuer. ```json { "issuer": { "domain": "abc123.ngrok-free.app", "url": "https://abc123.ngrok-free.app", "didweb": { "sweetlane_bank": "abc123.ngrok-free.app/sweetlane-bank", "sweetlane_group": "abc123.ngrok-free.app/sweetlane-group", "ayra_forum": "abc123.ngrok-free.app/ayra-forum" } }, "verifier": { "domain": "def456.ngrok-free.app", "url": "https://def456.ngrok-free.app" }, "trustRegistry": { "domain": "ghi789.ngrok-free.app", "url": "https://ghi789.ngrok-free.app" } } ``` -------------------------------- ### Run Dart Server Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/issuer-portal/code/README.md Command to execute the Dart server application. This command initiates the server process, making it ready to handle incoming API requests. ```bash dart bin/server.dart ``` -------------------------------- ### Deploy Services with Docker Compose Source: https://context7.com/affinidi/affinidi-labs-ayra-card-demo-app/llms.txt This set of bash commands utilizes Docker Compose to manage the deployment of the application's services. It covers starting, viewing status, accessing logs, rebuilding, and stopping all services, including options for volume management. ```bash # Start all services docker compose up -d # View running services docker compose ps # NAME STATUS # issuer-portal Up # verifier-portal Up # trust-registry-api Up # trust-registry-ui Up # View logs for specific service docker compose logs -f issuer-portal # Rebuild and restart all services docker compose up -d --build --force-recreate # Stop all services docker compose down # Stop and remove volumes docker compose down -v ``` -------------------------------- ### Start and Monitor Issuer Portal with Docker Compose Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/issuer-portal/README.md Commands to start the Issuer Portal service in detached mode using Docker Compose and to follow its logs in real-time. This is essential for deploying and debugging the service in a containerized environment. ```bash # Start the issuer-portal service in detached mode docker compose up -d issuer-portal # Follow the logs of the issuer-portal service in real-time docker compose logs -f issuer-portal ``` -------------------------------- ### GET /issuers - Pagination Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Retrieve paginated results for issuer data. ```APIDOC ## GET /issuers ### Description Retrieves paginated results for issuer data, allowing control over the number of items per page. ### Method GET ### Endpoint `/issuers` ### Query Parameters * **page** (integer) - Required - The page number to retrieve. * **limit** (integer) - Required - The maximum number of items to return per page. ### Request Example ```bash curl "http://localhost:3000/issuers?page=1&limit=10" ``` ### Response #### Success Response (200) * **issuers** (array) - A list of issuer objects for the requested page. * **issuer** (object) - Details of an issuer. * **status** (string) - The current status of the issuer. * **valid_on** (date) - The date until which the issuer is considered valid. * **framework** (string) - The trust framework the issuer belongs to. * **metadata** (object) - Additional metadata about the issuer. #### Response Example ```json { "issuers": [ { "issuer": { "status": "active", "valid_on": "2026-12-31", "framework": "ayra-ecosystem", "metadata": { "country": "US" } } } // ... more issuers up to the limit ] } ``` ``` -------------------------------- ### GET /issuers - Metadata Queries Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Query issuer data based on specific metadata fields. ```APIDOC ## GET /issuers ### Description Queries issuer data by filtering based on specific metadata fields. ### Method GET ### Endpoint `/issuers` ### Query Parameters * **metadata.[fieldName]** (string) - Optional - Filter issuers where a specific metadata field matches the provided value (e.g., `metadata.country=US`). ### Request Example ```bash curl "http://localhost:3000/issuers?metadata.country=US" ``` ### Response #### Success Response (200) * **issuers** (array) - A list of issuer objects matching the metadata query. * **issuer** (object) - Details of an issuer. * **status** (string) - The current status of the issuer. * **valid_on** (date) - The date until which the issuer is considered valid. * **framework** (string) - The trust framework the issuer belongs to. * **metadata** (object) - Additional metadata about the issuer, including the queried field. #### Response Example ```json { "issuers": [ { "issuer": { "status": "active", "valid_on": "2026-12-31", "framework": "ayra-ecosystem", "metadata": { "country": "US", "someOtherField": "value" } } } ] } ``` ``` -------------------------------- ### Coffee Shop Discount Scenario Configuration - JSON Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/README.md Configuration for the Coffee Shop Discount scenario, outlining its ID, name, description, type, purpose, permanent DID, and OOB URL for exclusive offers. ```json { "id": "coffeeshop", "name": "Coffee Shop", "description": "Exclusive offers and rewards", "type": "external", "purpose": "Share your credentials to get exclusive offers/rewards", "permanent_did": "did:key:zDnaemjDtrFMhF28BvDaWLJJVs5SihgJxeAs5aQizmRw9e4tY", "oob_url": "https://b1140049-55a0-4a0b-8515-dd2bb82a237a.mpx.affinidi.io/v1/get-oob/24310fdc-294a-483b-b256-99c4928f4b17" } ``` -------------------------------- ### Interact with Trust Registry UI using cURL Source: https://context7.com/affinidi/affinidi-labs-ayra-card-demo-app/llms.txt These cURL commands demonstrate how to access different sections of the Trust Registry UI, including the home page, specific registries, authorization management, recognition management, and health checks. They are useful for quickly testing and understanding the UI's functionality. ```bash # Home page - lists all configured registries curl http://localhost:3000/ # Sweetlane Group registry home curl http://localhost:3000/sweetlane-group/ # Ayra Forum registry home curl http://localhost:3000/ayra-forum/ # Authorization management (who can issue what credentials) curl http://localhost:3000/sweetlane-group/authorization # Recognition management (which entities are recognized) curl http://localhost:3000/sweetlane-group/recognition # Health check curl http://localhost:3000/health # Response: {"status":"ok","message":"Healthy"} ``` -------------------------------- ### Firebase Android Configuration (JSON) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/mobile-app/README.md Provides an example of the `google-services.json` file required for Firebase integration on Android. It contains essential project and client information for the app. ```json { "project_info": { "project_number": "123456789", "project_id": "ayra-wallet-app" }, "client": [ { "client_info": { "mobilesdk_app_id": "1:123456789:android:abc123", "android_client_info": { "package_name": "com.affinidi.ayra.wallet" } } } ] } ``` -------------------------------- ### Login to Issuer Portal API (Bash) Source: https://context7.com/affinidi/affinidi-labs-ayra-card-demo-app/llms.txt Authenticates users by email domain and returns an Out-of-Band (OOB) invitation URL for establishing a DIDComm channel. Requires a valid email domain for successful authentication. ```bash # Login with valid email domain to get OOB invitation curl -X POST http://localhost:8080/sweetlane-bank/api/login \ -H "Content-Type: application/json" \ -d '{"email": "alice@sweetlane-bank.com"}' # Response: { "ok": true, "email": "alice@sweetlane-bank.com", "oobUrl": "https://mediator.example.com/oob?_oob=eyJ0eXBlIjoiaHR0cHM6Ly9kaWRjb21tLm9yZy9vdXQtb2YtYmFuZC8yAvaW52aXRhdGlvbiIsImlkIjoiYWJjMTIzIiwiZnJvbSI6ImRpZDprZXk6ejZNa3...", "did": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH" } # Error response for unauthorized email domain: { "error": "Unauthorized user" } ``` -------------------------------- ### GET /issuers - Custom Query Filters Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Retrieve issuer information with custom filters for status, validity date, and framework. ```APIDOC ## GET /issuers ### Description Retrieves issuer information, supporting custom filters for status, validity date, and framework. ### Method GET ### Endpoint `/issuers` ### Query Parameters * **status** (string) - Optional - Filter issuers by their status (e.g., `active`). * **valid_on** (date) - Optional - Filter issuers valid on a specific date (e.g., `2025-12-31`). * **framework** (string) - Optional - Filter issuers belonging to a specific framework (e.g., `ayra-ecosystem`). ### Request Example * **Filter by status:** ```bash curl "http://localhost:3000/issuers?status=active" ``` * **Filter by validity date:** ```bash curl "http://localhost:3000/issuers?valid_on=2025-12-31" ``` * **Combine filters:** ```bash curl "http://localhost:3000/issuers?framework=ayra-ecosystem&status=active" ``` ### Response #### Success Response (200) * **issuers** (array) - A list of issuer objects matching the query criteria. * **issuer** (object) - Details of an issuer. * **status** (string) - The current status of the issuer. * **valid_on** (date) - The date until which the issuer is considered valid. * **framework** (string) - The trust framework the issuer belongs to. * **metadata** (object) - Additional metadata about the issuer. #### Response Example ```json { "issuers": [ { "issuer": { "status": "active", "valid_on": "2026-12-31", "framework": "ayra-ecosystem", "metadata": { "country": "US" } } } ] } ``` ``` -------------------------------- ### Initialize Kiosk Page and Event Listeners (JavaScript) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/verifier-portal/code/public/building.html Initializes the Kiosk page with specific modal IDs and event handlers for toggle presses and demo start. It waits for the DOM to be fully loaded before execution. This function is crucial for setting up the interactive elements of the demo. ```javascript let templateManager; document.addEventListener('DOMContentLoaded', function () { Kiosk.initializeKioskPage('Building', { modalIds: ['identityModal', 'payloadDetailsModal'], onTogglePressed: function (mode, isChecked) { console.log('šŸ”„ Toggle pressed! Mode:', mode, 'Checked:', isChecked); const clients = pageInstance?.clientsData; if (clients) { Object.keys(clients).forEach(clientKey => { console.log('Triggering mock response for client:', clientKey); }); } }, onDemoStart: function () { console.log('šŸ¢šŸ¢šŸ¢šŸ¢šŸ¢šŸ¢šŸ¢šŸ¢ Building demo started'); if (typeof window.init === 'function') { window.init(); } else { console.warn('āš ļø init function is not defined.'); } } }); }); ``` -------------------------------- ### Query Trust Registry API by Metadata Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Example cURL command to query issuers based on specific metadata fields, such as country. ```bash # Query by metadata fields curl "http://localhost:3000/issuers?metadata.country=US" ``` -------------------------------- ### Filter Trust Registry API by Status Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Example cURL commands to filter issuers based on their status, demonstrating a simple query parameter. ```bash # Filter by status curl "http://localhost:3000/issuers?status=active" ``` -------------------------------- ### Run Tests and Code Quality Checks (Bash) Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-ui/README.md Commands to execute various testing and code quality tasks, including unit tests, coverage reports, end-to-end tests, linting, formatting, and type checking. These ensure the project's stability and maintainability. ```bash # Run unit tests npm test # Run with coverage npm run test:coverage # Run E2E tests npm run test:e2e # Lint code npm run lint # Format code npm run format # Type check npm run type-check ``` -------------------------------- ### Filter Trust Registry API by Validity Date Source: https://github.com/affinidi/affinidi-labs-ayra-card-demo-app/blob/main/trust-registry-api/README.md Example cURL commands to filter issuers based on their validity date, showcasing date-based filtering. ```bash # Filter by validity date curl "http://localhost:3000/issuers?valid_on=2025-12-31" ```