-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
364 lines (316 loc) · 23.4 KB
/
index.html
File metadata and controls
364 lines (316 loc) · 23.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ID Verifier - Frontend Example</title>
<link rel="stylesheet" href="styles/main.css">
<link rel="apple-touch-icon" sizes="180x180" href="./favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicons/favicon-16x16.png">
<script type="importmap">
{
"imports": {
"cbor2": "https://cdn.jsdelivr.net/npm/cbor2@2.0.1/+esm",
"pkijs": "https://cdn.jsdelivr.net/npm/pkijs@3.2.5/+esm",
"asn1js": "https://cdn.jsdelivr.net/npm/asn1js@3.0.6/+esm",
"@hpke/core": "https://cdn.jsdelivr.net/npm/@hpke/core@1.7.3/+esm",
"trusted-issuer-registry": "https://cdn.jsdelivr.net/npm/trusted-issuer-registry@0.1.0/+esm"
}
}
</script>
<script type="module" src="scripts/pages/index.js"></script>
</head>
<body class="font-sans max-w-4xl mx-auto p-5 leading-relaxed">
<div class="bg-gray-100 border border-gray-300 rounded-lg p-4 mb-5 flex items-center justify-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
<span class="text-gray-700 text-sm">
This project is <strong>open source</strong> and available on
<a href="https://github.com/universal-verify/id-verifier" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline font-medium">GitHub</a>
</span>
</div>
<h1 class="text-3xl font-bold mb-6">ID Verifier - A Digital Credentials API Wrapper</h1>
<div class="bg-gray-50 rounded-lg p-5 mb-5">
<h2 class="text-xl font-semibold mb-3">Try it out</h2>
<p class="mb-4">This example demonstrates how to request and verify digital credentials using the id-verifier library.</p>
<div id="status" class="bg-blue-50 border border-blue-200 text-blue-800 rounded-md p-4 mb-4">
Checking browser compatibility...
</div>
<button id="requestBtn" disabled
class="bg-blue-500 hover:bg-blue-600 disabled:bg-gray-500 disabled:cursor-not-allowed text-white border-none py-3 px-6 rounded-md cursor-pointer text-base mr-2 mb-2 transition-colors">
Request Credentials
</button>
<div id="result" class="bg-white border border-gray-300 rounded-md p-4 mt-4 whitespace-pre-wrap font-mono text-sm overflow-x-auto hidden"></div>
</div>
<!-- Configuration -->
<div class="bg-gray-50 rounded-lg p-5 mb-5">
<h2 class="text-xl font-semibold mb-3">Configure Request</h2>
<p class="mb-4 text-gray-600">Select the document types and information you'd like to request from the user:</p>
<!-- Document Types -->
<div class="mb-6">
<h3 class="text-lg font-semibold mb-3">Allowed Document Types</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<label class="flex items-center bg-white rounded-lg p-4 border border-gray-200">
<input type="checkbox" name="mobileDriversLicense" class="rounded text-blue-600 mr-3" checked>
<div>
<span class="text-sm font-medium text-gray-700">Mobile Driver's License</span>
<p class="text-xs text-gray-500 mt-1">ISO 18013-5 mDL standard</p>
</div>
</label>
<label class="flex items-center bg-white rounded-lg p-4 border border-gray-200">
<input type="checkbox" name="photoId" class="rounded text-blue-600 mr-3">
<div>
<span class="text-sm font-medium text-gray-700">Photo ID</span>
<p class="text-xs text-gray-500 mt-1">ISO 23220 Photo ID standard</p>
</div>
</label>
<label class="flex items-center bg-white rounded-lg p-4 border border-gray-200">
<input type="checkbox" name="euPersonalId" class="rounded text-blue-600 mr-3">
<div>
<span class="text-sm font-medium text-gray-700">EU Personal ID</span>
<p class="text-xs text-gray-500 mt-1">European Digital Identity</p>
</div>
</label>
<label class="flex items-center bg-white rounded-lg p-4 border border-gray-200">
<input type="checkbox" name="japanMyNumberCard" class="rounded text-blue-600 mr-3">
<div>
<span class="text-sm font-medium text-gray-700">Japan My Number Card</span>
<p class="text-xs text-gray-500 mt-1">Japanese national ID</p>
</div>
</label>
</div>
</div>
<!-- Claims -->
<div class="mb-4">
<h3 class="text-lg font-semibold mb-3">Requested Information</h3>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4">
<!-- Personal Information -->
<div class="bg-white rounded-lg p-4 border border-gray-200">
<h4 class="font-semibold text-gray-800 mb-3 text-sm uppercase tracking-wide">Personal Information</h4>
<div class="space-y-3">
<label class="flex items-center">
<input type="checkbox" name="givenName" class="rounded text-blue-600 mr-2" checked>
<span class="text-sm font-medium text-gray-700">Given Name</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="familyName" class="rounded text-blue-600 mr-2" checked>
<span class="text-sm font-medium text-gray-700">Family Name</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="birthDate" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Birth Date</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="birthYear" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Birth Year</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="age" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Age</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="ageOver18" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Age Over 18</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="ageOver21" class="rounded text-blue-600 mr-2" checked>
<span class="text-sm font-medium text-gray-700">Age Over 21</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="sex" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Sex</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="height" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Height</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="weight" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Weight</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="eyeColor" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Eye Color</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="hairColor" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Hair Color</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="nationality" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Nationality</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="placeOfBirth" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Place of Birth</span>
</label>
</div>
</div>
<!-- Address Information -->
<div class="bg-white rounded-lg p-4 border border-gray-200">
<h4 class="font-semibold text-gray-800 mb-3 text-sm uppercase tracking-wide">Address Information</h4>
<div class="space-y-3">
<label class="flex items-center">
<input type="checkbox" name="address" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Address</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="city" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">City</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="state" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">State</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="postalCode" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Postal Code</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="country" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Country</span>
</label>
</div>
</div>
<!-- Document Information -->
<div class="bg-white rounded-lg p-4 border border-gray-200">
<h4 class="font-semibold text-gray-800 mb-3 text-sm uppercase tracking-wide">Document Information</h4>
<div class="space-y-3">
<label class="flex items-center">
<input type="checkbox" name="documentNumber" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Document Number</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="issuingAuthority" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Issuing Authority</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="issuingCountry" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Issuing Country</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="issuingJurisdiction" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Issuing Jurisdiction</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="issueDate" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Issue Date</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="expiryDate" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Expiry Date</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="drivingPrivileges" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Driving Privileges</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="portrait" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Portrait</span>
</label>
<label class="flex items-center">
<input type="checkbox" name="signature" class="rounded text-blue-600 mr-2">
<span class="text-sm font-medium text-gray-700">Signature</span>
</label>
</div>
</div>
</div>
</div>
<!-- Test Data Toggle -->
<div class="mb-6">
<h3 class="text-lg font-semibold mb-3">Issuer Registry Settings</h3>
<div class="bg-white rounded-lg p-4 border border-gray-200">
<label class="flex items-center">
<input type="checkbox" id="useTestData" class="rounded text-blue-600 mr-3">
<div>
<span class="text-sm font-medium text-gray-700">Use Test Data</span>
<p class="text-xs text-gray-500 mt-1">
Enable using test issuer data from the
<a href="https://github.com/universal-verify/trusted-issuer-registry/" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">trusted-issuer-registry</a>
</p>
</div>
</label>
</div>
</div>
<!-- Sample Script -->
<div class="mt-6">
<h3 class="text-lg font-semibold mb-3">Sample Code</h3>
<p class="text-sm text-gray-600 mb-3">Here's the code that would be used to request the selected claims:</p>
<div id="sampleScript" class="bg-gray-50 border border-gray-200 rounded-md p-4 font-mono text-sm overflow-x-auto whitespace-nowrap">
<div class="mb-2 text-gray-700">// Import the library</div>
<div class="mb-2"><span class="text-purple-600">import</span> { <span class="text-blue-600">createCredentialsRequest</span>, <span class="text-blue-600">requestCredentials</span>, <span class="text-blue-600">processCredentials</span>, <span class="text-blue-600">generateNonce</span>, <span class="text-blue-600">generateJWK</span>, <span class="text-blue-600">DocumentType</span>, <span class="text-blue-600">Claim</span> } <span class="text-purple-600">from</span> <span class="text-green-600">'id-verifier'</span>;</div>
<div class="mb-2"> </div>
<div class="mb-2 text-gray-700">// Generate required parameters</div>
<div class="mb-2"><span class="text-purple-600">const</span> <span class="text-blue-600">nonce</span> = <span class="text-blue-600">generateNonce</span>();</div>
<div class="mb-2"><span class="text-purple-600">const</span> <span class="text-blue-600">jwk</span> = <span class="text-purple-600">await</span> <span class="text-blue-600">generateJWK</span>();</div>
<div class="mb-2"> </div>
<div class="mb-2 text-gray-700">// Create request parameters</div>
<div class="mb-2"><span class="text-purple-600">const</span> <span class="text-blue-600">requestParams</span> = <span class="text-blue-600">createCredentialsRequest</span>({</div>
<div class="mb-2"> <span class="text-blue-600">documentTypes</span>: [<span id="documentTypesList" class="text-green-600">'org.iso.18013.5.1.mDL'</span>],</div>
<div class="mb-2"> <span class="text-blue-600">claims</span>: [<span id="claimsList" class="text-green-600">'givenName', 'familyName', 'ageOver21'</span>],</div>
<div class="mb-2"> <span class="text-blue-600">nonce</span>,</div>
<div class="mb-2"> <span class="text-blue-600">jwk</span></div>
<div class="mb-2">});</div>
<div class="mb-2"> </div>
<div class="mb-2 text-gray-700">// Request credentials</div>
<div class="mb-2"><span class="text-purple-600">const</span> <span class="text-blue-600">credential</span> = <span class="text-purple-600">await</span> <span class="text-blue-600">requestCredentials</span>(<span class="text-blue-600">requestParams</span>);</div>
<div class="mb-2"> </div>
<div class="mb-2 text-gray-700">// Process and verify the credential</div>
<div class="mb-2"><span class="text-purple-600">const</span> <span class="text-blue-600">result</span> = <span class="text-purple-600">await</span> <span class="text-blue-600">processCredentials</span>(<span class="text-blue-600">credential</span>, { <span class="text-blue-600">nonce</span>, <span class="text-blue-600">jwk</span>, <span class="text-blue-600">origin</span>: <span class="text-green-600">window.location.origin</span> });</div>
</div>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-5 mb-5">
<h2 class="text-xl font-semibold mb-3">How it works</h2>
<ol class="list-decimal list-inside space-y-2 mb-4">
<li><strong>Configure your request</strong> - Select which information you need from what types of documents</li>
<li><strong>Request credentials</strong> - The browser prompts the user to select and share their credentials</li>
<li><strong>User consents</strong> - The user reviews and approves the credential request</li>
<li><strong>Credential is returned</strong> - The browser returns the requested credential data</li>
<li><strong>Backend verifies</strong> - The server validates the credential and extracts information</li>
</ol>
<h3 class="text-lg font-semibold mb-2">Supported Document Types</h3>
<ul class="list-disc list-inside space-y-1 mb-4">
<li>Photo ID (ISO 23220)</li>
<li>EU Personal ID</li>
<li>Japan My Number Card</li>
<li>Mobile Driver's License (ISO 18013-5)</li>
</ul>
<h3 class="text-lg font-semibold mb-2">Supported Protocols</h3>
<ul class="list-disc list-inside space-y-1">
<li>OpenID4VP</li>
<li>ISO mDoc</li>
</ul>
</div>
<div class="bg-gray-50 rounded-lg p-5 mb-5">
<h2 class="text-xl font-semibold mb-3">Browser Support</h2>
<p class="mb-4">This demo requires a browser that supports the Digital Credentials API. Currently, this is an experimental API and may not be available in all browsers.</p>
<p class="mb-3"><strong>Note:</strong> In a real application, you would:</p>
<ul class="list-disc list-inside space-y-1">
<li>Generate the credential request parameters on your backend to secure the nonce and JWK</li>
<li>Send the credential response to your backend for verification</li>
<li>Implement proper error handling and verification fallbacks</li>
<li>Inform users of your data handling practices</li>
<li>Follow data residency and privacy laws</li>
</ul>
</div>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-5 mb-5">
<h2 class="text-xl font-semibold mb-3 text-blue-800">🤝 Help Us Improve</h2>
<p class="mb-3 text-blue-700">This is an open source project and we welcome contributions from the community to make digital identity verification more secure and accessible.</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-white rounded-lg p-4 border border-blue-200">
<h3 class="font-semibold text-blue-800 mb-2">🔧 Contribute Code</h3>
<p class="text-sm text-blue-700 mb-3">Help us add new features, fix bugs, or improve documentation. Every contribution matters!</p>
<p class="text-xs text-blue-600">Issues, pull requests, and feedback are always welcome.</p>
</div>
<div class="bg-white rounded-lg p-4 border border-blue-200">
<h3 class="font-semibold text-blue-800 mb-2">🔒 Security Audits</h3>
<p class="text-sm text-blue-700 mb-3">Security researchers and auditors: please help us identify vulnerabilities and improve our security posture.</p>
<p class="text-xs text-blue-600">Responsible disclosure is appreciated and recognized.</p>
</div>
</div>
</div>
</body>
</html>