- Added SignRequestManager.js to manage sign requests, including UI states for keyspace lock, mismatch, and approval. - Implemented methods for loading state, rendering UI, and handling user interactions (approve/reject requests). - Integrated background message listeners for keyspace unlock events and request updates. |
||
---|---|---|
.. | ||
mock_sigsocket_server.js | ||
package.json | ||
README.md |
Mock SigSocket Server Demo
This directory contains a mock SigSocket server for testing the browser extension functionality.
Setup
-
Install dependencies:
npm install
-
Start the mock server:
npm start
The server will listen on ws://localhost:8080/ws
Usage
Interactive Commands
Once the server is running, you can use these commands:
test
- Send a test sign request to all connected clientsstatus
- Show server status and connected clientsquit
- Shutdown the server
Testing Flow
- Start the mock server
- Load the browser extension in Chrome
- Create a keyspace and keypair in the extension
- The extension should automatically connect to the server
- The server will send a test sign request after 3 seconds
- Use the extension popup to approve or reject the request
- The server will log the response and send another request after 10 seconds
Expected Output
When a client connects:
New WebSocket connection from: ::1
Received message: 04a8b2c3d4e5f6...
Client registered: client_1234567890_abc123 with public key: 04a8b2c3d4e5f6...
📝 Sending sign request to client_1234567890_abc123: req_1_1234567890
Message: "Test message 1 - 2024-01-01T12:00:00.000Z"
When a sign response is received:
Received sign response from client_1234567890_abc123: {
id: 'req_1_1234567890',
message: 'VGVzdCBtZXNzYWdlIDEgLSAyMDI0LTAxLTAxVDEyOjAwOjAwLjAwMFo=',
signature: '3045022100...'
}
✅ Sign request req_1_1234567890 completed successfully
Signature: 3045022100...
Protocol
The mock server implements a simplified version of the SigSocket protocol:
- Client Introduction: Client sends hex-encoded public key
- Welcome Message: Server responds with welcome JSON
- Sign Requests: Server sends JSON with
id
andmessage
(base64) - Sign Responses: Client sends JSON with
id
,message
, andsignature
Troubleshooting
- Connection refused: Make sure the server is running on port 8080
- No sign requests: Check that the extension is properly connected
- Extension errors: Check the browser console for JavaScript errors
- WASM errors: Ensure the WASM files are properly built and loaded