A headless Matrix integration for quali.chat with token-gated access based on on-chain balances. It uses pluggable blockchain adapters (currently Ethereum via Alchemy) to stream native and ERC-20 balance updates, caches token metadata in Redis, and manages Matrix room creation, membership, and power levels via Synapse admin APIs with end-to-end encryption.
- Up-to-date Node.js and Docker installed
- Alchemy API key (get one here)
- Matrix server setup as documented in quali-chat/synapse-homeserver-patch
- Install dependencies:
npm i
- Copy
.env.example
to.env
and fill inALCHEMY_API_KEY
(and any other needed variables). - Start a local Redis instance:
docker run --name redis -p 6379:6379 -d redis
- Start the service with file watching:
npm run dev
The bot supports End-to-End Encrypted (E2EE) messages. For production, be sure to persist the following:
BOT_STORAGE_FILE
: Path to the file where the bot stores its encryption state.BOT_ENCRYPTION_DIR
: Directory for additional encryption data.
Set these in your .env
file to ensure encrypted message support and safe recovery after restarts or migrations.
This document provides a comprehensive guide on the integration with OIDC providers and the steps taken to ensure compatibility with multiple blockchain wallets.
- User initiates authentication through quali.chat interface
- User is redirected to the OIDC provider for wallet-based authentication
- After successful authentication, OIDC provider returns tokens to quali.chat
- quali.chat validates tokens and establishes a user session
- quali-chat-core: Main application handling Matrix protocol integration
- oidc-provider: Authentication service supporting multiple wallet types
- Matrix Server: Backend messaging infrastructure
- Blockchain Wallets: End-user authentication method
- Invalid access token errors: Clear the
data
directory to remove outdated login information - Password login disabled: Ensure
password_config
is set toenabled: true
in Matrix server config - Connection issues between services: Check network settings and ensure all services are running
- Check logs for both quali-chat-core and oidc-provider
- Verify Redis connection is active
- Ensure wallet connections are properly configured