@lumiapassport/ui-kit 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Lumia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Cloudflare Pages Headers Configuration for Iframe Wallet
2
+ # This file configures security headers for the iframe at auth.lumiapassport.com
3
+
4
+ /*
5
+ # Content Security Policy - Strict security policy for iframe
6
+ # IMPORTANT: frame-ancestors 'https:' allows embedding on any HTTPS site
7
+ # Domain validation is performed via projectId check in JavaScript
8
+ # connect-src whitelist: only allowed TSS servers (where the second key share is stored)
9
+ Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self' https://api.lumiapassport.com https://lumiaid-demo.18102024.xyz http://localhost:*; frame-ancestors https: http://localhost:*; base-uri 'self'; form-action 'self';
10
+
11
+ # Allow iframe embedding from HTTPS sites (domain validation in JS)
12
+ # X-Frame-Options is NOT set (CSP frame-ancestors takes precedence)
13
+
14
+ # Prevent MIME type sniffing
15
+ X-Content-Type-Options: nosniff
16
+
17
+ # Referrer policy
18
+ Referrer-Policy: strict-origin-when-cross-origin
19
+
20
+ # Permissions policy (disable unnecessary features)
21
+ Permissions-Policy: geolocation=(), microphone=(), camera=(), payment=(), usb=(), magnetometer=(), gyroscope=()
22
+
23
+ # HSTS - Force HTTPS (uncomment for production)
24
+ # Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
25
+
26
+ # CORS headers - Allow postMessage from any origin (we validate in JS)
27
+ Access-Control-Allow-Origin: *
28
+ Access-Control-Allow-Methods: GET, OPTIONS
29
+ Access-Control-Allow-Headers: Content-Type
30
+
31
+ # Cache control for HTML
32
+ Cache-Control: public, max-age=0, must-revalidate
33
+
34
+ /*.js
35
+ # Cache JavaScript files for 1 year
36
+ Cache-Control: public, max-age=31536000, immutable
37
+
38
+ /*.css
39
+ # Cache CSS files for 1 year
40
+ Cache-Control: public, max-age=31536000, immutable
41
+
42
+ /*.wasm
43
+ # Cache WASM files for 1 year
44
+ Cache-Control: public, max-age=31536000, immutable
45
+ Content-Type: application/wasm
Binary file
@@ -0,0 +1,408 @@
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
+
7
+ <!-- Security Headers -->
8
+ <!-- NOTE: These are fallback headers for development. Production uses _headers file from Cloudflare -->
9
+ <!-- WARNING: frame-ancestors MUST be set via HTTP headers, not meta tags (it's ignored in meta) -->
10
+ <meta
11
+ http-equiv="Content-Security-Policy"
12
+ content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self' http://localhost:* https:; base-uri 'self'; form-action 'self';"
13
+ />
14
+ <meta http-equiv="X-Content-Type-Options" content="nosniff" />
15
+ <meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
16
+
17
+ <title>Lumia Passport Secure Wallet</title>
18
+
19
+ <!-- Styles will be injected by build process -->
20
+ <style>
21
+ * {
22
+ margin: 0;
23
+ padding: 0;
24
+ box-sizing: border-box;
25
+ }
26
+
27
+ body {
28
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
29
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
30
+ color: #333;
31
+ min-height: 100vh;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ }
36
+
37
+ #app {
38
+ width: 100%;
39
+ height: 100vh;
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ }
44
+
45
+ /* Ready Indicator */
46
+ .ready-indicator {
47
+ text-align: center;
48
+ background: white;
49
+ padding: 3rem;
50
+ border-radius: 16px;
51
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
52
+ max-width: 400px;
53
+ }
54
+
55
+ .status-icon {
56
+ font-size: 4rem;
57
+ margin-bottom: 1rem;
58
+ }
59
+
60
+ .ready-indicator h2 {
61
+ font-size: 1.5rem;
62
+ margin-bottom: 0.5rem;
63
+ color: #333;
64
+ }
65
+
66
+ .ready-indicator p {
67
+ color: #666;
68
+ margin-bottom: 1.5rem;
69
+ }
70
+
71
+ .info {
72
+ background: #f5f5f5;
73
+ border-radius: 8px;
74
+ padding: 1rem;
75
+ text-align: left;
76
+ }
77
+
78
+ .info-row {
79
+ display: flex;
80
+ justify-content: space-between;
81
+ padding: 0.5rem 0;
82
+ }
83
+
84
+ .info-row:not(:last-child) {
85
+ border-bottom: 1px solid #e0e0e0;
86
+ }
87
+
88
+ .status-active {
89
+ color: #10b981;
90
+ font-weight: 600;
91
+ }
92
+
93
+ /* Loading Indicator */
94
+ .loading-indicator {
95
+ text-align: center;
96
+ color: white;
97
+ }
98
+
99
+ .spinner {
100
+ width: 50px;
101
+ height: 50px;
102
+ margin: 0 auto 1rem;
103
+ border: 4px solid rgba(255, 255, 255, 0.3);
104
+ border-top-color: white;
105
+ border-radius: 50%;
106
+ animation: spin 1s linear infinite;
107
+ }
108
+
109
+ @keyframes spin {
110
+ to { transform: rotate(360deg); }
111
+ }
112
+
113
+ .loading-indicator p {
114
+ font-size: 1.1rem;
115
+ }
116
+
117
+ /* Error Indicator */
118
+ .error-indicator {
119
+ text-align: center;
120
+ background: white;
121
+ padding: 3rem;
122
+ border-radius: 16px;
123
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
124
+ max-width: 400px;
125
+ }
126
+
127
+ .error-icon {
128
+ font-size: 4rem;
129
+ margin-bottom: 1rem;
130
+ }
131
+
132
+ .error-indicator h2 {
133
+ font-size: 1.5rem;
134
+ margin-bottom: 0.5rem;
135
+ color: #ef4444;
136
+ }
137
+
138
+ .error-indicator p {
139
+ color: #666;
140
+ }
141
+
142
+ /* Modal Overlays */
143
+ /* Transaction confirmation modal container */
144
+ .transaction-confirmation-modal {
145
+ position: fixed;
146
+ top: 0;
147
+ left: 0;
148
+ right: 0;
149
+ bottom: 0;
150
+ z-index: 10000;
151
+ }
152
+
153
+ .modal-overlay {
154
+ position: fixed;
155
+ top: 0;
156
+ left: 0;
157
+ right: 0;
158
+ bottom: 0;
159
+ background: rgba(0, 0, 0, 0.7);
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+ z-index: 10000;
164
+ }
165
+
166
+ .modal-content {
167
+ background: white;
168
+ border-radius: 12px;
169
+ padding: 2rem;
170
+ max-width: 90%;
171
+ max-height: 90%;
172
+ overflow-y: auto;
173
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
174
+ }
175
+
176
+ .modal-content h2 {
177
+ font-size: 1.5rem;
178
+ margin-bottom: 1rem;
179
+ color: #333;
180
+ }
181
+
182
+ .modal-content h3 {
183
+ font-size: 1.1rem;
184
+ margin: 1rem 0 0.5rem;
185
+ color: #555;
186
+ }
187
+
188
+ .app-identity {
189
+ text-align: center;
190
+ padding: 1rem;
191
+ border-bottom: 1px solid #e0e0e0;
192
+ margin-bottom: 1.5rem;
193
+ }
194
+
195
+ .app-logo {
196
+ width: 64px;
197
+ height: 64px;
198
+ margin-bottom: 0.5rem;
199
+ border-radius: 8px;
200
+ }
201
+
202
+ .app-origin {
203
+ font-size: 0.9rem;
204
+ margin-top: 0.5rem;
205
+ }
206
+
207
+ .app-origin.verified {
208
+ color: #10b981;
209
+ }
210
+
211
+ .app-origin.unverified {
212
+ color: #f59e0b;
213
+ }
214
+
215
+ .actions {
216
+ display: flex;
217
+ gap: 1rem;
218
+ margin-top: 1.5rem;
219
+ }
220
+
221
+ button {
222
+ flex: 1;
223
+ padding: 0.75rem 1.5rem;
224
+ border: none;
225
+ border-radius: 8px;
226
+ font-size: 1rem;
227
+ cursor: pointer;
228
+ font-weight: 600;
229
+ transition: all 0.2s;
230
+ }
231
+
232
+ .cancel-btn {
233
+ background: #e5e7eb;
234
+ color: #374151;
235
+ }
236
+
237
+ .cancel-btn:hover {
238
+ background: #d1d5db;
239
+ }
240
+
241
+ .confirm-btn,
242
+ .authorize-btn {
243
+ background: #667eea;
244
+ color: white;
245
+ }
246
+
247
+ .confirm-btn:hover,
248
+ .authorize-btn:hover {
249
+ background: #5568d3;
250
+ }
251
+
252
+ button:disabled {
253
+ opacity: 0.5;
254
+ cursor: not-allowed;
255
+ }
256
+
257
+ .tx-details {
258
+ background: #f9fafb;
259
+ border-radius: 8px;
260
+ padding: 1rem;
261
+ margin: 1rem 0;
262
+ }
263
+
264
+ .detail-row {
265
+ display: flex;
266
+ justify-content: space-between;
267
+ padding: 0.5rem 0;
268
+ font-size: 0.9rem;
269
+ }
270
+
271
+ .detail-row:not(:last-child) {
272
+ border-bottom: 1px solid #e5e7eb;
273
+ }
274
+
275
+ .detail-row code {
276
+ font-family: 'Courier New', monospace;
277
+ font-size: 0.85rem;
278
+ color: #6b7280;
279
+ }
280
+
281
+ .security-notice {
282
+ background: #fef3c7;
283
+ border-left: 4px solid #f59e0b;
284
+ padding: 1rem;
285
+ margin: 1rem 0;
286
+ border-radius: 4px;
287
+ }
288
+
289
+ .security-notice p {
290
+ font-size: 0.9rem;
291
+ color: #92400e;
292
+ margin: 0;
293
+ }
294
+
295
+ .risk-warning {
296
+ padding: 1rem;
297
+ border-radius: 8px;
298
+ margin: 1rem 0;
299
+ }
300
+
301
+ .risk-warning.medium-risk {
302
+ background: #fef3c7;
303
+ border-left: 4px solid #f59e0b;
304
+ }
305
+
306
+ .risk-warning.high-risk {
307
+ background: #fee2e2;
308
+ border-left: 4px solid #ef4444;
309
+ }
310
+
311
+ .risk-warning.critical-risk {
312
+ background: #fce7f3;
313
+ border-left: 4px solid #ec4899;
314
+ }
315
+
316
+ .permissions-list ul {
317
+ list-style: none;
318
+ padding: 0;
319
+ }
320
+
321
+ .permissions-list li {
322
+ padding: 0.5rem 0;
323
+ color: #555;
324
+ }
325
+
326
+ /* Additional modal styles for transaction confirmation */
327
+ .app-identity .app-info h3 {
328
+ font-size: 1.2rem;
329
+ margin-bottom: 0.25rem;
330
+ }
331
+
332
+ .app-identity .app-info .origin {
333
+ font-size: 0.9rem;
334
+ color: #6b7280;
335
+ }
336
+
337
+ .app-identity.low-risk {
338
+ border-color: #10b981;
339
+ }
340
+
341
+ .app-identity.medium-risk {
342
+ border-color: #f59e0b;
343
+ }
344
+
345
+ .app-identity.high-risk {
346
+ border-color: #ef4444;
347
+ }
348
+
349
+ .app-identity.critical-risk {
350
+ border-color: #ec4899;
351
+ }
352
+
353
+ .risk-warning strong {
354
+ display: block;
355
+ margin-bottom: 0.5rem;
356
+ font-size: 1rem;
357
+ }
358
+
359
+ /* Trust app checkbox section */
360
+ .trust-app-section {
361
+ margin: 1rem 0;
362
+ padding: 0.75rem;
363
+ background: #f9fafb;
364
+ border-radius: 6px;
365
+ border: 1px solid #e5e7eb;
366
+ }
367
+
368
+ .trust-app-label {
369
+ display: flex;
370
+ align-items: center;
371
+ gap: 0.5rem;
372
+ cursor: pointer;
373
+ font-size: 0.9rem;
374
+ color: #374151;
375
+ }
376
+
377
+ .trust-app-checkbox {
378
+ width: 18px;
379
+ height: 18px;
380
+ cursor: pointer;
381
+ flex-shrink: 0;
382
+ }
383
+
384
+ .trust-app-label span {
385
+ line-height: 1.4;
386
+ user-select: none;
387
+ }
388
+
389
+ .trust-app-label:hover {
390
+ color: #111827;
391
+ }
392
+ </style>
393
+ </head>
394
+ <body>
395
+ <div id="app">
396
+ <!-- App content will be injected here by main.ts -->
397
+ <div class="loading-indicator">
398
+ <div class="spinner"></div>
399
+ <p>Initializing secure wallet...</p>
400
+ </div>
401
+ </div>
402
+
403
+ <!-- Main script -->
404
+ <!-- In dev mode (Vite): loads TypeScript from src/ -->
405
+ <!-- In production: loads compiled JavaScript from dist/ -->
406
+ <script type="module" src="./main.js"></script>
407
+ </body>
408
+ </html>