| <html> |
| |
| <head> |
| <title>Digital Credentials MDocs Test Page</title> |
| </head> |
| <script> |
| async function request(claims) { |
| const mdoc = await navigator.credentials.get({ |
| digital: { |
| requests: [{ |
| protocol: "openid4vp", |
| data: { |
| dcql_query: { |
| credentials: [{ |
| id: "cred1", |
| format: "mso_mdoc", |
| meta: { |
| doctype_value: "org.iso.18013.5.1.mDL" |
| }, |
| claims: claims |
| }] |
| } |
| } |
| }] |
| } |
| }); |
| const token = mdoc.data; |
| document.getElementById("log").textContent += `${token}`; |
| } |
| |
| async function requestAgeOnly() { |
| const claims = [{ |
| path: [ |
| "org.iso.18013.5.1", |
| "age_over_21" |
| ] |
| }]; |
| request(claims); |
| } |
| |
| async function requestAgeAndName() { |
| const claims = [{ |
| path: [ |
| "org.iso.18013.5.1", |
| "age_over_21" |
| ] |
| }, { |
| path: [ |
| "org.iso.18013.5.1", |
| "given_name" |
| ] |
| }]; |
| request(claims); |
| } |
| </script> |
| |
| <body> |
| <button id="request_age_only_button" onclick="requestAgeOnly()">Request Age Only</button> |
| <button id="request_age_and_name_button" onclick="requestAgeAndName()">Request Age and Name</button> |
| <textarea id="log"></textarea> |
| </body> |
| |
| </html> |