A lightweight WebSocket relay server for the Agent Pocket Extension. It facilitates secure communication between DApps (Senders) and the Wallet (Receiver).
- WebSocket-based Communication: Real-time message relay.
- Wallet Authentication: Secure handshake using Ethereum signatures (EIP-191).
- Authenticated Routing: Requests are routed to verified wallet addresses.
- Ed25519 Signed Requests: All incoming requests from senders must be signed.
- Test Suite: Integrated test client for verifying transaction and message signing flows.
- Node.js (v16 or higher)
- npm
- Clone the repository.
- Install dependencies:
npm install- Copy the example environment file:
cp .env.example .env
- Edit
.envand configure the following:PORT: Server port (default8080).HOST: Server host (defaultlocalhost).WS_URL: WebSocket URL (e.g.,ws://localhost:8080).TEST_SECRET_KEY: Base58 encoded Ed25519 secret key for the test sender.TARGET_ADDRESS: The Ethereum address of the wallet you want to test against.TEST_CHAIN_ID: Required chain ID for transaction tests (sign_transaction/send_transaction), default56.
Start the relay server:
npm start
# OR
node server.jsWallets must authenticate immediately upon connection using a signed handshake. See Wallet Requirements for the detailed specification.
To verify that the server correctly handles wallet authentication:
node verify_auth.jsThe project includes a test client (test.js) that acts as a Sender. It connects to the server and sends requests to the TARGET_ADDRESS configured in .env.
Note: You must have a real wallet connected and authenticated to the server for these tests to succeed.
-
Sign Transaction (Default): Requests the wallet to sign a sample transaction.
npm run test:tx
-
Sign Message: Requests the wallet to sign a text message.
npm run test:msg
-
Send Transaction: Requests the wallet to sign and broadcast a transaction.
npm run test:send
server.js: The WebSocket Relay Server implementation.test.js: The Sender Simulation Client.verify_auth.js: Script to verify wallet authentication handshake.docs/: detailed documentation.
