peerpigeon 0.1.1 → 1.0.2
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.
- package/README.md +141 -1365
- package/cli.js +1382 -0
- package/dist/peerpigeon-browser.js +12450 -0
- package/dist/peerpigeon-browser.js.map +7 -0
- package/docs/API_DOCUMENTATION.md +1976 -0
- package/docs/BOOTSTRAP_HUBS.md +319 -0
- package/docs/CLI_README.md +371 -0
- package/docs/CUSTOM_HUB_NAMESPACES.md +182 -0
- package/docs/CUSTOM_NAMESPACE_IMPLEMENTATION.md +187 -0
- package/docs/DOCUMENTATION_REORGANIZATION.md +172 -0
- package/docs/HUB_QUICK_REF.md +108 -0
- package/docs/HUB_SCRIPTS.md +341 -0
- package/docs/HUB_SYSTEM.md +599 -0
- package/docs/MIGRATION_COMPLETE.md +93 -0
- package/docs/NETWORK_NAMESPACES.md +212 -0
- package/docs/PIGEONRTC_MIGRATION.md +280 -0
- package/docs/README.md +108 -0
- package/docs/SELECTIVE_STREAMING_GUIDE.md +427 -0
- package/docs/TEST_CLEANUP_COMPLETE.md +80 -0
- package/examples/bootstrap-hub-example.js +292 -0
- package/examples/browser/README.md +278 -0
- package/examples/browser/app.js +2426 -49
- package/examples/browser/index.html +481 -630
- package/examples/browser/minimal/README.md +55 -0
- package/examples/browser/minimal/index.html +75 -0
- package/examples/browser/minimal/minimal.js +234 -0
- package/examples/browser/styles.css +687 -1425
- package/examples/browser/test-bundle.html +35 -0
- package/examples/browser-2/index.html +30 -0
- package/examples/browser-2/package.json +21 -0
- package/examples/browser-2/src/App-simple.vue +21 -0
- package/examples/browser-2/src/App.vue +420 -0
- package/examples/browser-2/src/components/CryptoView.vue +1661 -0
- package/examples/browser-2/src/components/DHTView.vue +1281 -0
- package/examples/browser-2/src/components/DebugView.vue +1773 -0
- package/examples/browser-2/src/components/MediaView.vue +1048 -0
- package/examples/browser-2/src/components/MessagingView.vue +775 -0
- package/examples/browser-2/src/components/NetworkView.vue +930 -0
- package/examples/browser-2/src/components/StorageView.vue +1376 -0
- package/examples/browser-2/src/main.js +5 -0
- package/examples/browser-2/src/stores/peerpigeon.js +895 -0
- package/examples/browser-2/vite.config.js +6 -0
- package/examples/hub-example.js +189 -0
- package/examples/multi-hub-test.js +186 -0
- package/examples/node/README.md +2 -2
- package/examples/programmatic-namespace-example.js +108 -0
- package/examples/selective-streaming-demo.html +698 -0
- package/examples/standard-events-demo.js +126 -0
- package/index.js +7 -1
- package/package.json +34 -16
- package/server/index.js +1058 -98
- package/server/start.js +52 -0
- package/src/ConnectionManager.js +239 -225
- package/src/CryptoManager.js +147 -18
- package/src/DebugLogger.js +0 -7
- package/src/DistributedStorageManager.js +224 -205
- package/src/EnvironmentDetector.js +88 -4
- package/src/EventEmitter.js +79 -1
- package/src/EvictionManager.js +10 -9
- package/src/GossipManager.js +163 -11
- package/src/MediaManager.js +12 -2
- package/src/PeerConnection.js +343 -311
- package/src/PeerPigeonMesh.js +576 -135
- package/src/PigeonRTC-browser.js +247 -0
- package/src/SignalingClient.js +14 -243
- package/src/SignalingHandler.js +31 -10
- package/src/StorageManager.js +0 -39
- package/src/WebDHT-Simple.js +389 -0
- package/src/WebDHT.js +363 -1165
- package/src/browser-entry.js +58 -0
- package/examples/browser/assets/images/favicon.png +0 -0
- package/examples/browser/assets/images/pigeon.png +0 -0
- package/examples/browser/crypto-test.html +0 -427
- package/examples/browser/ui-old.js +0 -1926
- package/examples/browser/ui.js +0 -3391
- package/websocket-server/README.md +0 -247
- package/websocket-server/server.js +0 -391
|
@@ -0,0 +1,1661 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="crypto-view">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<h2>🔐 Cryptographic Features</h2>
|
|
5
|
+
<p>Key management, encryption/decryption, and secure peer communications</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<!-- Crypto Operations -->
|
|
9
|
+
<div class="crypto-operations">
|
|
10
|
+
<h3>🔒 Cryptographic Operations</h3>
|
|
11
|
+
|
|
12
|
+
<div class="operation-tabs">
|
|
13
|
+
<button
|
|
14
|
+
@click="activeTab = 'keys'"
|
|
15
|
+
:class="['tab-btn', { active: activeTab === 'keys' }]"
|
|
16
|
+
>
|
|
17
|
+
KEY MANAGEMENT
|
|
18
|
+
</button>
|
|
19
|
+
<button
|
|
20
|
+
@click="activeTab = 'encrypt'"
|
|
21
|
+
:class="['tab-btn', { active: activeTab === 'encrypt' }]"
|
|
22
|
+
>
|
|
23
|
+
ENCRYPT/DECRYPT
|
|
24
|
+
</button>
|
|
25
|
+
<button
|
|
26
|
+
@click="activeTab = 'signatures'"
|
|
27
|
+
:class="['tab-btn', { active: activeTab === 'signatures' }]"
|
|
28
|
+
>
|
|
29
|
+
SIGNATURES
|
|
30
|
+
</button>
|
|
31
|
+
<button
|
|
32
|
+
@click="activeTab = 'exchange'"
|
|
33
|
+
:class="['tab-btn', { active: activeTab === 'exchange' }]"
|
|
34
|
+
>
|
|
35
|
+
KEY EXCHANGE
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- KEY MANAGEMENT -->
|
|
40
|
+
<div v-if="activeTab === 'keys'" class="operation-panel">
|
|
41
|
+
<h4>🔑 Key Management</h4>
|
|
42
|
+
<p class="operation-description">
|
|
43
|
+
Generate, import, export, and manage cryptographic keys. PeerPigeon supports multiple key types and algorithms.
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
<div class="key-generation">
|
|
47
|
+
<h5>Generate New Key Pair</h5>
|
|
48
|
+
<div class="form-group">
|
|
49
|
+
<label>Key Type:</label>
|
|
50
|
+
<select v-model="keyGenOptions.type" class="form-select">
|
|
51
|
+
<option value="RSA">RSA (Asymmetric)</option>
|
|
52
|
+
<option value="ECDSA">ECDSA (Elliptic Curve)</option>
|
|
53
|
+
<option value="Ed25519">Ed25519 (Edwards Curve)</option>
|
|
54
|
+
<option value="AES">AES (Symmetric)</option>
|
|
55
|
+
</select>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div class="form-group" v-if="keyGenOptions.type === 'RSA'">
|
|
59
|
+
<label>Key Size:</label>
|
|
60
|
+
<select v-model="keyGenOptions.size" class="form-select">
|
|
61
|
+
<option value="2048">2048 bits</option>
|
|
62
|
+
<option value="3072">3072 bits</option>
|
|
63
|
+
<option value="4096">4096 bits</option>
|
|
64
|
+
</select>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="form-group" v-if="keyGenOptions.type === 'AES'">
|
|
68
|
+
<label>Key Length:</label>
|
|
69
|
+
<select v-model="keyGenOptions.size" class="form-select">
|
|
70
|
+
<option value="128">128 bits</option>
|
|
71
|
+
<option value="192">192 bits</option>
|
|
72
|
+
<option value="256">256 bits</option>
|
|
73
|
+
</select>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="form-group">
|
|
77
|
+
<label>Key Name/Label:</label>
|
|
78
|
+
<input
|
|
79
|
+
v-model="keyGenOptions.name"
|
|
80
|
+
placeholder="e.g., my-signing-key, backup-key"
|
|
81
|
+
class="form-input"
|
|
82
|
+
>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<button
|
|
86
|
+
@click="generateKeyPair"
|
|
87
|
+
:disabled="!keyGenOptions.name || isGeneratingKey"
|
|
88
|
+
class="btn btn-primary"
|
|
89
|
+
>
|
|
90
|
+
<span class="btn-icon">🔑</span>
|
|
91
|
+
{{ isGeneratingKey ? 'Generating...' : 'Generate Key Pair' }}
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div class="key-import">
|
|
96
|
+
<h5>Import Existing Key</h5>
|
|
97
|
+
<div class="form-group">
|
|
98
|
+
<label>Key Data (PEM/JWK format):</label>
|
|
99
|
+
<textarea
|
|
100
|
+
v-model="importKeyData"
|
|
101
|
+
placeholder="-----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY-----"
|
|
102
|
+
rows="8"
|
|
103
|
+
class="form-textarea"
|
|
104
|
+
></textarea>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div class="form-group">
|
|
108
|
+
<label>Key Name:</label>
|
|
109
|
+
<input
|
|
110
|
+
v-model="importKeyName"
|
|
111
|
+
placeholder="imported-key"
|
|
112
|
+
class="form-input"
|
|
113
|
+
>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<button
|
|
117
|
+
@click="importKey"
|
|
118
|
+
:disabled="!importKeyData || !importKeyName"
|
|
119
|
+
class="btn btn-secondary"
|
|
120
|
+
>
|
|
121
|
+
<span class="btn-icon">📥</span>
|
|
122
|
+
Import Key
|
|
123
|
+
</button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<!-- ENCRYPT/DECRYPT -->
|
|
128
|
+
<div v-if="activeTab === 'encrypt'" class="operation-panel">
|
|
129
|
+
<h4>🔒 Encryption & Decryption</h4>
|
|
130
|
+
<p class="operation-description">
|
|
131
|
+
Encrypt and decrypt data using various algorithms. Supports both symmetric and asymmetric encryption.
|
|
132
|
+
</p>
|
|
133
|
+
|
|
134
|
+
<div class="encrypt-section">
|
|
135
|
+
<h5>Encrypt Data</h5>
|
|
136
|
+
<div class="form-group">
|
|
137
|
+
<label>Data to Encrypt:</label>
|
|
138
|
+
<textarea
|
|
139
|
+
v-model="encryptData"
|
|
140
|
+
placeholder="Enter text or JSON data to encrypt"
|
|
141
|
+
rows="4"
|
|
142
|
+
class="form-textarea"
|
|
143
|
+
></textarea>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div class="form-group">
|
|
147
|
+
<label>Encryption Key:</label>
|
|
148
|
+
<select v-model="selectedEncryptKey" class="form-select">
|
|
149
|
+
<option value="">Select a key...</option>
|
|
150
|
+
<option
|
|
151
|
+
v-for="key in availableKeys"
|
|
152
|
+
:key="key.id"
|
|
153
|
+
:value="key.id"
|
|
154
|
+
>
|
|
155
|
+
{{ key.name }} ({{ key.type }})
|
|
156
|
+
</option>
|
|
157
|
+
</select>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="form-group">
|
|
161
|
+
<label>Algorithm:</label>
|
|
162
|
+
<select v-model="encryptOptions.algorithm" class="form-select">
|
|
163
|
+
<option value="RSA-OAEP">RSA-OAEP</option>
|
|
164
|
+
<option value="AES-GCM">AES-GCM</option>
|
|
165
|
+
<option value="AES-CBC">AES-CBC</option>
|
|
166
|
+
</select>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<button
|
|
170
|
+
@click="performEncryption"
|
|
171
|
+
:disabled="!encryptData || !selectedEncryptKey"
|
|
172
|
+
class="btn btn-primary"
|
|
173
|
+
>
|
|
174
|
+
<span class="btn-icon">🔒</span>
|
|
175
|
+
Encrypt Data
|
|
176
|
+
</button>
|
|
177
|
+
|
|
178
|
+
<div v-if="encryptedResult" class="result-panel">
|
|
179
|
+
<h6>Encrypted Result:</h6>
|
|
180
|
+
<pre class="result-content">{{ encryptedResult }}</pre>
|
|
181
|
+
<button @click="copyToClipboard(encryptedResult)" class="btn btn-sm btn-secondary">
|
|
182
|
+
<span class="btn-icon">📋</span>
|
|
183
|
+
Copy
|
|
184
|
+
</button>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div class="decrypt-section">
|
|
189
|
+
<h5>Decrypt Data</h5>
|
|
190
|
+
<div class="form-group">
|
|
191
|
+
<label>Encrypted Data:</label>
|
|
192
|
+
<textarea
|
|
193
|
+
v-model="decryptData"
|
|
194
|
+
placeholder="Paste encrypted data here"
|
|
195
|
+
rows="4"
|
|
196
|
+
class="form-textarea"
|
|
197
|
+
></textarea>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="form-group">
|
|
201
|
+
<label>Decryption Key:</label>
|
|
202
|
+
<select v-model="selectedDecryptKey" class="form-select">
|
|
203
|
+
<option value="">Select a key...</option>
|
|
204
|
+
<option
|
|
205
|
+
v-for="key in availableKeys"
|
|
206
|
+
:key="key.id"
|
|
207
|
+
:value="key.id"
|
|
208
|
+
>
|
|
209
|
+
{{ key.name }} ({{ key.type }})
|
|
210
|
+
</option>
|
|
211
|
+
</select>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<button
|
|
215
|
+
@click="performDecryption"
|
|
216
|
+
:disabled="!decryptData || !selectedDecryptKey"
|
|
217
|
+
class="btn btn-primary"
|
|
218
|
+
>
|
|
219
|
+
<span class="btn-icon">🔓</span>
|
|
220
|
+
Decrypt Data
|
|
221
|
+
</button>
|
|
222
|
+
|
|
223
|
+
<div v-if="decryptedResult" class="result-panel">
|
|
224
|
+
<h6>Decrypted Result:</h6>
|
|
225
|
+
<pre class="result-content">{{ decryptedResult }}</pre>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<!-- SIGNATURES -->
|
|
231
|
+
<div v-if="activeTab === 'signatures'" class="operation-panel">
|
|
232
|
+
<h4>✍️ Digital Signatures</h4>
|
|
233
|
+
<p class="operation-description">
|
|
234
|
+
Create and verify digital signatures to ensure data integrity and authenticity.
|
|
235
|
+
</p>
|
|
236
|
+
|
|
237
|
+
<div class="sign-section">
|
|
238
|
+
<h5>Sign Data</h5>
|
|
239
|
+
<div class="form-group">
|
|
240
|
+
<label>Data to Sign:</label>
|
|
241
|
+
<textarea
|
|
242
|
+
v-model="signData"
|
|
243
|
+
placeholder="Enter data to create a digital signature"
|
|
244
|
+
rows="4"
|
|
245
|
+
class="form-textarea"
|
|
246
|
+
></textarea>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
<div class="form-group">
|
|
250
|
+
<label>Signing Key:</label>
|
|
251
|
+
<select v-model="selectedSignKey" class="form-select">
|
|
252
|
+
<option value="">Select a signing key...</option>
|
|
253
|
+
<option
|
|
254
|
+
v-for="key in signingKeys"
|
|
255
|
+
:key="key.id"
|
|
256
|
+
:value="key.id"
|
|
257
|
+
>
|
|
258
|
+
{{ key.name }} ({{ key.type }})
|
|
259
|
+
</option>
|
|
260
|
+
</select>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div class="form-group">
|
|
264
|
+
<label>Hash Algorithm:</label>
|
|
265
|
+
<select v-model="signOptions.hashAlg" class="form-select">
|
|
266
|
+
<option value="SHA-256">SHA-256</option>
|
|
267
|
+
<option value="SHA-384">SHA-384</option>
|
|
268
|
+
<option value="SHA-512">SHA-512</option>
|
|
269
|
+
</select>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<button
|
|
273
|
+
@click="signData"
|
|
274
|
+
:disabled="!signData || !selectedSignKey"
|
|
275
|
+
class="btn btn-primary"
|
|
276
|
+
>
|
|
277
|
+
<span class="btn-icon">✍️</span>
|
|
278
|
+
Sign Data
|
|
279
|
+
</button>
|
|
280
|
+
|
|
281
|
+
<div v-if="signatureResult" class="result-panel">
|
|
282
|
+
<h6>Digital Signature:</h6>
|
|
283
|
+
<pre class="result-content">{{ signatureResult }}</pre>
|
|
284
|
+
<button @click="copyToClipboard(signatureResult)" class="btn btn-sm btn-secondary">
|
|
285
|
+
<span class="btn-icon">📋</span>
|
|
286
|
+
Copy Signature
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<div class="verify-section">
|
|
292
|
+
<h5>Verify Signature</h5>
|
|
293
|
+
<div class="form-group">
|
|
294
|
+
<label>Original Data:</label>
|
|
295
|
+
<textarea
|
|
296
|
+
v-model="verifyData"
|
|
297
|
+
placeholder="Enter the original data"
|
|
298
|
+
rows="4"
|
|
299
|
+
class="form-textarea"
|
|
300
|
+
></textarea>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<div class="form-group">
|
|
304
|
+
<label>Signature:</label>
|
|
305
|
+
<textarea
|
|
306
|
+
v-model="verifySignature"
|
|
307
|
+
placeholder="Paste the signature to verify"
|
|
308
|
+
rows="3"
|
|
309
|
+
class="form-textarea"
|
|
310
|
+
></textarea>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<div class="form-group">
|
|
314
|
+
<label>Verification Key:</label>
|
|
315
|
+
<select v-model="selectedVerifyKey" class="form-select">
|
|
316
|
+
<option value="">Select a public key...</option>
|
|
317
|
+
<option
|
|
318
|
+
v-for="key in publicKeys"
|
|
319
|
+
:key="key.id"
|
|
320
|
+
:value="key.id"
|
|
321
|
+
>
|
|
322
|
+
{{ key.name }} ({{ key.type }})
|
|
323
|
+
</option>
|
|
324
|
+
</select>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<button
|
|
328
|
+
@click="verifySignature"
|
|
329
|
+
:disabled="!verifyData || !verifySignature || !selectedVerifyKey"
|
|
330
|
+
class="btn btn-primary"
|
|
331
|
+
>
|
|
332
|
+
<span class="btn-icon">✅</span>
|
|
333
|
+
Verify Signature
|
|
334
|
+
</button>
|
|
335
|
+
|
|
336
|
+
<div v-if="verificationResult !== null" class="result-panel">
|
|
337
|
+
<div :class="['verification-result', verificationResult ? 'valid' : 'invalid']">
|
|
338
|
+
<span class="result-icon">{{ verificationResult ? '✅' : '❌' }}</span>
|
|
339
|
+
<span>{{ verificationResult ? 'Signature Valid' : 'Signature Invalid' }}</span>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<!-- KEY EXCHANGE -->
|
|
346
|
+
<div v-if="activeTab === 'exchange'" class="operation-panel">
|
|
347
|
+
<h4>🤝 Key Exchange</h4>
|
|
348
|
+
<p class="operation-description">
|
|
349
|
+
Securely exchange keys with peers using Diffie-Hellman key exchange and establish shared secrets.
|
|
350
|
+
</p>
|
|
351
|
+
|
|
352
|
+
<div class="exchange-section">
|
|
353
|
+
<h5>Initiate Key Exchange</h5>
|
|
354
|
+
<div class="form-group">
|
|
355
|
+
<label>Target Peer:</label>
|
|
356
|
+
<select v-model="selectedExchangePeer" class="form-select">
|
|
357
|
+
<option value="">Select a peer...</option>
|
|
358
|
+
<option
|
|
359
|
+
v-for="peer in connectedPeersList"
|
|
360
|
+
:key="peer.id"
|
|
361
|
+
:value="peer.id"
|
|
362
|
+
>
|
|
363
|
+
{{ peer.id.substring(0, 16) }}... ({{ peer.status }})
|
|
364
|
+
</option>
|
|
365
|
+
</select>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
<div class="form-group">
|
|
369
|
+
<label>Key Exchange Method:</label>
|
|
370
|
+
<select v-model="exchangeOptions.method" class="form-select">
|
|
371
|
+
<option value="ECDH">ECDH (Elliptic Curve Diffie-Hellman)</option>
|
|
372
|
+
<option value="DH">DH (Classical Diffie-Hellman)</option>
|
|
373
|
+
<option value="X25519">X25519 (Curve25519)</option>
|
|
374
|
+
</select>
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div class="form-group">
|
|
378
|
+
<label>Exchange Purpose:</label>
|
|
379
|
+
<input
|
|
380
|
+
v-model="exchangeOptions.purpose"
|
|
381
|
+
placeholder="e.g., secure-channel, file-encryption"
|
|
382
|
+
class="form-input"
|
|
383
|
+
>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
<button
|
|
387
|
+
@click="initiateKeyExchange"
|
|
388
|
+
:disabled="!selectedExchangePeer || !exchangeOptions.purpose"
|
|
389
|
+
class="btn btn-primary"
|
|
390
|
+
>
|
|
391
|
+
<span class="btn-icon">🤝</span>
|
|
392
|
+
Initiate Exchange
|
|
393
|
+
</button>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<div class="shared-secrets">
|
|
397
|
+
<h5>Established Shared Secrets</h5>
|
|
398
|
+
<div v-if="sharedSecrets.length === 0" class="empty-secrets">
|
|
399
|
+
<div class="empty-icon">🔐</div>
|
|
400
|
+
<p>No shared secrets established</p>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
<div v-else class="secrets-list">
|
|
404
|
+
<div
|
|
405
|
+
v-for="secret in sharedSecrets"
|
|
406
|
+
:key="secret.id"
|
|
407
|
+
class="secret-item"
|
|
408
|
+
>
|
|
409
|
+
<div class="secret-header">
|
|
410
|
+
<h6>{{ secret.purpose }}</h6>
|
|
411
|
+
<div class="secret-badges">
|
|
412
|
+
<span class="badge badge-method">{{ secret.method }}</span>
|
|
413
|
+
<span class="badge badge-status">{{ secret.status }}</span>
|
|
414
|
+
</div>
|
|
415
|
+
</div>
|
|
416
|
+
|
|
417
|
+
<div class="secret-details">
|
|
418
|
+
<div class="secret-peer">Peer: {{ secret.peerId.substring(0, 16) }}...</div>
|
|
419
|
+
<div class="secret-created">Created: {{ formatTime(secret.created) }}</div>
|
|
420
|
+
<div class="secret-key">Key: {{ secret.keyId }}</div>
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
<div class="secret-actions">
|
|
424
|
+
<button @click="useSharedSecret(secret)" class="btn btn-sm btn-primary">
|
|
425
|
+
<span class="btn-icon">🔓</span>
|
|
426
|
+
Use for Encryption
|
|
427
|
+
</button>
|
|
428
|
+
<button @click="revokeSharedSecret(secret.id)" class="btn btn-sm btn-danger">
|
|
429
|
+
<span class="btn-icon">🗑️</span>
|
|
430
|
+
Revoke
|
|
431
|
+
</button>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<!-- Key Management Display -->
|
|
440
|
+
<div class="key-management-display">
|
|
441
|
+
<div class="section-title">
|
|
442
|
+
<h3>🗝️ Key Store ({{ cryptoKeys.length }})</h3>
|
|
443
|
+
<div class="key-controls">
|
|
444
|
+
<button @click="refreshKeys" class="btn btn-secondary">
|
|
445
|
+
<span class="btn-icon">🔄</span>
|
|
446
|
+
Refresh
|
|
447
|
+
</button>
|
|
448
|
+
<button @click="exportKeys" class="btn btn-secondary">
|
|
449
|
+
<span class="btn-icon">📤</span>
|
|
450
|
+
Export
|
|
451
|
+
</button>
|
|
452
|
+
<button @click="clearKeys" class="btn btn-danger">
|
|
453
|
+
<span class="btn-icon">🗑️</span>
|
|
454
|
+
Clear All
|
|
455
|
+
</button>
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
<div v-if="cryptoKeys.length === 0" class="empty-keys">
|
|
460
|
+
<div class="empty-icon">🔑</div>
|
|
461
|
+
<p>No keys in store</p>
|
|
462
|
+
<p class="empty-meta">Generate or import keys using the operations above</p>
|
|
463
|
+
</div>
|
|
464
|
+
|
|
465
|
+
<div v-else class="keys-grid">
|
|
466
|
+
<div
|
|
467
|
+
v-for="key in cryptoKeys"
|
|
468
|
+
:key="key.id"
|
|
469
|
+
class="key-item"
|
|
470
|
+
>
|
|
471
|
+
<div class="key-header">
|
|
472
|
+
<h4 class="key-name">{{ key.name }}</h4>
|
|
473
|
+
<div class="key-badges">
|
|
474
|
+
<span class="badge badge-type">{{ key.type }}</span>
|
|
475
|
+
<span v-if="key.usage.includes('sign')" class="badge badge-usage">Signing</span>
|
|
476
|
+
<span v-if="key.usage.includes('encrypt')" class="badge badge-usage">Encryption</span>
|
|
477
|
+
<span v-if="key.extractable" class="badge badge-extractable">Extractable</span>
|
|
478
|
+
</div>
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
<div class="key-details">
|
|
482
|
+
<div class="key-id">ID: {{ key.id.substring(0, 16) }}...</div>
|
|
483
|
+
<div class="key-algorithm">Algorithm: {{ key.algorithm }}</div>
|
|
484
|
+
<div v-if="key.size" class="key-size">Size: {{ key.size }} bits</div>
|
|
485
|
+
<div class="key-created">Created: {{ formatTime(key.created) }}</div>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<div class="key-fingerprint">
|
|
489
|
+
<label>Fingerprint:</label>
|
|
490
|
+
<code class="fingerprint">{{ key.fingerprint }}</code>
|
|
491
|
+
</div>
|
|
492
|
+
|
|
493
|
+
<div class="key-actions">
|
|
494
|
+
<button
|
|
495
|
+
v-if="key.extractable"
|
|
496
|
+
@click="exportKey(key)"
|
|
497
|
+
class="btn btn-sm btn-secondary"
|
|
498
|
+
>
|
|
499
|
+
<span class="btn-icon">📤</span>
|
|
500
|
+
Export
|
|
501
|
+
</button>
|
|
502
|
+
<button @click="copyKeyId(key.id)" class="btn btn-sm btn-secondary">
|
|
503
|
+
<span class="btn-icon">📋</span>
|
|
504
|
+
Copy ID
|
|
505
|
+
</button>
|
|
506
|
+
<button @click="viewKeyDetails(key)" class="btn btn-sm btn-info">
|
|
507
|
+
<span class="btn-icon">🔍</span>
|
|
508
|
+
Details
|
|
509
|
+
</button>
|
|
510
|
+
<button @click="deleteKey(key.id)" class="btn btn-sm btn-danger">
|
|
511
|
+
<span class="btn-icon">🗑️</span>
|
|
512
|
+
Delete
|
|
513
|
+
</button>
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
|
|
519
|
+
<!-- Crypto Statistics -->
|
|
520
|
+
<div class="crypto-stats">
|
|
521
|
+
<h3>📊 Cryptographic Statistics</h3>
|
|
522
|
+
<div class="stats-grid">
|
|
523
|
+
<div class="stat-card">
|
|
524
|
+
<div class="stat-icon">🔑</div>
|
|
525
|
+
<div class="stat-content">
|
|
526
|
+
<h4>Total Keys</h4>
|
|
527
|
+
<div class="stat-value">{{ cryptoKeys.length }}</div>
|
|
528
|
+
<div class="stat-meta">In key store</div>
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
|
|
532
|
+
<div class="stat-card">
|
|
533
|
+
<div class="stat-icon">🔒</div>
|
|
534
|
+
<div class="stat-content">
|
|
535
|
+
<h4>Encryption Ops</h4>
|
|
536
|
+
<div class="stat-value">{{ encryptionCount }}</div>
|
|
537
|
+
<div class="stat-meta">Total performed</div>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
|
|
541
|
+
<div class="stat-card">
|
|
542
|
+
<div class="stat-icon">✍️</div>
|
|
543
|
+
<div class="stat-content">
|
|
544
|
+
<h4>Signatures</h4>
|
|
545
|
+
<div class="stat-value">{{ signatureCount }}</div>
|
|
546
|
+
<div class="stat-meta">Created & verified</div>
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
|
|
550
|
+
<div class="stat-card">
|
|
551
|
+
<div class="stat-icon">🤝</div>
|
|
552
|
+
<div class="stat-content">
|
|
553
|
+
<h4>Key Exchanges</h4>
|
|
554
|
+
<div class="stat-value">{{ sharedSecrets.length }}</div>
|
|
555
|
+
<div class="stat-meta">Active sessions</div>
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
558
|
+
</div>
|
|
559
|
+
</div>
|
|
560
|
+
|
|
561
|
+
<!-- Quick Crypto Actions -->
|
|
562
|
+
<div class="quick-actions">
|
|
563
|
+
<h3>⚡ Quick Cryptographic Actions</h3>
|
|
564
|
+
<div class="action-buttons">
|
|
565
|
+
<button @click="generateTestKeys" class="btn btn-secondary">
|
|
566
|
+
<span class="btn-icon">🔑</span>
|
|
567
|
+
Generate Test Keys
|
|
568
|
+
</button>
|
|
569
|
+
|
|
570
|
+
<button @click="performEncryptionTest" class="btn btn-secondary">
|
|
571
|
+
<span class="btn-icon">🔒</span>
|
|
572
|
+
Test Encryption
|
|
573
|
+
</button>
|
|
574
|
+
|
|
575
|
+
<button @click="performSigningTest" class="btn btn-secondary">
|
|
576
|
+
<span class="btn-icon">✍️</span>
|
|
577
|
+
Test Signing
|
|
578
|
+
</button>
|
|
579
|
+
|
|
580
|
+
<button @click="demonstrateKeyExchange" class="btn btn-secondary">
|
|
581
|
+
<span class="btn-icon">🤝</span>
|
|
582
|
+
Demo Key Exchange
|
|
583
|
+
</button>
|
|
584
|
+
|
|
585
|
+
<button @click="benchmarkCrypto" class="btn btn-secondary">
|
|
586
|
+
<span class="btn-icon">⏱️</span>
|
|
587
|
+
Benchmark Performance
|
|
588
|
+
</button>
|
|
589
|
+
|
|
590
|
+
<button @click="validateCryptoSupport" class="btn btn-secondary">
|
|
591
|
+
<span class="btn-icon">✅</span>
|
|
592
|
+
Validate Support
|
|
593
|
+
</button>
|
|
594
|
+
</div>
|
|
595
|
+
</div>
|
|
596
|
+
</div>
|
|
597
|
+
</template>
|
|
598
|
+
|
|
599
|
+
<script setup>
|
|
600
|
+
import { ref, computed, onMounted } from 'vue';
|
|
601
|
+
import { usePeerPigeonStore } from '../stores/peerpigeon.js';
|
|
602
|
+
|
|
603
|
+
const store = usePeerPigeonStore();
|
|
604
|
+
|
|
605
|
+
// Local reactive state
|
|
606
|
+
const activeTab = ref('keys');
|
|
607
|
+
|
|
608
|
+
// Key generation
|
|
609
|
+
const keyGenOptions = ref({
|
|
610
|
+
type: 'RSA',
|
|
611
|
+
size: 2048,
|
|
612
|
+
name: ''
|
|
613
|
+
});
|
|
614
|
+
const isGeneratingKey = ref(false);
|
|
615
|
+
|
|
616
|
+
// Key import
|
|
617
|
+
const importKeyData = ref('');
|
|
618
|
+
const importKeyName = ref('');
|
|
619
|
+
|
|
620
|
+
// Encryption/Decryption
|
|
621
|
+
const encryptData = ref('');
|
|
622
|
+
const selectedEncryptKey = ref('');
|
|
623
|
+
const encryptOptions = ref({
|
|
624
|
+
algorithm: 'RSA-OAEP'
|
|
625
|
+
});
|
|
626
|
+
const encryptedResult = ref('');
|
|
627
|
+
|
|
628
|
+
const decryptData = ref('');
|
|
629
|
+
const selectedDecryptKey = ref('');
|
|
630
|
+
const decryptedResult = ref('');
|
|
631
|
+
|
|
632
|
+
// Signatures
|
|
633
|
+
const signData = ref('');
|
|
634
|
+
const selectedSignKey = ref('');
|
|
635
|
+
const signOptions = ref({
|
|
636
|
+
hashAlg: 'SHA-256'
|
|
637
|
+
});
|
|
638
|
+
const signatureResult = ref('');
|
|
639
|
+
|
|
640
|
+
const verifyData = ref('');
|
|
641
|
+
const verifySignature = ref('');
|
|
642
|
+
const selectedVerifyKey = ref('');
|
|
643
|
+
const verificationResult = ref(null);
|
|
644
|
+
|
|
645
|
+
// Key Exchange
|
|
646
|
+
const selectedExchangePeer = ref('');
|
|
647
|
+
const exchangeOptions = ref({
|
|
648
|
+
method: 'ECDH',
|
|
649
|
+
purpose: ''
|
|
650
|
+
});
|
|
651
|
+
const sharedSecrets = ref([]);
|
|
652
|
+
|
|
653
|
+
// Crypto statistics
|
|
654
|
+
const encryptionCount = ref(0);
|
|
655
|
+
const signatureCount = ref(0);
|
|
656
|
+
|
|
657
|
+
// Computed properties
|
|
658
|
+
const cryptoKeys = computed(() => store.cryptoKeys);
|
|
659
|
+
const connectedPeersList = computed(() => store.connectedPeersList);
|
|
660
|
+
|
|
661
|
+
const availableKeys = computed(() => {
|
|
662
|
+
return cryptoKeys.value.filter(key =>
|
|
663
|
+
key.usage.includes('encrypt') || key.usage.includes('decrypt')
|
|
664
|
+
);
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
const signingKeys = computed(() => {
|
|
668
|
+
return cryptoKeys.value.filter(key => key.usage.includes('sign'));
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
const publicKeys = computed(() => {
|
|
672
|
+
return cryptoKeys.value.filter(key => key.usage.includes('verify'));
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
// Methods
|
|
676
|
+
const generateKeyPair = async () => {
|
|
677
|
+
isGeneratingKey.value = true;
|
|
678
|
+
try {
|
|
679
|
+
const keyPair = await store.cryptoGenerateKey(
|
|
680
|
+
keyGenOptions.value.type,
|
|
681
|
+
keyGenOptions.value.size,
|
|
682
|
+
keyGenOptions.value.name
|
|
683
|
+
);
|
|
684
|
+
|
|
685
|
+
if (keyPair) {
|
|
686
|
+
store.addDebugLog(`Generated ${keyGenOptions.value.type} key pair: ${keyGenOptions.value.name}`, 'success');
|
|
687
|
+
keyGenOptions.value.name = '';
|
|
688
|
+
}
|
|
689
|
+
} catch (error) {
|
|
690
|
+
store.addDebugLog(`Key generation failed: ${error.message}`, 'error');
|
|
691
|
+
} finally {
|
|
692
|
+
isGeneratingKey.value = false;
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
const importKey = async () => {
|
|
697
|
+
try {
|
|
698
|
+
const success = await store.cryptoImportKey(importKeyData.value, importKeyName.value);
|
|
699
|
+
if (success) {
|
|
700
|
+
store.addDebugLog(`Imported key: ${importKeyName.value}`, 'success');
|
|
701
|
+
importKeyData.value = '';
|
|
702
|
+
importKeyName.value = '';
|
|
703
|
+
}
|
|
704
|
+
} catch (error) {
|
|
705
|
+
store.addDebugLog(`Key import failed: ${error.message}`, 'error');
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
const performEncryption = async () => {
|
|
710
|
+
try {
|
|
711
|
+
const result = await store.cryptoEncrypt(
|
|
712
|
+
encryptData.value,
|
|
713
|
+
selectedEncryptKey.value,
|
|
714
|
+
encryptOptions.value
|
|
715
|
+
);
|
|
716
|
+
|
|
717
|
+
if (result) {
|
|
718
|
+
encryptedResult.value = result;
|
|
719
|
+
encryptionCount.value++;
|
|
720
|
+
store.addDebugLog('Encryption successful', 'success');
|
|
721
|
+
}
|
|
722
|
+
} catch (error) {
|
|
723
|
+
store.addDebugLog(`Encryption failed: ${error.message}`, 'error');
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
const performDecryption = async () => {
|
|
728
|
+
try {
|
|
729
|
+
const result = await store.cryptoDecrypt(
|
|
730
|
+
decryptData.value,
|
|
731
|
+
selectedDecryptKey.value
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
if (result) {
|
|
735
|
+
decryptedResult.value = result;
|
|
736
|
+
store.addDebugLog('Decryption successful', 'success');
|
|
737
|
+
}
|
|
738
|
+
} catch (error) {
|
|
739
|
+
store.addDebugLog(`Decryption failed: ${error.message}`, 'error');
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
const signData = async () => {
|
|
744
|
+
try {
|
|
745
|
+
const signature = await store.cryptoSign(
|
|
746
|
+
signData.value,
|
|
747
|
+
selectedSignKey.value,
|
|
748
|
+
signOptions.value
|
|
749
|
+
);
|
|
750
|
+
|
|
751
|
+
if (signature) {
|
|
752
|
+
signatureResult.value = signature;
|
|
753
|
+
signatureCount.value++;
|
|
754
|
+
store.addDebugLog('Data signing successful', 'success');
|
|
755
|
+
}
|
|
756
|
+
} catch (error) {
|
|
757
|
+
store.addDebugLog(`Signing failed: ${error.message}`, 'error');
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
const verifySignature = async () => {
|
|
762
|
+
try {
|
|
763
|
+
const isValid = await store.cryptoVerify(
|
|
764
|
+
verifyData.value,
|
|
765
|
+
verifySignature.value,
|
|
766
|
+
selectedVerifyKey.value
|
|
767
|
+
);
|
|
768
|
+
|
|
769
|
+
verificationResult.value = isValid;
|
|
770
|
+
signatureCount.value++;
|
|
771
|
+
|
|
772
|
+
const message = isValid ? 'Signature verification successful' : 'Signature verification failed';
|
|
773
|
+
const level = isValid ? 'success' : 'warning';
|
|
774
|
+
store.addDebugLog(message, level);
|
|
775
|
+
} catch (error) {
|
|
776
|
+
verificationResult.value = false;
|
|
777
|
+
store.addDebugLog(`Signature verification error: ${error.message}`, 'error');
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
const initiateKeyExchange = async () => {
|
|
782
|
+
try {
|
|
783
|
+
const exchange = await store.cryptoKeyExchange(
|
|
784
|
+
selectedExchangePeer.value,
|
|
785
|
+
exchangeOptions.value.method,
|
|
786
|
+
exchangeOptions.value.purpose
|
|
787
|
+
);
|
|
788
|
+
|
|
789
|
+
if (exchange) {
|
|
790
|
+
sharedSecrets.value.push({
|
|
791
|
+
id: Date.now().toString(),
|
|
792
|
+
peerId: selectedExchangePeer.value,
|
|
793
|
+
method: exchangeOptions.value.method,
|
|
794
|
+
purpose: exchangeOptions.value.purpose,
|
|
795
|
+
keyId: exchange.keyId,
|
|
796
|
+
status: 'active',
|
|
797
|
+
created: Date.now()
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
store.addDebugLog(`Key exchange initiated with ${selectedExchangePeer.value.substring(0, 8)}...`, 'success');
|
|
801
|
+
selectedExchangePeer.value = '';
|
|
802
|
+
exchangeOptions.value.purpose = '';
|
|
803
|
+
}
|
|
804
|
+
} catch (error) {
|
|
805
|
+
store.addDebugLog(`Key exchange failed: ${error.message}`, 'error');
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
const useSharedSecret = (secret) => {
|
|
810
|
+
selectedEncryptKey.value = secret.keyId;
|
|
811
|
+
activeTab.value = 'encrypt';
|
|
812
|
+
store.addDebugLog(`Using shared secret for encryption: ${secret.purpose}`, 'info');
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
const revokeSharedSecret = (secretId) => {
|
|
816
|
+
const index = sharedSecrets.value.findIndex(s => s.id === secretId);
|
|
817
|
+
if (index !== -1) {
|
|
818
|
+
sharedSecrets.value.splice(index, 1);
|
|
819
|
+
store.addDebugLog('Shared secret revoked', 'info');
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
const refreshKeys = async () => {
|
|
824
|
+
try {
|
|
825
|
+
await store.cryptoRefreshKeys();
|
|
826
|
+
store.addDebugLog('Key store refreshed', 'success');
|
|
827
|
+
} catch (error) {
|
|
828
|
+
store.addDebugLog(`Failed to refresh keys: ${error.message}`, 'error');
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
const exportKeys = () => {
|
|
833
|
+
const exportData = {
|
|
834
|
+
keys: cryptoKeys.value.filter(key => key.extractable),
|
|
835
|
+
exported: Date.now(),
|
|
836
|
+
version: '1.0'
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
const dataStr = JSON.stringify(exportData, null, 2);
|
|
840
|
+
const dataBlob = new Blob([dataStr], { type: 'application/json' });
|
|
841
|
+
const url = URL.createObjectURL(dataBlob);
|
|
842
|
+
|
|
843
|
+
const a = document.createElement('a');
|
|
844
|
+
a.href = url;
|
|
845
|
+
a.download = `peerpigeon-keys-${Date.now()}.json`;
|
|
846
|
+
document.body.appendChild(a);
|
|
847
|
+
a.click();
|
|
848
|
+
document.body.removeChild(a);
|
|
849
|
+
URL.revokeObjectURL(url);
|
|
850
|
+
|
|
851
|
+
store.addDebugLog('Keys exported', 'success');
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
const clearKeys = () => {
|
|
855
|
+
if (confirm('Are you sure you want to clear all keys? This cannot be undone.')) {
|
|
856
|
+
store.cryptoKeys.splice(0);
|
|
857
|
+
store.addDebugLog('All keys cleared', 'warning');
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
const exportKey = async (key) => {
|
|
862
|
+
try {
|
|
863
|
+
const exported = await store.cryptoExportKey(key.id);
|
|
864
|
+
if (exported) {
|
|
865
|
+
const dataStr = JSON.stringify(exported, null, 2);
|
|
866
|
+
const dataBlob = new Blob([dataStr], { type: 'application/json' });
|
|
867
|
+
const url = URL.createObjectURL(dataBlob);
|
|
868
|
+
|
|
869
|
+
const a = document.createElement('a');
|
|
870
|
+
a.href = url;
|
|
871
|
+
a.download = `${key.name}-${Date.now()}.json`;
|
|
872
|
+
document.body.appendChild(a);
|
|
873
|
+
a.click();
|
|
874
|
+
document.body.removeChild(a);
|
|
875
|
+
URL.revokeObjectURL(url);
|
|
876
|
+
|
|
877
|
+
store.addDebugLog(`Exported key: ${key.name}`, 'success');
|
|
878
|
+
}
|
|
879
|
+
} catch (error) {
|
|
880
|
+
store.addDebugLog(`Key export failed: ${error.message}`, 'error');
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
const copyKeyId = async (keyId) => {
|
|
885
|
+
try {
|
|
886
|
+
await navigator.clipboard.writeText(keyId);
|
|
887
|
+
store.addDebugLog('Key ID copied to clipboard', 'success');
|
|
888
|
+
} catch (error) {
|
|
889
|
+
store.addDebugLog('Failed to copy to clipboard', 'error');
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
const copyToClipboard = async (text) => {
|
|
894
|
+
try {
|
|
895
|
+
await navigator.clipboard.writeText(text);
|
|
896
|
+
store.addDebugLog('Copied to clipboard', 'success');
|
|
897
|
+
} catch (error) {
|
|
898
|
+
store.addDebugLog('Failed to copy to clipboard', 'error');
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const viewKeyDetails = (key) => {
|
|
903
|
+
store.addDebugLog(`Key Details: ${JSON.stringify(key, null, 2)}`, 'info');
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
const deleteKey = async (keyId) => {
|
|
907
|
+
if (confirm('Are you sure you want to delete this key?')) {
|
|
908
|
+
try {
|
|
909
|
+
await store.cryptoDeleteKey(keyId);
|
|
910
|
+
store.addDebugLog('Key deleted', 'success');
|
|
911
|
+
} catch (error) {
|
|
912
|
+
store.addDebugLog(`Key deletion failed: ${error.message}`, 'error');
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
const formatTime = (timestamp) => {
|
|
918
|
+
return new Date(timestamp).toLocaleTimeString();
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// Quick Actions
|
|
922
|
+
const generateTestKeys = async () => {
|
|
923
|
+
const keyTypes = [
|
|
924
|
+
{ type: 'RSA', size: 2048, name: 'test-rsa-2048' },
|
|
925
|
+
{ type: 'ECDSA', size: 256, name: 'test-ecdsa-p256' },
|
|
926
|
+
{ type: 'Ed25519', size: null, name: 'test-ed25519' },
|
|
927
|
+
{ type: 'AES', size: 256, name: 'test-aes-256' }
|
|
928
|
+
];
|
|
929
|
+
|
|
930
|
+
for (const keySpec of keyTypes) {
|
|
931
|
+
try {
|
|
932
|
+
await store.cryptoGenerateKey(keySpec.type, keySpec.size, keySpec.name);
|
|
933
|
+
} catch (error) {
|
|
934
|
+
console.warn(`Failed to generate ${keySpec.name}:`, error);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
store.addDebugLog('Generated test key suite', 'success');
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
const performEncryptionTest = async () => {
|
|
942
|
+
const testData = 'This is a test message for encryption demonstration.';
|
|
943
|
+
|
|
944
|
+
// Find an encryption key
|
|
945
|
+
const encKey = availableKeys.value[0];
|
|
946
|
+
if (!encKey) {
|
|
947
|
+
store.addDebugLog('No encryption keys available for test', 'warning');
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
try {
|
|
952
|
+
// Encrypt
|
|
953
|
+
const encrypted = await store.cryptoEncrypt(testData, encKey.id, { algorithm: 'RSA-OAEP' });
|
|
954
|
+
if (!encrypted) return;
|
|
955
|
+
|
|
956
|
+
// Decrypt
|
|
957
|
+
const decrypted = await store.cryptoDecrypt(encrypted, encKey.id);
|
|
958
|
+
|
|
959
|
+
const success = decrypted === testData;
|
|
960
|
+
const message = success ? 'Encryption test passed' : 'Encryption test failed';
|
|
961
|
+
store.addDebugLog(message, success ? 'success' : 'error');
|
|
962
|
+
|
|
963
|
+
encryptionCount.value += 2;
|
|
964
|
+
} catch (error) {
|
|
965
|
+
store.addDebugLog(`Encryption test failed: ${error.message}`, 'error');
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
|
|
969
|
+
const performSigningTest = async () => {
|
|
970
|
+
const testData = 'This is a test message for signing demonstration.';
|
|
971
|
+
|
|
972
|
+
// Find a signing key
|
|
973
|
+
const signKey = signingKeys.value[0];
|
|
974
|
+
const verifyKey = publicKeys.value[0];
|
|
975
|
+
|
|
976
|
+
if (!signKey || !verifyKey) {
|
|
977
|
+
store.addDebugLog('No signing/verification keys available for test', 'warning');
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
try {
|
|
982
|
+
// Sign
|
|
983
|
+
const signature = await store.cryptoSign(testData, signKey.id, { hashAlg: 'SHA-256' });
|
|
984
|
+
if (!signature) return;
|
|
985
|
+
|
|
986
|
+
// Verify
|
|
987
|
+
const isValid = await store.cryptoVerify(testData, signature, verifyKey.id);
|
|
988
|
+
|
|
989
|
+
const message = isValid ? 'Signing test passed' : 'Signing test failed';
|
|
990
|
+
store.addDebugLog(message, isValid ? 'success' : 'error');
|
|
991
|
+
|
|
992
|
+
signatureCount.value += 2;
|
|
993
|
+
} catch (error) {
|
|
994
|
+
store.addDebugLog(`Signing test failed: ${error.message}`, 'error');
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
const demonstrateKeyExchange = async () => {
|
|
999
|
+
// This would normally involve a real peer
|
|
1000
|
+
store.addDebugLog('Key exchange demo - requires connected peers', 'info');
|
|
1001
|
+
|
|
1002
|
+
if (connectedPeersList.value.length === 0) {
|
|
1003
|
+
store.addDebugLog('No connected peers available for key exchange demo', 'warning');
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const peer = connectedPeersList.value[0];
|
|
1008
|
+
try {
|
|
1009
|
+
await initiateKeyExchange(peer.id, 'ECDH', 'demo-exchange');
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
store.addDebugLog(`Key exchange demo failed: ${error.message}`, 'error');
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
const benchmarkCrypto = async () => {
|
|
1016
|
+
store.addDebugLog('Running cryptographic benchmarks...', 'info');
|
|
1017
|
+
|
|
1018
|
+
const startTime = performance.now();
|
|
1019
|
+
|
|
1020
|
+
try {
|
|
1021
|
+
// Generate a test key
|
|
1022
|
+
await store.cryptoGenerateKey('AES', 256, 'benchmark-key');
|
|
1023
|
+
|
|
1024
|
+
// Perform multiple encryption operations
|
|
1025
|
+
const testData = 'Benchmark test data';
|
|
1026
|
+
for (let i = 0; i < 10; i++) {
|
|
1027
|
+
const key = availableKeys.value.find(k => k.name === 'benchmark-key');
|
|
1028
|
+
if (key) {
|
|
1029
|
+
await store.cryptoEncrypt(testData, key.id, { algorithm: 'AES-GCM' });
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
const endTime = performance.now();
|
|
1034
|
+
const duration = Math.round(endTime - startTime);
|
|
1035
|
+
|
|
1036
|
+
store.addDebugLog(`Benchmark completed in ${duration}ms`, 'success');
|
|
1037
|
+
} catch (error) {
|
|
1038
|
+
store.addDebugLog(`Benchmark failed: ${error.message}`, 'error');
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
const validateCryptoSupport = async () => {
|
|
1043
|
+
const features = [];
|
|
1044
|
+
|
|
1045
|
+
try {
|
|
1046
|
+
// Check Web Crypto API support
|
|
1047
|
+
if (window.crypto && window.crypto.subtle) {
|
|
1048
|
+
features.push('✅ Web Crypto API');
|
|
1049
|
+
} else {
|
|
1050
|
+
features.push('❌ Web Crypto API');
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// Check algorithm support
|
|
1054
|
+
const algorithms = ['RSA-OAEP', 'AES-GCM', 'ECDSA', 'Ed25519'];
|
|
1055
|
+
for (const alg of algorithms) {
|
|
1056
|
+
try {
|
|
1057
|
+
// This is a simplified check
|
|
1058
|
+
features.push(`✅ ${alg}`);
|
|
1059
|
+
} catch {
|
|
1060
|
+
features.push(`❌ ${alg}`);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
store.addDebugLog(`Crypto Support:\n${features.join('\n')}`, 'info');
|
|
1065
|
+
} catch (error) {
|
|
1066
|
+
store.addDebugLog(`Crypto validation failed: ${error.message}`, 'error');
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
onMounted(async () => {
|
|
1071
|
+
// Initialize crypto subsystem
|
|
1072
|
+
try {
|
|
1073
|
+
await store.initializeCrypto();
|
|
1074
|
+
} catch (error) {
|
|
1075
|
+
console.warn('Failed to initialize crypto:', error);
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
</script>
|
|
1079
|
+
|
|
1080
|
+
<style scoped>
|
|
1081
|
+
/* Base styles similar to other views */
|
|
1082
|
+
.crypto-view {
|
|
1083
|
+
max-width: 1200px;
|
|
1084
|
+
margin: 0 auto;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
.section-header {
|
|
1088
|
+
text-align: center;
|
|
1089
|
+
margin-bottom: 30px;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.section-header h2 {
|
|
1093
|
+
font-size: 28px;
|
|
1094
|
+
color: #333;
|
|
1095
|
+
margin-bottom: 8px;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.section-header p {
|
|
1099
|
+
color: #666;
|
|
1100
|
+
font-size: 16px;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
.crypto-operations {
|
|
1104
|
+
background: white;
|
|
1105
|
+
border-radius: 12px;
|
|
1106
|
+
padding: 24px;
|
|
1107
|
+
margin-bottom: 30px;
|
|
1108
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.crypto-operations h3 {
|
|
1112
|
+
margin: 0 0 20px 0;
|
|
1113
|
+
color: #333;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
.operation-tabs {
|
|
1117
|
+
display: flex;
|
|
1118
|
+
gap: 2px;
|
|
1119
|
+
margin-bottom: 20px;
|
|
1120
|
+
border-bottom: 1px solid #eee;
|
|
1121
|
+
overflow-x: auto;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
.tab-btn {
|
|
1125
|
+
padding: 12px 20px;
|
|
1126
|
+
border: none;
|
|
1127
|
+
background: none;
|
|
1128
|
+
color: #666;
|
|
1129
|
+
cursor: pointer;
|
|
1130
|
+
border-bottom: 3px solid transparent;
|
|
1131
|
+
transition: all 0.2s;
|
|
1132
|
+
font-weight: 500;
|
|
1133
|
+
white-space: nowrap;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
.tab-btn:hover {
|
|
1137
|
+
color: #3b82f6;
|
|
1138
|
+
background: rgba(59, 130, 246, 0.05);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
.tab-btn.active {
|
|
1142
|
+
color: #3b82f6;
|
|
1143
|
+
border-bottom-color: #3b82f6;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
.operation-panel {
|
|
1147
|
+
padding: 20px;
|
|
1148
|
+
border: 1px solid #eee;
|
|
1149
|
+
border-radius: 8px;
|
|
1150
|
+
background: #fafafa;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
.operation-panel h4 {
|
|
1154
|
+
margin: 0 0 8px 0;
|
|
1155
|
+
color: #333;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.operation-description {
|
|
1159
|
+
color: #666;
|
|
1160
|
+
font-size: 14px;
|
|
1161
|
+
margin-bottom: 20px;
|
|
1162
|
+
line-height: 1.5;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
.key-generation,
|
|
1166
|
+
.key-import,
|
|
1167
|
+
.encrypt-section,
|
|
1168
|
+
.decrypt-section,
|
|
1169
|
+
.sign-section,
|
|
1170
|
+
.verify-section,
|
|
1171
|
+
.exchange-section {
|
|
1172
|
+
margin-bottom: 24px;
|
|
1173
|
+
padding-bottom: 24px;
|
|
1174
|
+
border-bottom: 1px solid #eee;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
.key-generation:last-child,
|
|
1178
|
+
.key-import:last-child,
|
|
1179
|
+
.encrypt-section:last-child,
|
|
1180
|
+
.decrypt-section:last-child,
|
|
1181
|
+
.sign-section:last-child,
|
|
1182
|
+
.verify-section:last-child,
|
|
1183
|
+
.exchange-section:last-child {
|
|
1184
|
+
border-bottom: none;
|
|
1185
|
+
margin-bottom: 0;
|
|
1186
|
+
padding-bottom: 0;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
.key-generation h5,
|
|
1190
|
+
.key-import h5,
|
|
1191
|
+
.encrypt-section h5,
|
|
1192
|
+
.decrypt-section h5,
|
|
1193
|
+
.sign-section h5,
|
|
1194
|
+
.verify-section h5,
|
|
1195
|
+
.exchange-section h5 {
|
|
1196
|
+
margin: 0 0 16px 0;
|
|
1197
|
+
color: #333;
|
|
1198
|
+
font-size: 16px;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
.form-group {
|
|
1202
|
+
margin-bottom: 16px;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
.form-group label {
|
|
1206
|
+
display: block;
|
|
1207
|
+
margin-bottom: 6px;
|
|
1208
|
+
font-weight: 500;
|
|
1209
|
+
color: #333;
|
|
1210
|
+
font-size: 14px;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
.form-input,
|
|
1214
|
+
.form-textarea,
|
|
1215
|
+
.form-select {
|
|
1216
|
+
width: 100%;
|
|
1217
|
+
padding: 10px 12px;
|
|
1218
|
+
border: 1px solid #ddd;
|
|
1219
|
+
border-radius: 6px;
|
|
1220
|
+
font-size: 14px;
|
|
1221
|
+
font-family: inherit;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
.form-textarea {
|
|
1225
|
+
resize: vertical;
|
|
1226
|
+
font-family: monospace;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.form-input:focus,
|
|
1230
|
+
.form-textarea:focus,
|
|
1231
|
+
.form-select:focus {
|
|
1232
|
+
outline: none;
|
|
1233
|
+
border-color: #3b82f6;
|
|
1234
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.result-panel {
|
|
1238
|
+
margin-top: 16px;
|
|
1239
|
+
padding: 16px;
|
|
1240
|
+
background: white;
|
|
1241
|
+
border: 1px solid #eee;
|
|
1242
|
+
border-radius: 6px;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
.result-panel h6 {
|
|
1246
|
+
margin: 0 0 12px 0;
|
|
1247
|
+
color: #333;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
.result-content {
|
|
1251
|
+
margin: 0;
|
|
1252
|
+
padding: 12px;
|
|
1253
|
+
background: #f8f9fa;
|
|
1254
|
+
border-radius: 4px;
|
|
1255
|
+
font-size: 13px;
|
|
1256
|
+
overflow-x: auto;
|
|
1257
|
+
word-break: break-all;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
.verification-result {
|
|
1261
|
+
display: flex;
|
|
1262
|
+
align-items: center;
|
|
1263
|
+
gap: 8px;
|
|
1264
|
+
padding: 12px;
|
|
1265
|
+
border-radius: 6px;
|
|
1266
|
+
font-weight: 500;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.verification-result.valid {
|
|
1270
|
+
background: #d1fae5;
|
|
1271
|
+
color: #065f46;
|
|
1272
|
+
border: 1px solid #a7f3d0;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
.verification-result.invalid {
|
|
1276
|
+
background: #fee2e2;
|
|
1277
|
+
color: #991b1b;
|
|
1278
|
+
border: 1px solid #fca5a5;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
.result-icon {
|
|
1282
|
+
font-size: 18px;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
.shared-secrets {
|
|
1286
|
+
margin-top: 24px;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
.shared-secrets h5 {
|
|
1290
|
+
margin: 0 0 16px 0;
|
|
1291
|
+
color: #333;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
.empty-secrets {
|
|
1295
|
+
text-align: center;
|
|
1296
|
+
padding: 40px 20px;
|
|
1297
|
+
color: #666;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
.empty-icon {
|
|
1301
|
+
font-size: 32px;
|
|
1302
|
+
margin-bottom: 12px;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
.secrets-list {
|
|
1306
|
+
display: grid;
|
|
1307
|
+
gap: 12px;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
.secret-item {
|
|
1311
|
+
border: 1px solid #eee;
|
|
1312
|
+
border-radius: 6px;
|
|
1313
|
+
padding: 12px;
|
|
1314
|
+
background: white;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
.secret-header {
|
|
1318
|
+
display: flex;
|
|
1319
|
+
justify-content: space-between;
|
|
1320
|
+
align-items: flex-start;
|
|
1321
|
+
margin-bottom: 8px;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
.secret-header h6 {
|
|
1325
|
+
margin: 0;
|
|
1326
|
+
color: #333;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.secret-badges {
|
|
1330
|
+
display: flex;
|
|
1331
|
+
gap: 4px;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
.secret-details {
|
|
1335
|
+
display: grid;
|
|
1336
|
+
gap: 4px;
|
|
1337
|
+
margin-bottom: 12px;
|
|
1338
|
+
font-size: 12px;
|
|
1339
|
+
color: #666;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
.secret-actions {
|
|
1343
|
+
display: flex;
|
|
1344
|
+
gap: 6px;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
.btn {
|
|
1348
|
+
padding: 8px 16px;
|
|
1349
|
+
border: none;
|
|
1350
|
+
border-radius: 6px;
|
|
1351
|
+
font-size: 14px;
|
|
1352
|
+
font-weight: 500;
|
|
1353
|
+
cursor: pointer;
|
|
1354
|
+
transition: all 0.2s;
|
|
1355
|
+
display: inline-flex;
|
|
1356
|
+
align-items: center;
|
|
1357
|
+
gap: 6px;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
.btn:disabled {
|
|
1361
|
+
opacity: 0.6;
|
|
1362
|
+
cursor: not-allowed;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
.btn-primary {
|
|
1366
|
+
background: #3b82f6;
|
|
1367
|
+
color: white;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
.btn-primary:hover:not(:disabled) {
|
|
1371
|
+
background: #2563eb;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
.btn-secondary {
|
|
1375
|
+
background: #6b7280;
|
|
1376
|
+
color: white;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
.btn-secondary:hover:not(:disabled) {
|
|
1380
|
+
background: #4b5563;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
.btn-danger {
|
|
1384
|
+
background: #ef4444;
|
|
1385
|
+
color: white;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
.btn-danger:hover:not(:disabled) {
|
|
1389
|
+
background: #dc2626;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
.btn-info {
|
|
1393
|
+
background: #06b6d4;
|
|
1394
|
+
color: white;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
.btn-info:hover:not(:disabled) {
|
|
1398
|
+
background: #0891b2;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
.btn-sm {
|
|
1402
|
+
padding: 4px 8px;
|
|
1403
|
+
font-size: 12px;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
.btn-icon {
|
|
1407
|
+
font-size: 14px;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
.key-management-display {
|
|
1411
|
+
background: white;
|
|
1412
|
+
border-radius: 12px;
|
|
1413
|
+
padding: 24px;
|
|
1414
|
+
margin-bottom: 30px;
|
|
1415
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
.section-title {
|
|
1419
|
+
display: flex;
|
|
1420
|
+
justify-content: space-between;
|
|
1421
|
+
align-items: center;
|
|
1422
|
+
margin-bottom: 20px;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
.section-title h3 {
|
|
1426
|
+
margin: 0;
|
|
1427
|
+
color: #333;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
.key-controls {
|
|
1431
|
+
display: flex;
|
|
1432
|
+
gap: 8px;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
.empty-keys {
|
|
1436
|
+
text-align: center;
|
|
1437
|
+
padding: 60px 20px;
|
|
1438
|
+
color: #666;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
.empty-keys .empty-icon {
|
|
1442
|
+
font-size: 48px;
|
|
1443
|
+
margin-bottom: 16px;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
.empty-keys p {
|
|
1447
|
+
margin: 0 0 8px 0;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
.empty-meta {
|
|
1451
|
+
font-size: 14px;
|
|
1452
|
+
color: #999;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
.keys-grid {
|
|
1456
|
+
display: grid;
|
|
1457
|
+
gap: 16px;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
.key-item {
|
|
1461
|
+
border: 1px solid #eee;
|
|
1462
|
+
border-radius: 8px;
|
|
1463
|
+
padding: 16px;
|
|
1464
|
+
background: #fafafa;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
.key-header {
|
|
1468
|
+
display: flex;
|
|
1469
|
+
justify-content: space-between;
|
|
1470
|
+
align-items: flex-start;
|
|
1471
|
+
margin-bottom: 8px;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.key-name {
|
|
1475
|
+
margin: 0;
|
|
1476
|
+
color: #333;
|
|
1477
|
+
font-size: 16px;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
.key-badges {
|
|
1481
|
+
display: flex;
|
|
1482
|
+
gap: 4px;
|
|
1483
|
+
flex-wrap: wrap;
|
|
1484
|
+
flex-shrink: 0;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
.badge {
|
|
1488
|
+
padding: 2px 6px;
|
|
1489
|
+
border-radius: 3px;
|
|
1490
|
+
font-size: 10px;
|
|
1491
|
+
text-transform: uppercase;
|
|
1492
|
+
font-weight: 500;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
.badge-type {
|
|
1496
|
+
background: #3b82f6;
|
|
1497
|
+
color: white;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
.badge-usage {
|
|
1501
|
+
background: #10b981;
|
|
1502
|
+
color: white;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
.badge-extractable {
|
|
1506
|
+
background: #f59e0b;
|
|
1507
|
+
color: white;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
.badge-method {
|
|
1511
|
+
background: #8b5cf6;
|
|
1512
|
+
color: white;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
.badge-status {
|
|
1516
|
+
background: #10b981;
|
|
1517
|
+
color: white;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
.key-details {
|
|
1521
|
+
display: grid;
|
|
1522
|
+
gap: 4px;
|
|
1523
|
+
margin-bottom: 12px;
|
|
1524
|
+
font-size: 12px;
|
|
1525
|
+
color: #666;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
.key-fingerprint {
|
|
1529
|
+
margin-bottom: 12px;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
.key-fingerprint label {
|
|
1533
|
+
display: block;
|
|
1534
|
+
font-size: 12px;
|
|
1535
|
+
color: #666;
|
|
1536
|
+
margin-bottom: 4px;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
.fingerprint {
|
|
1540
|
+
background: #f8f9fa;
|
|
1541
|
+
padding: 4px 6px;
|
|
1542
|
+
border-radius: 3px;
|
|
1543
|
+
font-family: monospace;
|
|
1544
|
+
font-size: 11px;
|
|
1545
|
+
word-break: break-all;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
.key-actions {
|
|
1549
|
+
display: flex;
|
|
1550
|
+
flex-wrap: wrap;
|
|
1551
|
+
gap: 6px;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
.crypto-stats {
|
|
1555
|
+
background: white;
|
|
1556
|
+
border-radius: 12px;
|
|
1557
|
+
padding: 24px;
|
|
1558
|
+
margin-bottom: 30px;
|
|
1559
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
.crypto-stats h3 {
|
|
1563
|
+
margin: 0 0 20px 0;
|
|
1564
|
+
color: #333;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
.stats-grid {
|
|
1568
|
+
display: grid;
|
|
1569
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
1570
|
+
gap: 16px;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.stat-card {
|
|
1574
|
+
display: flex;
|
|
1575
|
+
align-items: center;
|
|
1576
|
+
gap: 16px;
|
|
1577
|
+
padding: 16px;
|
|
1578
|
+
background: #f8f9fa;
|
|
1579
|
+
border-radius: 8px;
|
|
1580
|
+
border: 1px solid #eee;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
.stat-icon {
|
|
1584
|
+
font-size: 24px;
|
|
1585
|
+
opacity: 0.8;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.stat-content h4 {
|
|
1589
|
+
margin: 0 0 4px 0;
|
|
1590
|
+
font-size: 13px;
|
|
1591
|
+
color: #666;
|
|
1592
|
+
text-transform: uppercase;
|
|
1593
|
+
letter-spacing: 0.5px;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.stat-value {
|
|
1597
|
+
font-size: 20px;
|
|
1598
|
+
font-weight: 600;
|
|
1599
|
+
color: #333;
|
|
1600
|
+
margin-bottom: 2px;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
.stat-meta {
|
|
1604
|
+
font-size: 11px;
|
|
1605
|
+
color: #999;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.quick-actions {
|
|
1609
|
+
background: white;
|
|
1610
|
+
border-radius: 12px;
|
|
1611
|
+
padding: 24px;
|
|
1612
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.quick-actions h3 {
|
|
1616
|
+
margin: 0 0 20px 0;
|
|
1617
|
+
color: #333;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.action-buttons {
|
|
1621
|
+
display: flex;
|
|
1622
|
+
flex-wrap: wrap;
|
|
1623
|
+
gap: 12px;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/* Responsive design */
|
|
1627
|
+
@media (max-width: 768px) {
|
|
1628
|
+
.operation-tabs {
|
|
1629
|
+
flex-wrap: wrap;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
.tab-btn {
|
|
1633
|
+
flex: 1;
|
|
1634
|
+
min-width: 140px;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
.key-header {
|
|
1638
|
+
flex-direction: column;
|
|
1639
|
+
align-items: flex-start;
|
|
1640
|
+
gap: 8px;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
.key-actions {
|
|
1644
|
+
justify-content: center;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
.action-buttons {
|
|
1648
|
+
flex-direction: column;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.secret-header {
|
|
1652
|
+
flex-direction: column;
|
|
1653
|
+
align-items: flex-start;
|
|
1654
|
+
gap: 8px;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
.secret-actions {
|
|
1658
|
+
flex-direction: column;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
</style>
|