- 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.
3.5 KiB
3.5 KiB
Testing the SigSocket Browser Extension
Prerequisites
- SigSocket Server: You need a running SigSocket server at
ws://localhost:8080/ws
- Browser: Chrome or Chromium-based browser with developer mode enabled
Test Steps
1. Load the Extension
- Open Chrome and go to
chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the
crypto_vault_extension
directory - The CryptoVault extension should appear in your extensions list
2. Basic Functionality Test
- Click the CryptoVault extension icon in the toolbar
- Create a new keyspace:
- Enter a keyspace name (e.g., "test-workspace")
- Enter a password
- Click "Create New"
- The extension should automatically connect to the SigSocket server
- Add a keypair:
- Click "Add Keypair"
- Enter a name for the keypair
- Click "Create Keypair"
3. SigSocket Integration Test
-
Check Connection Status:
- Look for the SigSocket connection status at the bottom of the popup
- It should show "SigSocket: Connected" with a green indicator
-
Test Sign Request Flow:
- Send a sign request to the SigSocket server (you'll need to implement this on the server side)
- The extension should show a notification
- The extension badge should show the number of pending requests
- Open the extension popup to see the sign request
-
Test Approval Flow:
- If keyspace is locked, you should see "Unlock keyspace to see X pending requests"
- Unlock the keyspace using the login form
- You should see the sign request details
- Click "Approve & Sign" to approve the request
- The request should be signed and sent back to the server
4. Settings Test
- Click the settings gear icon in the extension popup
- Change the SigSocket server URL if needed
- Adjust the session timeout if desired
Expected Behavior
- ✅ Extension loads without errors
- ✅ Can create keyspaces and keypairs
- ✅ SigSocket connection is established automatically
- ✅ Sign requests are received and displayed
- ✅ Approval flow works correctly
- ✅ Settings can be configured
Troubleshooting
Common Issues
- Extension won't load: Check the console for JavaScript errors
- SigSocket won't connect: Verify the server is running and the URL is correct
- WASM errors: Check that the WASM files are properly built and copied
- Sign requests not appearing: Check the browser console for callback errors
Debug Steps
- Open Chrome DevTools
- Go to the Extensions tab
- Find CryptoVault and click "Inspect views: background page"
- Check the console for any errors
- Also inspect the popup by right-clicking the extension icon and selecting "Inspect popup"
Server-Side Testing
To fully test the extension, you'll need a SigSocket server that can:
-
Accept WebSocket connections at
/ws
-
Handle client introduction messages (hex-encoded public keys)
-
Send sign requests in the format:
{ "id": "unique-request-id", "message": "base64-encoded-message" }
-
Receive sign responses in the format:
{ "id": "request-id", "message": "base64-encoded-message", "signature": "base64-encoded-signature" }
Next Steps
If basic functionality works:
- Test with multiple concurrent sign requests
- Test connection recovery after network issues
- Test with different keyspace configurations
- Test the rejection flow
- Test session timeout behavior