sal-modular/crypto_vault_extension/test_extension.md
Sameh Abouel-saad 580fd72dce feat: Implement Sign Request Manager component for handling sign requests in the popup (WIP)
- 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.
2025-06-04 16:55:15 +03:00

3.5 KiB

Testing the SigSocket Browser Extension

Prerequisites

  1. SigSocket Server: You need a running SigSocket server at ws://localhost:8080/ws
  2. Browser: Chrome or Chromium-based browser with developer mode enabled

Test Steps

1. Load the Extension

  1. Open Chrome and go to chrome://extensions/
  2. Enable "Developer mode" in the top right
  3. Click "Load unpacked" and select the crypto_vault_extension directory
  4. The CryptoVault extension should appear in your extensions list

2. Basic Functionality Test

  1. Click the CryptoVault extension icon in the toolbar
  2. Create a new keyspace:
    • Enter a keyspace name (e.g., "test-workspace")
    • Enter a password
    • Click "Create New"
  3. The extension should automatically connect to the SigSocket server
  4. Add a keypair:
    • Click "Add Keypair"
    • Enter a name for the keypair
    • Click "Create Keypair"

3. SigSocket Integration Test

  1. Check Connection Status:

    • Look for the SigSocket connection status at the bottom of the popup
    • It should show "SigSocket: Connected" with a green indicator
  2. 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
  3. 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

  1. Click the settings gear icon in the extension popup
  2. Change the SigSocket server URL if needed
  3. 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

  1. Extension won't load: Check the console for JavaScript errors
  2. SigSocket won't connect: Verify the server is running and the URL is correct
  3. WASM errors: Check that the WASM files are properly built and copied
  4. Sign requests not appearing: Check the browser console for callback errors

Debug Steps

  1. Open Chrome DevTools
  2. Go to the Extensions tab
  3. Find CryptoVault and click "Inspect views: background page"
  4. Check the console for any errors
  5. 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:

  1. Accept WebSocket connections at /ws

  2. Handle client introduction messages (hex-encoded public keys)

  3. Send sign requests in the format:

    {
      "id": "unique-request-id",
      "message": "base64-encoded-message"
    }
    
  4. Receive sign responses in the format:

    {
      "id": "request-id",
      "message": "base64-encoded-message",
      "signature": "base64-encoded-signature"
    }
    

Next Steps

If basic functionality works:

  1. Test with multiple concurrent sign requests
  2. Test connection recovery after network issues
  3. Test with different keyspace configurations
  4. Test the rejection flow
  5. Test session timeout behavior