-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
380 lines (340 loc) · 14.3 KB
/
index.html
File metadata and controls
380 lines (340 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<!--
Copyright (C) 2025 KSEC - Erez Kalman. All Rights Reserved.
SPDX-License-Identifier: (AGPL-3.0-or-later OR LicenseRef-Erez_Kalman_KSEC-Commercial)
This source code is licensed under a dual-license model.
See the LICENSE, LICENSE.AGPL.md, and NOTICE.md files for full details.
-->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline'; connect-src 'self' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net; img-src 'self' data:;">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:,">
<title>Secure Secret Sharer</title>
<style>
:root {
--primary-bg: #1e1e2e;
--secondary-bg: #28283e;
--text-color: #cdd6f4;
--accent-color: #89b4fa;
--accent-hover: #a6c9ff;
--danger-color: #f38ba8;
--success-color: #a6e3a1;
--warning-color: #fab387;
--border-color: #45475a;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: var(--primary-bg);
color: var(--text-color);
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
box-sizing: border-box;
}
#app-container {
width: 100%;
max-width: 600px;
background-color: var(--secondary-bg);
border-radius: 8px;
border: 1px solid var(--border-color);
padding: 2rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
margin-bottom: auto;
margin-top: auto;
}
.view { display: none; }
.view.active { display: block; }
h1, h2 {
color: var(--accent-color);
text-align: center;
margin-top: 0;
}
h2 {
margin-top: 1.5rem;
font-size: 1.2rem;
}
.input-group {
margin-bottom: 1.5rem;
position: relative;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: bold;
}
textarea, input[type="password"], input[type="text"] {
width: 100%;
padding: 12px;
border-radius: 4px;
border: 1px solid var(--border-color);
background-color: var(--primary-bg);
color: var(--text-color);
font-size: 1rem;
box-sizing: border-box;
transition: border-color 0.3s;
}
input[type="password"] {
padding-right: 40px;
}
textarea:focus, input[type="password"]:focus, input[type="text"]:focus {
outline: none;
border-color: var(--accent-color);
}
textarea {
resize: vertical;
min-height: 120px;
}
.char-counter {
text-align: right;
font-size: 0.8rem;
color: var(--border-color);
margin-top: 0.25rem;
}
.char-counter.warn {
color: var(--warning-color);
font-weight: bold;
}
#result-link {
word-break: break-all;
}
.password-toggle-icon {
position: absolute;
top: 40px;
right: 10px;
cursor: pointer;
color: var(--text-color);
opacity: 0.7;
user-select: none;
}
.password-toggle-icon:hover {
opacity: 1;
}
button {
width: 100%;
padding: 12px;
border: none;
border-radius: 4px;
background-color: var(--accent-color);
color: var(--primary-bg);
font-size: 1.1rem;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s, opacity 0.3s, transform 0.1s;
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
}
button:active {
transform: scale(0.98);
}
button:hover {
background-color: var(--accent-hover);
}
button:disabled {
background-color: var(--border-color);
cursor: not-allowed;
opacity: 0.7;
}
.button-secondary {
background-color: var(--border-color);
color: var(--text-color);
margin-top: 1rem;
}
.button-secondary:hover {
background-color: #585b70;
}
.spinner {
width: 20px;
height: 20px;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
display: none;
}
button.loading .spinner {
display: block;
}
button.loading .btn-text {
display: none;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.password-strength {
margin-top: 0.5rem;
height: 5px;
background-color: var(--border-color);
border-radius: 5px;
overflow: hidden;
transition: all 0.3s;
}
.strength-bar {
height: 100%;
width: 0;
transition: width 0.3s, background-color 0.3s;
}
.strength-bar.s0 { width: 20%; background-color: var(--danger-color); }
.strength-bar.s1 { width: 40%; background-color: var(--danger-color); }
.strength-bar.s2 { width: 60%; background-color: var(--warning-color); }
.strength-bar.s3 { width: 80%; background-color: var(--success-color); }
.strength-bar.s4 { width: 100%; background-color: var(--success-color); }
.strength-text {
margin-top: 0.25rem;
font-size: 0.8rem;
text-align: right;
min-height: 1.2em;
}
.message {
padding: 1rem;
border-radius: 4px;
margin-bottom: 1rem;
text-align: center;
font-weight: bold;
line-height: 1.5;
}
.message-error { background-color: var(--danger-color); color: var(--primary-bg); }
.message-success { background-color: var(--success-color); color: var(--primary-bg); }
.message-info { background-color: var(--accent-color); color: var(--primary-bg); }
footer {
width: 100%;
text-align: center;
padding: 1rem 0;
margin-top: 2rem;
color: var(--text-color);
opacity: 0.7;
font-size: 0.9rem;
}
details {
margin-top: 2rem;
background-color: var(--primary-bg);
border: 1px solid var(--border-color);
border-radius: 4px;
}
summary {
padding: 1rem;
font-weight: bold;
cursor: pointer;
color: var(--accent-color);
}
.details-content {
padding: 0 1rem 1rem 1rem;
line-height: 1.6;
font-size: 0.9rem;
}
.details-content p, .details-content ul { margin-top: 0; }
.details-content h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
</style>
</head>
<body>
<div id="app-container">
<div id="insecure-context-view" class="view">
<h1>🔒 Security Error</h1>
<div class="message message-error">
This application requires a secure context (HTTPS) to run.<br>
Please host this file on a web server or use a service like GitHub Pages. Do not open it as a local file.
</div>
</div>
<div id="dependency-error-view" class="view">
<h1>❌ Loading Error</h1>
<div id="dependency-error-message" class="message message-error"></div>
</div>
<div id="create-view" class="view">
<form action="javascript:void(0);">
<h1>Share a Secret</h1>
<div class="input-group">
<label for="secret-input">Secret to share</label>
<textarea id="secret-input" placeholder="Enter your secret here..." autocomplete="off"></textarea>
<div id="char-counter" class="char-counter">0</div>
</div>
<div class="input-group">
<input type="text" name="username" autocomplete="off" style="display:none;">
<label for="password-input">Password</label>
<input type="password" id="password-input" placeholder="Enter a strong password" autocomplete="off">
<span class="password-toggle-icon" id="create-pw-toggle">👁️</span>
<div class="password-strength">
<div id="strength-bar" class="strength-bar"></div>
</div>
<div id="strength-text" class="strength-text"></div>
</div>
<button id="create-btn" type="submit">
<span class="btn-text">Generate Secure Link</span>
<div class="spinner"></div>
</button>
<div id="create-error" class="message message-error" style="display: none; margin-top: 1rem;"></div>
</form>
</div>
<div id="link-view" class="view">
<h1>Link Generated Successfully</h1>
<div class="message message-info">
Your secret is encrypted. Only someone with the password and this exact link can open it.
</div>
<div class="input-group">
<label for="result-link">Your Secure Link</label>
<input type="text" id="result-link" readonly autocomplete="off">
</div>
<button id="copy-link-btn">Copy Link</button>
<button id="create-new-secret-btn-from-link" class="button-secondary">Create New Secret</button>
</div>
<div id="decrypt-view" class="view">
<form action="javascript:void(0);">
<h1>Unlock Secret</h1>
<div class="input-group">
<input type="text" name="username" autocomplete="off" style="display:none;">
<label for="decrypt-password-input">Password</label>
<input type="password" id="decrypt-password-input" placeholder="Enter password to decrypt" autocomplete="off">
<span class="password-toggle-icon" id="decrypt-pw-toggle">👁️</span>
</div>
<button id="decrypt-btn" type="submit">
<span class="btn-text">Decrypt Secret</span>
<div class="spinner"></div>
</button>
<div id="decrypt-error" class="message message-error" style="display: none; margin-top: 1rem;"></div>
</form>
</div>
<div id="secret-view" class="view">
<h1>Decrypted Secret</h1>
<div class="message message-success">
This secret will not be saved. Copy it now.
</div>
<div class="input-group">
<label for="revealed-secret">Your Secret</label>
<textarea id="revealed-secret" readonly autocomplete="off"></textarea>
</div>
<button id="copy-secret-btn">Copy Secret</button>
<button id="create-new-secret-btn-from-secret" class="button-secondary">Create New Secret</button>
</div>
<div id="loading-view" class="view active">
<h1 id="loading-text">Loading...</h1>
</div>
<details>
<summary>How It Works & Security Recommendations</summary>
<div class="details-content">
<h2>How It Works</h2>
<p>This tool uses strong, modern, end-to-end encryption to protect your secrets. Here's the security model:</p>
<ul>
<li><strong>Client-Side Encryption:</strong> All encryption and decryption happens directly in your browser. The server never sees your password or your unencrypted secret.</li>
<li><strong>Zero-Knowledge Server:</strong> The website itself is just a static file. It has no database and stores no information about you or your secrets.</li>
<li><strong>Strong Cryptography:</strong> Your password is used to derive a key with Argon2id (a modern key derivation function). Your secret is then encrypted with that key using AES-256-GCM, a military-grade encryption standard.</li>
<li><strong>Data in URL:</strong> All the data needed to decrypt the secret (the encrypted text, salt, etc.) is stored in the URL fragment (#), which is never sent to the web server.</li>
</ul>
<h2>Important Security Recommendations</h2>
<ul>
<li><strong>Secure Channel Transmission:</strong> For maximum security, send the generated link and the password through <strong>different communication channels</strong>. For example, email the link and send the password in a separate text message.</li>
<li><strong>Browser Extension Risk:</strong> Malicious browser extensions can potentially read data from your screen or intercept what you type. For highly sensitive secrets, consider using a private/incognito browser window, which typically disables extensions.</li>
<li><strong>Phishing Awareness:</strong> Always verify that the URL in your browser's address bar is correct before entering a password. An attacker could create a clone of this website on a different domain to try and steal your secrets.</li>
</ul>
</div>
</details>
</div>
<footer>(C) 2025 KSEC - Erez Kalman</footer>
<script src="app.js" defer></script>
</body>
</html>