peerpigeon 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,427 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PeerPigeon - Crypto Test Suite</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ <link rel="icon" type="image/png" href="assets/images/favicon.png">
9
+ <style>
10
+ .crypto-test-container {
11
+ max-width: 1200px;
12
+ margin: 0 auto;
13
+ padding: 20px;
14
+ }
15
+
16
+ .test-section {
17
+ background: #f5f5f5;
18
+ border: 1px solid #ddd;
19
+ border-radius: 8px;
20
+ padding: 20px;
21
+ margin: 20px 0;
22
+ }
23
+
24
+ .test-section h3 {
25
+ margin: 0 0 15px 0;
26
+ color: #333;
27
+ }
28
+
29
+ .test-controls {
30
+ display: flex;
31
+ gap: 10px;
32
+ flex-wrap: wrap;
33
+ margin: 15px 0;
34
+ }
35
+
36
+ .test-result {
37
+ background: #fff;
38
+ border: 1px solid #ccc;
39
+ border-radius: 4px;
40
+ padding: 15px;
41
+ margin: 10px 0;
42
+ font-family: monospace;
43
+ font-size: 12px;
44
+ max-height: 200px;
45
+ overflow-y: auto;
46
+ }
47
+
48
+ .test-result.success {
49
+ border-color: #28a745;
50
+ background-color: #d4edda;
51
+ }
52
+
53
+ .test-result.error {
54
+ border-color: #dc3545;
55
+ background-color: #f8d7da;
56
+ }
57
+
58
+ .test-result.warning {
59
+ border-color: #ffc107;
60
+ background-color: #fff3cd;
61
+ }
62
+
63
+ .crypto-status {
64
+ display: grid;
65
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
66
+ gap: 15px;
67
+ margin: 20px 0;
68
+ }
69
+
70
+ .status-card {
71
+ background: #fff;
72
+ border: 1px solid #ddd;
73
+ border-radius: 6px;
74
+ padding: 15px;
75
+ }
76
+
77
+ .status-card h4 {
78
+ margin: 0 0 10px 0;
79
+ color: #555;
80
+ }
81
+
82
+ .status-indicator {
83
+ display: inline-block;
84
+ width: 12px;
85
+ height: 12px;
86
+ border-radius: 50%;
87
+ margin-right: 8px;
88
+ }
89
+
90
+ .status-indicator.active {
91
+ background-color: #28a745;
92
+ }
93
+
94
+ .status-indicator.inactive {
95
+ background-color: #dc3545;
96
+ }
97
+
98
+ .status-indicator.warning {
99
+ background-color: #ffc107;
100
+ }
101
+
102
+ .key-display {
103
+ font-family: monospace;
104
+ font-size: 10px;
105
+ word-break: break-all;
106
+ background: #f8f9fa;
107
+ padding: 8px;
108
+ border-radius: 4px;
109
+ margin: 5px 0;
110
+ }
111
+
112
+ .performance-metrics {
113
+ display: grid;
114
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
115
+ gap: 10px;
116
+ margin: 15px 0;
117
+ }
118
+
119
+ .metric-item {
120
+ text-align: center;
121
+ padding: 10px;
122
+ background: #fff;
123
+ border: 1px solid #ddd;
124
+ border-radius: 4px;
125
+ }
126
+
127
+ .metric-value {
128
+ font-size: 18px;
129
+ font-weight: bold;
130
+ color: #007bff;
131
+ }
132
+
133
+ .metric-label {
134
+ font-size: 12px;
135
+ color: #666;
136
+ margin-top: 5px;
137
+ }
138
+
139
+ .peer-keys-list {
140
+ max-height: 150px;
141
+ overflow-y: auto;
142
+ border: 1px solid #ddd;
143
+ border-radius: 4px;
144
+ background: #fff;
145
+ }
146
+
147
+ .peer-key-item {
148
+ padding: 8px 12px;
149
+ border-bottom: 1px solid #eee;
150
+ font-family: monospace;
151
+ font-size: 11px;
152
+ }
153
+
154
+ .peer-key-item:last-child {
155
+ border-bottom: none;
156
+ }
157
+
158
+ .test-message-area {
159
+ margin: 15px 0;
160
+ }
161
+
162
+ .test-message-area textarea {
163
+ width: 100%;
164
+ min-height: 80px;
165
+ padding: 10px;
166
+ border: 1px solid #ddd;
167
+ border-radius: 4px;
168
+ font-family: monospace;
169
+ font-size: 12px;
170
+ resize: vertical;
171
+ }
172
+
173
+ .encryption-demo {
174
+ display: grid;
175
+ grid-template-columns: 1fr 1fr;
176
+ gap: 20px;
177
+ margin: 20px 0;
178
+ }
179
+
180
+ .demo-panel {
181
+ border: 1px solid #ddd;
182
+ border-radius: 6px;
183
+ padding: 15px;
184
+ background: #fff;
185
+ }
186
+
187
+ .demo-panel h4 {
188
+ margin: 0 0 10px 0;
189
+ color: #333;
190
+ }
191
+
192
+ @media (max-width: 768px) {
193
+ .encryption-demo {
194
+ grid-template-columns: 1fr;
195
+ }
196
+
197
+ .crypto-status {
198
+ grid-template-columns: 1fr;
199
+ }
200
+ }
201
+ </style>
202
+ </head>
203
+ <body>
204
+ <div class="crypto-test-container">
205
+ <header>
206
+ <h1>🔐 PeerPigeon Crypto Test Suite</h1>
207
+ <p>Comprehensive testing interface for cryptographic functionality using unsea.</p>
208
+ </header>
209
+
210
+ <!-- Crypto Status Overview -->
211
+ <div class="test-section">
212
+ <h3>📊 Crypto Status</h3>
213
+ <div class="crypto-status">
214
+ <div class="status-card">
215
+ <h4>
216
+ <span id="crypto-enabled-indicator" class="status-indicator inactive"></span>
217
+ Crypto Manager
218
+ </h4>
219
+ <div>Status: <span id="crypto-status">Not Initialized</span></div>
220
+ <div>Keypair: <span id="keypair-status">None</span></div>
221
+ </div>
222
+
223
+ <div class="status-card">
224
+ <h4>
225
+ <span id="mesh-status-indicator" class="status-indicator inactive"></span>
226
+ Mesh Network
227
+ </h4>
228
+ <div>Connected: <span id="mesh-connected">No</span></div>
229
+ <div>Peers: <span id="peer-count">0</span></div>
230
+ </div>
231
+
232
+ <div class="status-card">
233
+ <h4>Public Key</h4>
234
+ <div id="public-key-display" class="key-display">Not generated</div>
235
+ </div>
236
+
237
+ <div class="status-card">
238
+ <h4>Performance Metrics</h4>
239
+ <div class="performance-metrics">
240
+ <div class="metric-item">
241
+ <div class="metric-value" id="encrypted-count">0</div>
242
+ <div class="metric-label">Encrypted</div>
243
+ </div>
244
+ <div class="metric-item">
245
+ <div class="metric-value" id="decrypted-count">0</div>
246
+ <div class="metric-label">Decrypted</div>
247
+ </div>
248
+ <div class="metric-item">
249
+ <div class="metric-value" id="key-exchanges">0</div>
250
+ <div class="metric-label">Key Exchanges</div>
251
+ </div>
252
+ </div>
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+ <!-- Initialization Tests -->
258
+ <div class="test-section">
259
+ <h3>🚀 Initialization Tests</h3>
260
+ <div class="test-controls">
261
+ <button id="init-basic-crypto" class="btn btn-primary">Initialize Basic Crypto</button>
262
+ <button id="init-with-credentials" class="btn btn-secondary">Initialize with Credentials</button>
263
+ <button id="reset-crypto" class="btn btn-danger">Reset Crypto</button>
264
+ <button id="run-self-test" class="btn btn-info">Run Self Test</button>
265
+ </div>
266
+
267
+ <div class="test-message-area">
268
+ <label for="user-alias">User Alias (for persistent identity):</label>
269
+ <input type="text" id="user-alias" placeholder="Enter username" style="margin: 5px 10px; padding: 5px;">
270
+
271
+ <label for="user-password">Password:</label>
272
+ <input type="password" id="user-password" placeholder="Enter password" style="margin: 5px 10px; padding: 5px;">
273
+ </div>
274
+
275
+ <div id="init-test-result" class="test-result"></div>
276
+ </div>
277
+
278
+ <!-- Mesh Integration Tests -->
279
+ <div class="test-section">
280
+ <h3>🌐 Mesh Integration Tests</h3>
281
+ <div class="test-controls">
282
+ <button id="init-mesh-with-crypto" class="btn btn-primary">Initialize Mesh with Crypto</button>
283
+ <button id="connect-mesh" class="btn btn-secondary">Connect to Mesh</button>
284
+ <button id="disconnect-mesh" class="btn btn-danger">Disconnect Mesh</button>
285
+ </div>
286
+
287
+ <div class="test-message-area">
288
+ <label for="signaling-url">Signaling Server URL:</label>
289
+ <input type="text" id="signaling-url" value="ws://localhost:3000" style="width: 300px; margin: 5px 10px; padding: 5px;">
290
+ </div>
291
+
292
+ <div id="mesh-test-result" class="test-result"></div>
293
+ </div>
294
+
295
+ <!-- Encryption/Decryption Tests -->
296
+ <div class="test-section">
297
+ <h3>🔒 Encryption/Decryption Tests</h3>
298
+ <div class="encryption-demo">
299
+ <div class="demo-panel">
300
+ <h4>Message Encryption</h4>
301
+ <textarea id="plaintext-message" placeholder="Enter message to encrypt...">Hello, encrypted world! This is a test message.</textarea>
302
+ <div class="test-controls">
303
+ <button id="encrypt-message" class="btn btn-primary">Encrypt Message</button>
304
+ <button id="sign-message" class="btn btn-secondary">Sign Message</button>
305
+ </div>
306
+ <div id="encryption-result" class="test-result"></div>
307
+ </div>
308
+
309
+ <div class="demo-panel">
310
+ <h4>Message Decryption</h4>
311
+ <textarea id="encrypted-message" placeholder="Encrypted message will appear here..."></textarea>
312
+ <div class="test-controls">
313
+ <button id="decrypt-message" class="btn btn-primary">Decrypt Message</button>
314
+ <button id="verify-signature" class="btn btn-secondary">Verify Signature</button>
315
+ </div>
316
+ <div id="decryption-result" class="test-result"></div>
317
+ </div>
318
+ </div>
319
+ </div>
320
+
321
+ <!-- Key Management Tests -->
322
+ <div class="test-section">
323
+ <h3>🗝️ Key Management Tests</h3>
324
+ <div class="test-controls">
325
+ <button id="generate-test-keypair" class="btn btn-primary">Generate Test Keypair</button>
326
+ <button id="export-public-key" class="btn btn-secondary">Export Public Key</button>
327
+ <button id="simulate-key-exchange" class="btn btn-info">Simulate Key Exchange</button>
328
+ <button id="generate-group-key" class="btn btn-warning">Generate Group Key</button>
329
+ </div>
330
+
331
+ <div class="test-message-area">
332
+ <label for="group-id">Group ID:</label>
333
+ <input type="text" id="group-id" value="test-group-1" style="margin: 5px 10px; padding: 5px;">
334
+
335
+ <label for="peer-public-key">Peer Public Key (for testing):</label>
336
+ <textarea id="peer-public-key" placeholder="Paste peer public key here..." style="height: 60px;"></textarea>
337
+ </div>
338
+
339
+ <div>
340
+ <h4>Stored Peer Keys:</h4>
341
+ <div id="peer-keys-list" class="peer-keys-list">
342
+ <div style="padding: 20px; text-align: center; color: #666;">No peer keys stored</div>
343
+ </div>
344
+ </div>
345
+
346
+ <div id="key-management-result" class="test-result"></div>
347
+ </div>
348
+
349
+ <!-- Group Encryption Tests -->
350
+ <div class="test-section">
351
+ <h3>👥 Group Encryption Tests</h3>
352
+ <div class="test-controls">
353
+ <button id="create-test-group" class="btn btn-primary">Create Test Group</button>
354
+ <button id="encrypt-group-message" class="btn btn-secondary">Encrypt for Group</button>
355
+ <button id="decrypt-group-message" class="btn btn-info">Decrypt Group Message</button>
356
+ </div>
357
+
358
+ <div class="test-message-area">
359
+ <textarea id="group-message" placeholder="Enter group message...">This is a secret group message!</textarea>
360
+ </div>
361
+
362
+ <div id="group-encryption-result" class="test-result"></div>
363
+ </div>
364
+
365
+ <!-- Performance Tests -->
366
+ <div class="test-section">
367
+ <h3>⚡ Performance Tests</h3>
368
+ <div class="test-controls">
369
+ <button id="benchmark-encryption" class="btn btn-primary">Benchmark Encryption</button>
370
+ <button id="benchmark-signing" class="btn btn-secondary">Benchmark Signing</button>
371
+ <button id="stress-test" class="btn btn-warning">Stress Test</button>
372
+ <button id="clear-metrics" class="btn btn-danger">Clear Metrics</button>
373
+ </div>
374
+
375
+ <div class="test-message-area">
376
+ <label for="benchmark-iterations">Iterations:</label>
377
+ <input type="number" id="benchmark-iterations" value="100" min="1" max="10000" style="margin: 5px 10px; padding: 5px;">
378
+
379
+ <label for="message-size">Message Size (chars):</label>
380
+ <input type="number" id="message-size" value="1000" min="10" max="100000" style="margin: 5px 10px; padding: 5px;">
381
+ </div>
382
+
383
+ <div id="performance-test-result" class="test-result"></div>
384
+ </div>
385
+
386
+ <!-- Real-time Messaging Tests -->
387
+ <div class="test-section">
388
+ <h3>💬 Real-time Encrypted Messaging Tests</h3>
389
+ <div class="test-controls">
390
+ <button id="send-encrypted-broadcast" class="btn btn-primary">Send Encrypted Broadcast</button>
391
+ <button id="send-encrypted-dm" class="btn btn-secondary">Send Encrypted DM</button>
392
+ <button id="toggle-auto-encrypt" class="btn btn-info">Toggle Auto-Encrypt</button>
393
+ </div>
394
+
395
+ <div class="test-message-area">
396
+ <label for="target-peer-id">Target Peer ID (for DM):</label>
397
+ <input type="text" id="target-peer-id" placeholder="Enter peer ID..." style="width: 300px; margin: 5px 10px; padding: 5px;">
398
+
399
+ <textarea id="real-time-message" placeholder="Enter message to send...">Hello encrypted mesh!</textarea>
400
+ </div>
401
+
402
+ <div>
403
+ <h4>Received Messages:</h4>
404
+ <div id="received-messages" class="test-result" style="max-height: 300px;">
405
+ <div style="padding: 20px; text-align: center; color: #666;">No messages received yet</div>
406
+ </div>
407
+ </div>
408
+ </div>
409
+
410
+ <!-- Debug and Diagnostics -->
411
+ <div class="test-section">
412
+ <h3>🐛 Debug and Diagnostics</h3>
413
+ <div class="test-controls">
414
+ <button id="dump-crypto-state" class="btn btn-primary">Dump Crypto State</button>
415
+ <button id="validate-setup" class="btn btn-secondary">Validate Setup</button>
416
+ <button id="test-compatibility" class="btn btn-info">Test Browser Compatibility</button>
417
+ <button id="generate-test-report" class="btn btn-success">Generate Test Report</button>
418
+ </div>
419
+
420
+ <div id="debug-result" class="test-result"></div>
421
+ </div>
422
+ </div>
423
+
424
+ <!-- Import the crypto test suite JavaScript -->
425
+ <script type="module" src="crypto-test.js"></script>
426
+ </body>
427
+ </html>
@@ -9,6 +9,8 @@
9
9
  <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
10
10
  <link rel="apple-touch-icon" href="assets/images/favicon.png">
11
11
  <link rel="shortcut icon" href="assets/images/favicon.png">
12
+ <!-- Load unsea crypto library from CDN for browser environment -->
13
+ <script src="https://cdn.jsdelivr.net/npm/unsea@1.3.0/dist/sea.min.js"></script>
12
14
  </head>
13
15
  <body>
14
16
  <div class="container">
@@ -323,6 +325,165 @@
323
325
  </div>
324
326
  </div>
325
327
 
328
+ <div class="crypto" aria-expanded="false">
329
+ <div class="section-header">
330
+ <h2>
331
+ <button id="crypto-toggle" class="toggle-btn" aria-expanded="false">
332
+ ▶ Crypto - End-to-End Encryption
333
+ </button>
334
+ </h2>
335
+ </div>
336
+ <div id="crypto-content" class="collapsible-content" style="display: none;">
337
+ <!-- Crypto Status -->
338
+ <div class="crypto-status">
339
+ <h3>Crypto Status</h3>
340
+ <div class="info-group">
341
+ <label>Encryption:</label>
342
+ <span id="crypto-status" class="status">Disabled</span>
343
+ </div>
344
+ <div class="info-group">
345
+ <label>Public Key:</label>
346
+ <code id="crypto-public-key">None</code>
347
+ </div>
348
+ <div class="info-group">
349
+ <label>Peer Keys:</label>
350
+ <span id="crypto-peer-count">0</span>
351
+ </div>
352
+ </div>
353
+
354
+ <!-- Key Management -->
355
+ <div class="crypto-keys">
356
+ <h3>Key Management</h3>
357
+ <div class="button-group">
358
+ <button id="crypto-generate-btn" class="btn primary">Generate New Keypair</button>
359
+ <button id="crypto-reset-btn" class="btn warning">Reset Crypto</button>
360
+ <button id="crypto-self-test-btn" class="btn tertiary">Run Self Test</button>
361
+ </div>
362
+
363
+ <div class="crypto-user-auth">
364
+ <h4>User Authentication (Optional)</h4>
365
+ <div class="input-group">
366
+ <label for="crypto-alias">Alias:</label>
367
+ <input type="text" id="crypto-alias" placeholder="Your username/alias">
368
+ </div>
369
+ <div class="input-group">
370
+ <label for="crypto-password">Password:</label>
371
+ <input type="password" id="crypto-password" placeholder="Your password">
372
+ </div>
373
+ <div class="button-group">
374
+ <button id="crypto-login-btn" class="btn secondary">Login/Create Account</button>
375
+ </div>
376
+ </div>
377
+ </div>
378
+
379
+ <!-- Message Encryption -->
380
+ <div class="crypto-messaging">
381
+ <h3>Encrypted Messaging</h3>
382
+ <div class="input-group">
383
+ <label class="checkbox-label">
384
+ <input type="checkbox" id="crypto-auto-encrypt">
385
+ <span class="checkmark"></span>
386
+ Auto-encrypt outgoing messages
387
+ </label>
388
+ </div>
389
+
390
+ <div class="crypto-test-messaging">
391
+ <h4>Test Encrypted Messages</h4>
392
+ <div class="input-group horizontal">
393
+ <input type="text" id="crypto-test-message" placeholder="Test message to encrypt">
394
+ <input type="text" id="crypto-test-peer" placeholder="Target peer ID" maxlength="40">
395
+ <button id="crypto-send-encrypted-btn" class="btn primary">Send Encrypted</button>
396
+ </div>
397
+ </div>
398
+ </div>
399
+
400
+ <!-- Group Encryption -->
401
+ <div class="crypto-groups">
402
+ <h3>Group Encryption</h3>
403
+ <div class="input-group horizontal">
404
+ <input type="text" id="crypto-group-id" placeholder="Group ID (e.g., 'chat-room-1')">
405
+ <button id="crypto-create-group-btn" class="btn secondary">Create Group Key</button>
406
+ </div>
407
+
408
+ <div class="crypto-group-messaging">
409
+ <div class="input-group horizontal">
410
+ <input type="text" id="crypto-group-message" placeholder="Group message">
411
+ <select id="crypto-group-select">
412
+ <option value="">Select group...</option>
413
+ </select>
414
+ <button id="crypto-send-group-btn" class="btn primary">Send to Group</button>
415
+ </div>
416
+ </div>
417
+
418
+ <div id="crypto-groups-list" class="crypto-groups-list">
419
+ <h4>Active Groups:</h4>
420
+ <div class="empty-state">No groups created</div>
421
+ </div>
422
+ </div>
423
+
424
+ <!-- Performance Stats -->
425
+ <div class="crypto-stats">
426
+ <h3>Performance Statistics</h3>
427
+ <div class="stats-grid">
428
+ <div class="stat-item">
429
+ <label>Messages Encrypted:</label>
430
+ <span id="crypto-stats-encrypted">0</span>
431
+ </div>
432
+ <div class="stat-item">
433
+ <label>Messages Decrypted:</label>
434
+ <span id="crypto-stats-decrypted">0</span>
435
+ </div>
436
+ <div class="stat-item">
437
+ <label>Encryption Time (avg):</label>
438
+ <span id="crypto-stats-encrypt-time">0ms</span>
439
+ </div>
440
+ <div class="stat-item">
441
+ <label>Decryption Time (avg):</label>
442
+ <span id="crypto-stats-decrypt-time">0ms</span>
443
+ </div>
444
+ <div class="stat-item">
445
+ <label>Key Exchanges:</label>
446
+ <span id="crypto-stats-key-exchanges">0</span>
447
+ </div>
448
+ </div>
449
+ </div>
450
+
451
+ <!-- Test Results -->
452
+ <div class="crypto-test-results">
453
+ <h3>Test Results</h3>
454
+ <div id="crypto-test-log" class="test-log">
455
+ <p class="empty-state">No tests run yet</p>
456
+ </div>
457
+ </div>
458
+
459
+ <!-- Advanced Operations -->
460
+ <div class="crypto-advanced">
461
+ <h3>Advanced Operations</h3>
462
+ <div class="button-group">
463
+ <button id="crypto-export-key-btn" class="btn quaternary">Export Public Key</button>
464
+ <button id="crypto-import-peer-key-btn" class="btn quaternary">Import Peer Key</button>
465
+ <button id="crypto-benchmark-btn" class="btn tertiary">Run Benchmark</button>
466
+ </div>
467
+
468
+ <!-- Import peer key form -->
469
+ <div id="crypto-import-form" class="crypto-import-form" style="display: none;">
470
+ <div class="input-group">
471
+ <label for="crypto-import-peer-id">Peer ID:</label>
472
+ <input type="text" id="crypto-import-peer-id" placeholder="40-character peer ID" maxlength="40">
473
+ </div>
474
+ <div class="input-group">
475
+ <label for="crypto-import-public-key">Public Key:</label>
476
+ <textarea id="crypto-import-public-key" placeholder="Paste public key here" rows="3"></textarea>
477
+ </div>
478
+ <div class="button-group">
479
+ <button id="crypto-import-confirm-btn" class="btn primary">Import Key</button>
480
+ <button id="crypto-import-cancel-btn" class="btn secondary">Cancel</button>
481
+ </div>
482
+ </div>
483
+ </div>
484
+ </div>
485
+ </div>
486
+
326
487
  <div class="messages">
327
488
  <h2>Messages</h2>
328
489
  <div class="input-group horizontal">