๐Ÿงช Testing Guide

Complete testing guide using test-simple-sdk.html

โ† Back to Docs

๐Ÿ“ Test Interface Overview

test-simple-sdk.html Interface

Header & Configuration
API Configuration
โ€ข API Key
โ€ข User ID
โ€ข Base URL
Backup Panel
โ€ข Seed input
โ€ข Parameters
โ€ข Encryption
Restore Panel
โ€ข Share inputs
โ€ข QR upload
โ€ข Password
Results Display
โ€ข QR Codes โ€ข Share Texts โ€ข JSON Output
API Console
โ€ข Request/Response Logs โ€ข Headers โ€ข Errors
โœ…

Full API Testing

Test all SDK functions with real API calls

๐ŸŽจ

Visual QR Codes

See generated QR codes instantly

๐Ÿ›

Debug Console

Monitor all API interactions

๐Ÿš€ Setting Up Testing Environment

1

Launch Backend Services

# Start Docker containers
cd Docker
docker-compose -f docker-compose.dev.yml up -d

# Start SDK API
cd sdk-api
npm run dev

# Verify health
curl http://localhost:3001/api/v1/health
2

Get Test Credentials

# Register a test partner
curl -X POST http://localhost:3001/api/v1/partners/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test Partner",
    "email": "test@example.com"
  }'

# Save the API key from response!
3

Open Test Interface

# Option 1: Direct file
open test-simple-sdk.html

# Option 2: Python server
python -m http.server 8000

# Option 3: Node server
npx http-server
4

Configure Interface

  • โœ“ Enter API key: publicId.secret
  • โœ“ Enter User ID: test_user_001
  • โœ“ Set Base URL: http://localhost:3001/api/v1

โœ… Test Scenarios

Basic Backup & Restore

Test the happy path with default settings

  1. 1. Enter test seed phrase
  2. 2. Keep defaults (3 shares, threshold 2)
  3. 3. Click "Perform Backup"
  4. 4. Copy 2 share texts
  5. 5. Perform restore
  6. 6. Verify seed matches
Expected: 3 QR codes, successful restoration

Encrypted Backup

Test encryption functionality

  1. 1. Enter seed phrase
  2. 2. Set encryption password
  3. 3. Perform backup
  4. 4. Try restore WITHOUT password
  5. 5. Try restore WITH password
Expected: Fails without password, succeeds with

Payment Flow

Test quota exhaustion and payment

  1. 1. Check "Payment required"
  2. 2. Enter transaction ID
  3. 3. Perform backup
  4. 4. Check API console
Expected: Payment proof sent, backup proceeds

QR Code Restoration

Test QR image upload

  1. 1. Complete a backup
  2. 2. Save QR images
  3. 3. Switch to "QR Images" tab
  4. 4. Upload saved QRs
  5. 5. Perform restore
Expected: QR decoded, restoration successful

Error Handling

Test various error conditions

  • โ€ข Invalid API key format
  • โ€ข Missing User ID
  • โ€ข Invalid seed phrase
  • โ€ข Insufficient shares
  • โ€ข Wrong password
Expected: Clear error messages

Non-BIP39 Phrases

Test custom text backup

  1. 1. Enter custom text
  2. 2. Check "Allow non-BIP39"
  3. 3. Perform backup
  4. 4. Restore with same setting
Expected: Backup and restore of custom text

๐Ÿ–ฅ๏ธ Using the API Console

Console Features

๐Ÿ–ฅ๏ธ API Console (2 logs)
10:23:45 POST /api/v1/users/register
Headers:
X-API-Key: abc123...
Body: {"userId":"test_001"}
Response: 200 OK
10:23:46 POST /api/v1/quota/check
Response: {"hasQuota":true}

Request Entry

  • โ€ข Method and URL
  • โ€ข Request headers
  • โ€ข Request body
  • โ€ข Timestamp

Response Entry

  • โ€ข Status code
  • โ€ข Response headers
  • โ€ข Response body
  • โ€ข Processing time

Error Entry

  • โ€ข Error message
  • โ€ข Stack trace
  • โ€ข Failed request
  • โ€ข Debug info

๐ŸŽฏ Common Testing Patterns

Automated Test Suite

// test-suite.js
class SimpleSDKTestSuite {
    constructor(apiKey, apiUrl) {
        this.apiKey = apiKey;
        this.apiUrl = apiUrl;
        this.results = [];
    }
    
    async runAllTests() {
        await this.testBasicBackup();
        await this.testEncryption();
        await this.testQuotaExhaustion();
        await this.testInvalidInputs();
        this.printResults();
    }
    
    async testBasicBackup() {
        const sead = new SeadSimpleWithAPI({
            apiUrl: this.apiUrl,
            apiKey: this.apiKey,
            userId: 'test_' + Date.now()
        });
        
        const result = await sead.backup({
            seedPhrase: 'test seed phrase'
        });
        
        this.results.push({
            test: 'Basic Backup',
            passed: result.success
        });
    }
}

Load Testing

// Load test with concurrent operations
async function loadTest(concurrent = 10) {
    const promises = [];
    
    for (let i = 0; i < concurrent; i++) {
        promises.push(
            performBackup(`user_${i}`, `seed ${i}`)
        );
    }
    
    console.time('Load Test');
    const results = await Promise.allSettled(promises);
    console.timeEnd('Load Test');
    
    const successful = results.filter(r => r.status === 'fulfilled');
    console.log(`Success rate: ${successful.length}/${concurrent}`);
}

๐Ÿ“Š Performance Benchmarks

Operation Target Acceptable Maximum
SDK Init < 50ms < 100ms 200ms
Backup (3 shares) < 200ms < 500ms 1000ms
Restore (2 shares) < 150ms < 300ms 500ms
QR Generation < 100ms < 200ms 500ms
API Call < 50ms < 100ms 500ms

๐Ÿ“‹ Pre-Production Checklist

โœ… Functionality

โš ๏ธ Error Handling

๐Ÿ’ฐ Payment Flow

โšก Performance

๐Ÿ”’ Security

๐ŸŒ Compatibility

๐Ÿ“ Test Data Reference

// Valid BIP39 seed phrases
const validSeeds = [
    "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
    "legal winner thank year wave sausage worth useful legal winner thank yellow",
    "letter advice cage absurd amount doctor acoustic avoid letter advice cage above"
];

// Test user IDs
const testUsers = [
    "test_user_001",
    "0x742d35Cc6634C0532925a3b844Bc9e7595f0fA77",
    "user_" + Date.now(),
    "wallet_address_hash_123"
];

// Test API keys (format examples)
const testApiKeys = [
    "a1b2c3d4e5f67890a1b2c3d4e5f67890.1234567890abcdef1234567890abcdef",
    "0000000000000000000000000000000.00000000000000000000000000000000"
];

// Payment proof examples
const paymentProofs = {
    ethereum: {
        transactionId: "0x1234567890abcdef...",
        proof: "0xsignature..."
    },
    bitcoin: {
        transactionId: "abc123def456...",
        proof: "btc_proof_data"
    }
};

๐ŸŽฏ Summary

The test interface provides comprehensive testing capabilities for SimpleSDK integration:

๐Ÿ‘๏ธ

Visual Testing

See QR codes and results immediately

๐Ÿ›

API Debugging

Monitor all network traffic

โœ…

Complete Coverage

Test all scenarios thoroughly