@sphereon/did-auth-siop-web-demo-client 0.1.3-next.3

Sign up to get free protection for your applications and to get access to all the features.
package/.env ADDED
@@ -0,0 +1,2 @@
1
+ PORT=3000
2
+ REACT_APP_QR_CODE_EXPIRES_AFTER_SEC=30
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Getting Started with Create React App
2
+
3
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `yarn start`
10
+
11
+ Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
+
14
+ The page will reload if you make edits.\
15
+ You will also see any lint errors in the console.
16
+
17
+ ### `yarn test`
18
+
19
+ Launches the test runner in the interactive watch mode.\
20
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
+
22
+ ### `yarn build`
23
+
24
+ Builds the app for production to the `build` folder.\
25
+ It correctly bundles React in production mode and optimizes the build for the best performance.
26
+
27
+ The build is minified and the filenames include the hashes.\
28
+ Your app is ready to be deployed!
29
+
30
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
+
32
+ ### `yarn eject`
33
+
34
+ **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
+
36
+ If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
+
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
+
40
+ You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
+
42
+ ## Learn More
43
+
44
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
+
46
+ To learn React, check out the [React documentation](https://reactjs.org/).
47
+
48
+ ### Code Splitting
49
+
50
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51
+
52
+ ### Analyzing the Bundle Size
53
+
54
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55
+
56
+ ### Making a Progressive Web App
57
+
58
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59
+
60
+ ### Advanced Configuration
61
+
62
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63
+
64
+ ### Deployment
65
+
66
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67
+
68
+ ### `yarn build` fails to minify
69
+
70
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
@@ -0,0 +1,5 @@
1
+ const {override, addBabelPlugin} = require('customize-cra')
2
+
3
+ module.exports = override(
4
+ addBabelPlugin("@babel/plugin-proposal-nullish-coalescing-operator")
5
+ );
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@sphereon/did-auth-siop-web-demo-client",
3
+ "version": "0.1.3-next.3",
4
+ "private": false,
5
+ "license": "Apache-2.0",
6
+ "dependencies": {
7
+ "@material-ui/core": "^4.12.3",
8
+ "@sphereon/did-auth-siop": "^0.2.12-next.3",
9
+ "@sphereon/did-auth-siop-web-demo-shared": "0.1.3-next.10",
10
+ "@sphereon/ssi-sdk-waci-pex-qr-react": "^0.6.1-next.6",
11
+ "@testing-library/jest-dom": "^5.11.4",
12
+ "@testing-library/react": "^11.1.0",
13
+ "@testing-library/user-event": "^12.1.10",
14
+ "axios": "^0.21.4",
15
+ "bootstrap": "^5.1.1",
16
+ "jsonpack": "^1.1.5",
17
+ "react": "^17.0.2",
18
+ "react-bootstrap": "^1.6.3",
19
+ "react-dom": "^17.0.2",
20
+ "react-loader-spinner": "^4.0.0",
21
+ "react-router": "^5.2.1",
22
+ "react-router-dom": "^5.3.0",
23
+ "react-scripts": "4.0.3",
24
+ "ts-loader": "^9.2.5",
25
+ "typescript": "4.4.3",
26
+ "underscore.string": "^3.3.5",
27
+ "web-vitals": "^1.0.1"
28
+ },
29
+ "type": "module",
30
+ "scripts": {
31
+ "start": "react-scripts start",
32
+ "build": "react-scripts build",
33
+ "test": "react-scripts test",
34
+ "eject": "react-scripts eject"
35
+ },
36
+ "eslintConfig": {
37
+ "extends": [
38
+ "react-app",
39
+ "react-app/jest"
40
+ ]
41
+ },
42
+ "browserslist": {
43
+ "production": [
44
+ ">0.2%",
45
+ "not dead",
46
+ "not op_mini all"
47
+ ],
48
+ "development": [
49
+ "last 1 chrome version",
50
+ "last 1 firefox version",
51
+ "last 1 safari version"
52
+ ]
53
+ },
54
+ "proxy": "http://localhost:5001",
55
+ "devDependencies": {
56
+ "@types/js-cookie": "^2.2.7",
57
+ "@types/jsonpack": "^1.1.1",
58
+ "@types/lodash": "^4.14.173",
59
+ "@types/node": "^16.9.1",
60
+ "@types/react": "^17.0.20",
61
+ "@types/react-dom": "^17.0.9",
62
+ "@types/react-router": "^5.1.16",
63
+ "@types/react-router-dom": "^5.1.9",
64
+ "@types/underscore.string": "^0.0.38"
65
+ }
66
+ }
Binary file
Binary file
package/public/bg.png ADDED
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="667.92273" height="568.25004" viewBox="0 0 667.92273 568.25004" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M687.17828,243.295c-6.31,13.07-17.91992,22.8-30.08007,30.72a190.20416,190.20416,0,0,1-41.29981,20.18c-2,.7-4.02,1.37-6.04,2h-86.48c-.56006-.64-1.1001-1.31-1.62011-2-5.42969-7.18-8.33985-16.27-7.25-25.18,1.43017-11.68,10.30029-22.42,21.81-24.91,11.51026-2.48,24.62989,4.39,28.12012,15.63,1.93018-21.67,4.1499-44.25,15.66992-62.71,10.43018-16.71,28.51026-28.67,48.08985-30.81a60.55966,60.55966,0,0,1,33.48047,6.12994c.9497.48,1.88964.98,2.80957,1.5a56.01663,56.01663,0,0,1,16.14013,13.77C692.73834,203.075,695.72858,225.545,687.17828,243.295Z" transform="translate(-266.03864 -165.87498)" fill="#f2f2f2"/><path d="M664.38825,173.845a1.522,1.522,0,0,1-.61963,1.37006,316.96271,316.96271,0,0,0-90.3501,118.98c-.30029.66-.58984,1.33-.87012,2h-3.98c.27979-.67.56006-1.34.8501-2q5.68506-13.26,12.56982-25.98a321.831,321.831,0,0,1,34.89991-51.66,317.07019,317.07019,0,0,1,44.27-43.95,1.92277,1.92277,0,0,1,.42041-.26A2.0375,2.0375,0,0,1,664.38825,173.845Z" transform="translate(-266.03864 -165.87498)" fill="#fff"/><path d="M666.03864,294.195h-381a18.8896,18.8896,0,0,0-9.36036,2.47,18.52541,18.52541,0,0,0-1.96972,1.29,18.96417,18.96417,0,0,0-7.66992,15.24v198a19.01691,19.01691,0,0,0,19,19h381a19.01722,19.01722,0,0,0,19-19v-198A19.01722,19.01722,0,0,0,666.03864,294.195Zm17,217a17.02443,17.02443,0,0,1-17,17h-381a17.02411,17.02411,0,0,1-17-17v-198a17.09476,17.09476,0,0,1,11.77978-16.18c.14014-.04.27-.09.41016-.13a16.99649,16.99649,0,0,1,4.81006-.69h381a17.02442,17.02442,0,0,1,17,17Z" transform="translate(-266.03864 -165.87498)" fill="#3f3d56"/><path d="M803.257,552.46721a10.74273,10.74273,0,0,0,1.964-16.35513l5.972-71.21065-17.10528,1.88141L789.40147,536.091A10.80091,10.80091,0,0,0,803.257,552.46721Z" transform="translate(-266.03864 -165.87498)" fill="#ffb8b8"/><polygon points="476.337 556.443 464.077 556.442 458.245 509.154 476.339 509.155 476.337 556.443" fill="#ffb8b8"/><path d="M455.3202,552.93915h23.64387a0,0,0,0,1,0,0V567.826a0,0,0,0,1,0,0H440.43334a0,0,0,0,1,0,0v0A14.88685,14.88685,0,0,1,455.3202,552.93915Z" fill="#2f2e41"/><polygon points="563.337 556.443 551.077 556.442 545.245 509.154 563.339 509.155 563.337 556.443" fill="#ffb8b8"/><path d="M542.3202,552.93915h23.64387a0,0,0,0,1,0,0V567.826a0,0,0,0,1,0,0H527.43334a0,0,0,0,1,0,0v0A14.88686,14.88686,0,0,1,542.3202,552.93915Z" fill="#2f2e41"/><path d="M742.58237,693.02991c-.13282,0-.26636-.00586-.40064-.0166l-17.35181-1.38867a4.99972,4.99972,0,0,1-4.53759-5.78223l26.3081-162.71973,1.76221-22.95117a4.97171,4.97171,0,0,1,3.91626-4.501l26.46142-5.78808a4.96761,4.96761,0,0,1,5.19532,2.06055l6.45215,9.43066a110.39937,110.39937,0,0,0,8.24487,10.50879c4.57788,5.21387,12.36157,16.79,13.05981,35.73535a126.60915,126.60915,0,0,0,1.93384,18.55371l21.30347,114.76074a4.99837,4.99837,0,0,1-4.43921,5.76465l-16.44849,1.2461a4.97915,4.97915,0,0,1-5.302-3.67969l-29.17676-108.501a.99984.99984,0,0,0-1.93188.00293L747.4122,689.316A5.00546,5.00546,0,0,1,742.58237,693.02991Z" transform="translate(-266.03864 -165.87498)" fill="#2f2e41"/><circle cx="522.6869" cy="225.70313" r="24.56103" fill="#ffb8b8"/><path d="M747.096,503.86389l-.5083-35.07422c-1.87061-22.43261,8.064-34.21093,16.72778-40.13574a19.91866,19.91866,0,0,1,15.40332-2.94824l19.32959,4.17871a20.37247,20.37247,0,0,1,13.05493,9.29688,19.0207,19.0207,0,0,1,2.17236,15.00781,20.59705,20.59705,0,0,1-8.39965,11.50195C788.26718,477.41565,787.097,497.11,787.087,497.30823l-.02026.40723Z" transform="translate(-266.03864 -165.87498)" fill="#f51c22"/><path d="M807.58774,477.78284h-17a4.50508,4.50508,0,0,1-4.5-4.5v-29.5a13,13,0,1,1,26,0v29.5A4.50508,4.50508,0,0,1,807.58774,477.78284Z" transform="translate(-266.03864 -165.87498)" fill="#f51c22"/><path d="M693.44939,483.35582a11.03583,11.03583,0,0,1-16.49657.47722c-9.68635-10.15879,6.148-25.41276,15.87108-15.2321h0a10.67752,10.67752,0,0,1,.95239,1.12011l49.02808-1.21875,5.85205-10.70312,17.98486,6.9834c-3.45266,5.35453-7.41739,26.36974-16.448,25.34668C749.00924,490.161,694.66017,483.44219,693.44939,483.35582Z" transform="translate(-266.03864 -165.87498)" fill="#ffb8b8"/><path d="M759.03661,475.25744l-13.70531-10.058a4.50507,4.50507,0,0,1-.96545-6.2903l17.45368-23.78275a13,13,0,1,1,20.96107,15.38291L765.32692,474.292A4.50508,4.50508,0,0,1,759.03661,475.25744Z" transform="translate(-266.03864 -165.87498)" fill="#f51c22"/><path d="M793.64511,404.34429a9.11113,9.11113,0,0,0-1.56015-10.15884c-4.62059-4.65884-11.83959-1.55137-18.08423-2.00752-10.4014-.75979-17.48511-13.16327-14.38025-23.11949s14.142-16.13441,24.55055-15.47933,19.832,7.09371,26.10525,15.42511c4.29392-6.91089,14.84339-7.71688,21.65162-3.262s10.33071,12.59614,11.78665,20.601,1.21817,16.23137,2.44413,24.27469c2.97175,19.49717,15.55523,37.85661,33.76319,45.43559s41.50776,2.70808,53.41972-13.01057a86.77,86.77,0,0,1-54.20135,91.15379c-9.86688,3.90544-20.763,5.97889-31.1503,3.80821-16.7697-3.50442-29.81372-17.84626-35.49835-34.00759s-5.00405-33.89472-2.24317-50.80274c1.7005-10.41417,3.58377-22.748-4.01165-30.07306a18.24258,18.24258,0,0,0-7.33545-3.6983A9.80151,9.80151,0,0,1,793.3127,405Q793.49755,404.67349,793.64511,404.34429Z" transform="translate(-266.03864 -165.87498)" fill="#2f2e41"/><path d="M881.81786,734.125h-228a1,1,0,0,1,0-2h228a1,1,0,1,1,0,2Z" transform="translate(-266.03864 -165.87498)" fill="#3f3d56"/><path d="M475.12211,412.11086a8.98713,8.98713,0,0,1-4.33887-1.11865L271.74,301.43947a.99991.99991,0,0,1,.96435-1.75195L471.7476,409.24026a6.98192,6.98192,0,0,0,6.64135.05859L680.70853,302.56936a.99981.99981,0,1,1,.93311,1.76855L479.32206,411.0674A8.99244,8.99244,0,0,1,475.12211,412.11086Z" transform="translate(-266.03864 -165.87498)" fill="#3f3d56"/><path d="M329.60527,480.19485h-28a8,8,0,0,1,0-16h28a8,8,0,0,1,0,16Z" transform="translate(-266.03864 -165.87498)" fill="#3f3d56"/><path d="M362.60527,507.19485h-61a8,8,0,0,1,0-16h61a8,8,0,0,1,0,16Z" transform="translate(-266.03864 -165.87498)" fill="#3f3d56"/><circle cx="209.00364" cy="246.31986" r="32" fill="#f51c22"/></svg>
Binary file
Binary file
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>Demo SIOPv2 + OIDC4VP</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root" style="background-image: url('image.png'); background-repeat-x: no-repeat; background-repeat-y: no-repeat; background-size: cover; " ></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="372.19333" height="664.46398" viewBox="0 0 372.19333 664.46398" xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="5.50001" width="326" height="594" rx="58.72835" fill="#3f3d56"/><path d="M739.9038,176.50034v476.54a53.29169,53.29169,0,0,1-53.23,53.23h-208.54a53.29169,53.29169,0,0,1-53.23-53.23v-476.54a53.29173,53.29173,0,0,1,53.23-53.23h27.27v9.42a16.08093,16.08093,0,0,0,16.08,16.08c35.30487,10.66486,76.7467,9.00025,121.84,0a16.0809,16.0809,0,0,0,16.08-16.08v-9.42h27.27A53.29174,53.29174,0,0,1,739.9038,176.50034Z" transform="translate(-413.90333 -117.76801)" fill="#fff"/><path d="M417.90333,238.268a4.00459,4.00459,0,0,1-4-4v-8a4,4,0,1,1,8,0v8A4.00458,4.00458,0,0,1,417.90333,238.268Z" transform="translate(-413.90333 -117.76801)" fill="#3f3d56"/><path d="M417.90334,279.2895a4.00458,4.00458,0,0,1-4-4l0-22.02148a4,4,0,1,1,8,0l0,22.02148A4.00458,4.00458,0,0,1,417.90334,279.2895Z" transform="translate(-413.90333 -117.76801)" fill="#3f3d56"/><path d="M417.90334,312.268a4.00458,4.00458,0,0,1-4-4V286.24653a4,4,0,0,1,8,0V308.268A4.00459,4.00459,0,0,1,417.90334,312.268Z" transform="translate(-413.90333 -117.76801)" fill="#3f3d56"/><path d="M745.90474,232.54a3.99675,3.99675,0,0,0-4,3.99v53.74a4,4,0,0,0,8,0V236.53A4.00322,4.00322,0,0,0,745.90474,232.54Z" transform="translate(-413.90333 -117.76801)" fill="#3f3d56"/><path d="M493.48923,146.84106h-27a5,5,0,0,1,0-10h27a5,5,0,0,1,0,10Z" transform="translate(-413.90333 -117.76801)" fill="#e6e6e6"/><path d="M650.36238,647.49546c-7.52435.47107-11.6828-8.87732-5.99017-14.3258.20843-.82825.358-1.4231.56634-2.25147q-.11178-.27063-.225-.54052c-7.60931-18.14429-23.01678-7.9582-40.94256.1521-14.78485,6.6892-29.68671,15.404-17.32129,49.33618,2.59741,7.12768-.51764,15.19629,1.15271,22.583A263.25839,263.25839,0,0,1,563.6548,593.10936a254.10063,254.10063,0,0,1,1.57611-28.34668q1.30572-11.57393,3.62286-22.983a267.54547,267.54547,0,0,1,35.9173-89.193q-3.29562.04431-6.60223.07141-5.94984,9.71466-11.08942,19.89075a100.252,100.252,0,0,0,.38507-19.849c-26.7309-.00952-53.44208-.8645-77.05841-2.56482.89581,72.37872,27.61322,87.47192,60.3764,52.80652.91748.47046,1.81159.94079,2.729,1.38806a273.58182,273.58182,0,0,0-14.72608,69.30164,259.47434,259.47434,0,0,0,.18824,41.89636q-.03543-.2472-.07062-.494a68.56539,68.56539,0,0,0-23.40656-39.59094C517.4839,560.646,492.03554,555.197,472.60316,543.30345c-9.35418-5.72534-21.34088,1.67334-19.70831,12.51831q.03909.25964.07947.51941a75.33161,75.33161,0,0,1,8.44507,4.06945q2.34145,1.32129,4.5841,2.8042c8.52069,5.63538,5.57593,18.844-4.52014,20.40247l-.22882.035c-.16461.02369-.30579.04725-.47022.0708a111.64546,111.64546,0,0,0,20.53632,32.15723c2.40912,74.33795,41.52173,64.7522,83.3692,36.58h.02362a273.50284,273.50284,0,0,0,18.37238,53.63488h65.6319c.23541-.72924.447-1.48217.65887-2.21142a74.57779,74.57779,0,0,1-18.16077-1.08179c4.86957-5.97534,9.739-11.99756,14.60846-17.97265a4.08882,4.08882,0,0,0,.30585-.35279c2.47-3.0581,4.96356-6.09277,7.43353-9.15075l.00135-.00379a109.22845,109.22845,0,0,0-3.20057-27.82519Z" transform="translate(-413.90333 -117.76801)" fill="#f51c22"/><path d="M580.42744,420.79563c-6.36712-15.3601-18.30139-28.29626-28.81091-41.57495-12.62366-15.94983-38.50964-8.989-40.73364,11.22974q-.03233.2937-.063.58716,2.34154,1.32091,4.5841,2.8042c8.52076,5.63525,5.576,18.84387-4.52014,20.40234l-.22857.03516a111.55107,111.55107,0,0,0,2.94042,16.67871,101.22388,101.22388,0,0,0-3.18957,19.177c23.61633,1.70032,50.32751,2.5553,77.05841,2.56482C586.59791,440.94334,583.98372,429.36692,580.42744,420.79563Z" transform="translate(-413.90333 -117.76801)" fill="#e6e6e6"/><path d="M649.1407,401.33006a54.06007,54.06007,0,0,0,4.91656-14.77307c-1.43487.18823-5.41058-21.6659-4.3283-23.00659-1.99976-3.03455-5.57892-4.543-7.763-7.504-10.862-14.72669-25.82709-12.15528-33.63947,7.85693-16.68915,8.4231-16.85065,22.39209-6.61029,35.82715,6.51495,8.54736,7.41009,20.113,13.12653,29.26367-.5882.75293-1.19983,1.48218-1.78791,2.23511a263.6194,263.6194,0,0,0-16.886,24.42883q3.30633-.02691,6.60223-.07141a259.31316,259.31316,0,0,1,16.894-23.67529A70.8715,70.8715,0,0,0,649.1407,401.33006Z" transform="translate(-413.90333 -117.76801)" fill="#e6e6e6"/><path d="M739.242,176.28384v254.54c0,29.35-315,29.35-315,0v-254.54a53.29173,53.29173,0,0,1,53.23-53.23h27.27v9.42a16.08091,16.08091,0,0,0,16.08,16.08c33.80536,10.61731,75.53937,8.86946,121.84,0a16.08092,16.08092,0,0,0,16.08-16.08v-9.42h27.27A53.29174,53.29174,0,0,1,739.242,176.28384Z" transform="translate(-413.90333 -117.76801)" opacity="0.1"/><path d="M611.69472,203.79h-9a13.01442,13.01442,0,0,0-13,13v10h-16a13.01442,13.01442,0,0,0-13,13v20a13.01442,13.01442,0,0,0,13,13h20a13.01443,13.01443,0,0,0,13-13v-20a13.01443,13.01443,0,0,0-13-13h-2v-10a11.01245,11.01245,0,0,1,11-11h9a11.01245,11.01245,0,0,1,11,11v11h2v-11A13.01443,13.01443,0,0,0,611.69472,203.79Zm-7,36v20a11.01245,11.01245,0,0,1-11,11h-20a11.01245,11.01245,0,0,1-11-11v-20a11.01245,11.01245,0,0,1,11-11c9.46936,5.50931,14.6864,2.65979,20,0A11.01245,11.01245,0,0,1,604.69472,239.79Z" transform="translate(-413.90333 -117.76801)" fill="#fff"/><path d="M583.69472,258.79a9,9,0,1,0-9-9A9.01047,9.01047,0,0,0,583.69472,258.79Zm0-11c3.85986,0,7-1.85986,7,2a7,7,0,1,1-14,0C576.69472,245.93016,579.83485,247.79,583.69472,247.79Z" transform="translate(-413.90333 -117.76801)" fill="#fff"/><circle cx="169.79138" cy="132.02201" r="3" fill="#fff"/><rect x="328.79138" y="144.02201" width="7.21002" height="2" fill="#fff"/><path d="M424.69472,425.84251v5c0,29.35,315.00006,29.35,315.00006,0v-5C739.69478,455.19255,424.69472,455.19255,424.69472,425.84251Z" transform="translate(-413.90333 -117.76801)" opacity="0.1"/><path d="M702.92212,497.38583a7.66482,7.66482,0,0,0,6.019-8.83539,7.35338,7.35338,0,0,0-.32684-1.17085l20.48877-17.18278-5.061-13.46408-25.52221,26.57279a7.64356,7.64356,0,0,0-4.32567,8.2685,7.31488,7.31488,0,0,0,8.53095,5.8513h0Q702.82388,497.40695,702.92212,497.38583Z" transform="translate(-413.90333 -117.76801)" fill="#a0616a"/><path d="M712.56955,395.9963l-8.125,6.47911s-9.70985,17.6533-2.74979,21.31461,28.59761,15.8377,28.59761,15.8377-8.94252,8.90234-9.99734,13.22609,1.2801,8.16554-2.42595,7.26141-3.81138,2.04-4.71552,5.74613-6.9308,7.11915-6.9308,7.11915L717.74237,481.48s5.33213,1.883,5.76928-2.59141-.77732-3.8432,2.92873-2.93907,6.82893-4.89531,8.80281-10.3037S757.357,435.06358,757.357,435.06358l-21.07131-23.44831a55.99761,55.99761,0,0,0-23.71613-15.619Z" transform="translate(-413.90333 -117.76801)" fill="#f51c22"/><polygon points="296.815 645.673 288.426 645.602 284.713 612.491 297.094 612.596 296.815 645.673" fill="#a0616a"/><path d="M683.84838,776.78025a3.75542,3.75542,0,0,0,3.71838,3.78334l16.67866.13917,2.91983-5.91847,1.07238,5.94865,6.29322.05708-1.58913-21.21673-2.18949-.14567-8.93065-.61562-2.88122-.19294-.05055,6.003-13.398,9.08746A3.74906,3.74906,0,0,0,683.84838,776.78025Z" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/><polygon points="219.799 645.673 211.411 645.602 207.697 612.491 220.078 612.596 219.799 645.673" fill="#a0616a"/><path d="M606.83287,776.78025a3.75543,3.75543,0,0,0,3.71838,3.78334l16.67867.13917,2.91983-5.91847,1.07238,5.94865,6.29321.05708-1.58912-21.21673-2.1895-.14567-8.93065-.61562-2.88121-.19294-.05056,6.003-13.398,9.08746A3.74909,3.74909,0,0,0,606.83287,776.78025Z" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/><path d="M655.40562,483.05509s-16.10772,7.93487-11.90849,12.7113.74772,7.47723-4.48634,11.96357-15.77119,57.03982-15.77119,57.03982l-13.64408,81.40908s3.62009,71.08438,6.04955,73.616,6.16808-1.207,2.42946,2.53166-6.72951.74772-3.73861,3.73862,3.73861,11.21585,3.73861,11.21585l19.376-1.6329s12.61222-54.6393,4.09532-78.84383l33.412-88.54468,10.10128,85.43659s5.54452,69.37807,9.28314,71.62124,6.43216,2.39441,3.21608,5.30968-3.21608-1.57106-3.21608,2.91528v7.44128l18.087,2.48262s8.40124-66.51072,4.50366-97.28745L728.73759,542.873l-9.19568-46.55314-9.4974-12.517Z" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/><path d="M577.67692,457.876a7.66484,7.66484,0,0,0,10.58468-1.50252,7.35381,7.35381,0,0,0,.64523-1.03023l26.50085,3.56975,6.54257-12.80976-36.83156-.9652a7.64359,7.64359,0,0,0-9.02508,2.37228,7.31487,7.31487,0,0,0,1.42144,10.24667l0,0Q577.59515,457.81757,577.67692,457.876Z" transform="translate(-413.90333 -117.76801)" fill="#a0616a"/><path d="M659.11412,396.71312l-10.26166-1.6412s-12.31635,6.72441-10.33438,14.33488.28484,29.79459.28484,29.79459-12.60334-.61319-16.50961,1.51954-5.17306,6.44625-7.0011,3.098.09945-5.125-3.24879-3.2969-14.10485,3.35461-14.10485,3.35461l-4.32416,14.7238s6.00781,8.26149,9.60939,5.57074,4.31037-6.69963,6.13841-3.35141,2.33794,9.58924,7.66495,7.40521,43.37929-12.0939,43.37929-12.0939l4.59907-45.97384Z" transform="translate(-413.90333 -117.76801)" fill="#f51c22"/><path d="M649.0992,494.40635s-7.24515-11.56321-5.86576-13.25884,3.107,1.23541,0-1.72555,14.31692-22.7215,15.46124-25.63194S641.254,400.0578,641.254,400.0578l15.82877-9.53341,13.378-18.82142,23.9257,3.82759,8.41812,17.06417L714.69472,396.79l1,1v31s5.29174,26.46053-6.3509,35.5703c0,0,5.555,12.10068,4.05955,14.34385s25.393,31.7186,4.29135,35.08585C694.58058,517.47843,645.27748,493.099,649.0992,494.40635Z" transform="translate(-413.90333 -117.76801)" fill="#f51c22"/><path d="M530.42662,781.042a1.18647,1.18647,0,0,0,1.19007,1.19h253.29a1.19,1.19,0,1,0,0-2.38h-253.29A1.1865,1.1865,0,0,0,530.42662,781.042Z" transform="translate(-413.90333 -117.76801)" fill="#ccc"/><circle cx="272.04477" cy="234.28323" r="24.36323" fill="#a0616a"/><path d="M704.774,334.03962c-.25072-2.19259-1.75349-4.90251-2.79881-6.84612s-3.06386-3.53086-5.26657-3.39541a5.61774,5.61774,0,0,0-4.30378,2.92477,11.78117,11.78117,0,0,0-1.33878,5.20131,27.24121,27.24121,0,0,0,8.858,21.6906c1.70752,1.53143,3.76246,2.89432,6.05554,2.94619a7.81088,7.81088,0,0,0,5.53181-2.48805c3.71167-3.71719,4.2729-9.82825,2.29062-14.69288s-2.86687-6.75757-7.3982-9.41485" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/><path d="M670.54865,369.07982c.40744,2.16759-3.341,12.476-2.14317,14.33387,0,0,12.40376,4.30822,17.14642,4.61788,5.79385.37481,10.45385-2.00208,15.87288-5.57945a12.16611,12.16611,0,0,1,1.63794-5.50865,7.3713,7.3713,0,0,0,.766,3.76479c20.29577-5.04187,15.32715-23.25519,3.069-31.78808l-8.14889-18.74245c2.44467.81489-4.93507-11.77582-12.71724-2.65722-9.73793-9.91723-28.60243,4.35955-30.96593,17.11268,2.27437-2.87857,3.4589-2.53917,4.04222-.55407a11.22523,11.22523,0,0,1,3.09638-4.32712,9.38217,9.38217,0,0,0-1.01046,4.327c15.36063.95341,12.50169,11.31619-.08849,26.83986,4.65576-2.89827,1.514,9.591,4,12.57626C665.22744,381.409,670.10862,371.10889,670.54865,369.07982Z" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/><path d="M692.71555,349.12077a.815.815,0,0,0,.22243-1.59875,9.87188,9.87188,0,0,1-.05571-3.03514c.265-4.50138.70865-12.03512-6.60545-17.12061a.8147.8147,0,0,0-.93028,1.33772c6.56367,4.56425,6.16976,11.258,5.90874,15.687-.14881,2.5322-.25664,4.36133,1.27923,4.70948A.80939.80939,0,0,0,692.71555,349.12077Z" transform="translate(-413.90333 -117.76801)" fill="#f51c22"/><path d="M692.33576,331.31055A45.96173,45.96173,0,0,1,707.9869,327.842c4.26733-.18084,9.35859.7707,11.09332,4.67371,1.05238,2.36778.49173,5.14315-.47093,7.54881s-5.46163,7.262-2.87106,7.209c6.50672-.133,9.28418,5.68533,5.98346,14.72653-1.9143,5.24353,9.96372,5.04178,15.50145,5.7436-4.16056,1.54366-8.38488,3.102-12.8071,3.47222s-9.145-.59106-12.44682-3.55608c-3.573-3.2086-4.946-8.19208-5.55375-12.95573s-.63921-9.6697-2.254-14.19234-5.324-8.73453-10.10946-9.13562" transform="translate(-413.90333 -117.76801)" fill="#2f2e41"/></svg>
Binary file
package/src/App.css ADDED
@@ -0,0 +1,49 @@
1
+ .App {
2
+ text-align: center;
3
+ padding: 40px;
4
+ }
5
+
6
+ .App-logo {
7
+ height: 40vmin;
8
+ pointer-events: none;
9
+ }
10
+
11
+ @media (prefers-reduced-motion: no-preference) {
12
+ .App-logo {
13
+ animation: App-logo-spin infinite 20s linear;
14
+ }
15
+ }
16
+
17
+ .App-header {
18
+ background-color: #353438;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: end;
22
+ font-size: calc(10px + 2vmin);
23
+ color: white;
24
+ padding: 4px 10px;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ .btn-primary {
32
+ color: #fff;
33
+ background-color: #0495c9;
34
+ border-color: #357ebd; /*set the color you want here*/
35
+ }
36
+
37
+ .kvkCredential{
38
+ color: #ffffff;
39
+ text-underline-style: none;
40
+ }
41
+
42
+ @keyframes App-logo-spin {
43
+ from {
44
+ transform: rotate(0deg);
45
+ }
46
+ to {
47
+ transform: rotate(360deg);
48
+ }
49
+ }
@@ -0,0 +1,8 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import App from './App';
3
+
4
+ test('renders learn react link', () => {
5
+ render(<App />);
6
+ const linkElement = screen.getByText(/learn react/i);
7
+ expect(linkElement).toBeInTheDocument();
8
+ });
package/src/App.tsx ADDED
@@ -0,0 +1,160 @@
1
+ import "./App.css"
2
+ import React, {Component} from "react"
3
+ import {BrowserRouter as Router, Route, Switch} from 'react-router-dom'
4
+ import Button from '@material-ui/core/Button';
5
+ import AuthenticationModal from "./components/AuthenticationModal"
6
+ import {AuthResponse} from "@sphereon/did-auth-siop-web-demo-shared"
7
+ import jsonpack from "jsonpack"
8
+ import Nav from "./components/Nav"
9
+ import Landing from "./pages/Landing"
10
+ import Secret from "./pages/Secret"
11
+ import Classified from "./pages/Classified"
12
+ import {Col, Container, Image, Row} from "react-bootstrap"
13
+
14
+
15
+ export type AppState = {
16
+ showAuthenticationModal?: boolean
17
+ authResponse?: AuthResponse
18
+ }
19
+
20
+
21
+ class App extends Component<AppState> {
22
+
23
+ state: AppState = {}
24
+ private readonly _stateStorageKey = "state-onto-app"
25
+
26
+ constructor(props: AppState, context: any) {
27
+ super(props, context)
28
+ this.initState()
29
+ }
30
+
31
+ render() {
32
+ this.saveState()
33
+ const authResponse = this.state.authResponse as AuthResponse
34
+ return (
35
+ <div>
36
+ <style type="text/css">
37
+ {`
38
+ .btn-sphereon {
39
+ background-color: #e8261f;
40
+ color: white;
41
+ border-radius: 0px;
42
+ }
43
+
44
+ .btn-sphereon:hover {
45
+ background-color: #ba1e19;
46
+ color: white;
47
+ border-radius: 0px;
48
+ }
49
+
50
+ .btn-sphereon2 {
51
+ background-color: #352575;
52
+ color: white;
53
+ border-radius: 0px;
54
+ }
55
+
56
+ .btn-sphereon2:hover {
57
+ background-color: #ba1e19;
58
+ color: white;
59
+ border-radius: 0px;
60
+ }
61
+ `}
62
+ </style>
63
+ <header className="App-header">
64
+ {/*<img style={{height: 50}}*/}
65
+ {/* src="https://sphereon.com/content/themes/sphereon/assets/img/logo.png?auto=compress&cs=tinysrgb&h=10"*/}
66
+ {/* alt="new"*/}
67
+ {/*/>*/}
68
+ {this.signInOutButtons()}
69
+ </header>
70
+ <Router>
71
+ <div style={{display: "flex"}}>
72
+ <Nav AuthResponse={authResponse}/>
73
+ <Switch>
74
+ <Route path="/secret">
75
+ <Secret AuthResponse={authResponse}/>
76
+ </Route>
77
+ <Route path="/classified">
78
+ <Classified AuthResponse={authResponse}/>
79
+ </Route>
80
+ <Route path="/"><Landing/></Route>
81
+ </Switch>
82
+ <AuthenticationModal show={this.state.showAuthenticationModal as boolean}
83
+ onCloseClicked={this.hideLoginDialog}
84
+ onSignInComplete={this.completeSignIn}/>
85
+ </div>
86
+ </Router>
87
+ </div>
88
+ )
89
+ }
90
+
91
+ private showLoginDialog = () => {
92
+ this.setState({showAuthenticationModal: true})
93
+ }
94
+
95
+ private hideLoginDialog = () => {
96
+ this.setState({showAuthenticationModal: false})
97
+ }
98
+
99
+ private completeSignIn = (authResponse: AuthResponse) => {
100
+ this.setState({showAuthenticationModal: false, authResponse: authResponse})
101
+ }
102
+
103
+ private signOut = () => {
104
+ this.setState({authResponse: undefined})
105
+ }
106
+
107
+ private initState() {
108
+ let storedState = sessionStorage.getItem(this._stateStorageKey)
109
+ if (storedState != null) {
110
+ this.loadState(storedState)
111
+ } else {
112
+ this.setState({showAuthenticationModal: false})
113
+ }
114
+ }
115
+
116
+ private loadState = (storedState: string) => {
117
+ // eslint-disable-next-line react/no-direct-mutation-state
118
+ this.state = jsonpack.unpack(storedState) as AppState
119
+ }
120
+
121
+
122
+ private saveState = () => {
123
+ sessionStorage.setItem(this._stateStorageKey, jsonpack.pack(this.state))
124
+ }
125
+
126
+ private signInOutButtons = () => {
127
+ const authResponse = this.state.authResponse as AuthResponse
128
+ if (authResponse) {
129
+ return (<Container fluid>
130
+ <Row className="align-items-center">
131
+
132
+ <Col className="col">
133
+ <h5>{authResponse.naam} ({authResponse.kvkNummer})</h5>
134
+ </Col>
135
+ <Col className="col-1">
136
+ <Button style={{width: "90%", backgroundColor:'red', color: "white"}} onClick={this.signOut} variant="contained" >Sign out</Button>
137
+ </Col>
138
+ </Row>
139
+ </Container>
140
+ )
141
+ } else {
142
+ return (<Container fluid>
143
+ <Row>
144
+ <Col className="col-10">
145
+ <img style={{height: 30}}
146
+ src="https://sphereon.com/content/themes/sphereon/assets/img/logo-wit.svg?auto=compress&cs=tinysrgb&h=10"
147
+ alt="new"
148
+ />
149
+ </Col>
150
+ <Col className="col-1">
151
+ <Button style={{width: "90%", backgroundColor:'red', color: "white"}} onClick={this.showLoginDialog} variant="contained" >Sign in</Button>
152
+ </Col>
153
+ </Row>
154
+ </Container>
155
+ )
156
+ }
157
+ }
158
+ }
159
+
160
+ export default App
package/src/agent.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { createAgent } from '@veramo/core'
2
+
3
+ import {WaciQrCodeProvider, WaciTypes} from "@sphereon/ssi-sdk-waci-pex-qr-react";
4
+
5
+ const agent = createAgent<WaciTypes>({
6
+ plugins: [
7
+ new WaciQrCodeProvider()
8
+ ]
9
+ })
10
+
11
+ export const createOobQrCode = agent.createOobQrCode
12
+ export default agent
@@ -0,0 +1,73 @@
1
+ import {Button, Col, Container, Modal, Row} from "react-bootstrap"
2
+ import {Component} from "react"
3
+ import {AuthResponse} from "@sphereon/did-auth-siop-web-demo-shared"
4
+ import AuthenticationQR from "./AuthenticationQR";
5
+
6
+ /* This is a container dialog for the QR code component. It re emits the onSignInComplete callback. */
7
+
8
+ export type AuthenticationModalProps = {
9
+ show?: boolean
10
+ onCloseClicked?: () => void
11
+ onSignInComplete: (AuthResponse: AuthResponse) => void
12
+ }
13
+
14
+ interface AuthenticationModalState {
15
+ authRequestCreated: boolean
16
+ }
17
+
18
+ export default class AuthenticationModal extends Component<AuthenticationModalProps, AuthenticationModalState> {
19
+
20
+ private readonly scanText = "Please scan this QR code using your app.";
21
+ private readonly authText = "Please approve the authentication request in your app.";
22
+
23
+ constructor(props: AuthenticationModalProps) {
24
+ super(props)
25
+ this.state = {authRequestCreated: false}
26
+ }
27
+
28
+ render() {
29
+ return <Modal show={this.props.show} animation={true} style={{
30
+ height: "100%",
31
+ marginTop: "200px"
32
+ }}>
33
+ <Modal.Header style={{
34
+ display: "flex",
35
+ justifyContent: "center",
36
+ backgroundColor: "#352575",
37
+ color: "white",
38
+ alignItems: "center",
39
+ }}>
40
+ <Modal.Title>Authentication</Modal.Title>
41
+ </Modal.Header>
42
+
43
+ <Modal.Body>
44
+ <Container>
45
+ <Row>
46
+ <Col className="d-flex justify-content-center">
47
+ <h6>{this.state.authRequestCreated ? this.authText : this.scanText}</h6>
48
+ </Col>
49
+ </Row>
50
+ <Row>
51
+ <Col className="d-flex justify-content-center" style={{paddingTop: "10px"}}>
52
+ <AuthenticationQR
53
+ onAuthRequestCreated={() => {
54
+ this.setState({authRequestCreated: true})
55
+ }}
56
+ onSignInComplete={(AuthResponse) =>
57
+ this.props.onSignInComplete(AuthResponse)}/>
58
+ </Col>
59
+ </Row>
60
+
61
+ </Container>
62
+ </Modal.Body>
63
+
64
+ <Modal.Footer>
65
+ <Button variant="secondary" onClick={this.handleClose}>Cancel</Button>
66
+ </Modal.Footer>
67
+ </Modal>
68
+ }
69
+
70
+ private handleClose = () => {
71
+ this.props.onCloseClicked?.()
72
+ }
73
+ }
@@ -0,0 +1,159 @@
1
+ import React, {Component} from "react"
2
+ import axios from "axios"
3
+ import Loader from "react-loader-spinner"
4
+ import {
5
+ AuthResponse,
6
+ QRVariables,
7
+ StateMapping
8
+ } from "@sphereon/did-auth-siop-web-demo-shared"
9
+ import {
10
+ AcceptMode,
11
+ GoalCode,
12
+ OobPayload,
13
+ OobQRProps, QRContent,
14
+ QRType
15
+ } from "@sphereon/ssi-sdk-waci-pex-qr-react";
16
+ import {createOobQrCode} from '../agent';
17
+
18
+ export type AuthenticationQRProps = {
19
+ onAuthRequestCreated: () => void
20
+ onSignInComplete: (AuthResponse: AuthResponse) => void
21
+ }
22
+
23
+ export interface AuthenticationQRState {
24
+ qrVariables?: QRVariables
25
+ qrCode?: Element
26
+ }
27
+
28
+ export default class AuthenticationQR extends Component<AuthenticationQRProps> {
29
+
30
+ state: AuthenticationQRState = {}
31
+
32
+ private registerStateSent: boolean = false
33
+ private refreshTimerHandle?: NodeJS.Timeout
34
+ private qrExpiryMs: number = 0
35
+ private currentStateMapping?: StateMapping
36
+ private timedOutRequestMappings: Set<StateMapping> = new Set<StateMapping>()
37
+ private _isMounted: boolean = false
38
+
39
+
40
+ componentDidMount() {
41
+ this.qrExpiryMs = parseInt(process.env.REACT_APP_QR_CODE_EXPIRES_AFTER_SEC) * 1000
42
+ if (!this.state.qrCode) {
43
+ this.getQRVariables().then(qrVariables => {
44
+ createOobQrCode(this.createOobQRProps(qrVariables as QRVariables)).then(qr => {
45
+ return this.setState({qrVariables, qrCode: qr})
46
+ })
47
+ }).catch(e=> console.error(e))
48
+ this.refreshTimerHandle = setTimeout(() => this.refreshQR(), this.qrExpiryMs)
49
+ }
50
+ this._isMounted = true
51
+ }
52
+
53
+ createOobQRProps(qrVariables: QRVariables): OobQRProps {
54
+ console.log("qrVariables:",qrVariables)
55
+ const oobBaseUrl = qrVariables.redirectUrl as string + '?oob=';
56
+ return {
57
+ oobBaseUrl,
58
+ type: QRType.DID_AUTH_SIOP_V2,
59
+ body: {
60
+ goalCode: GoalCode.STREAMLINED_VP,
61
+ accept: [AcceptMode.SIOPV2_WITH_OIDC4VP],
62
+ },
63
+ id: qrVariables.id,
64
+ from: qrVariables.requestorDID as string,
65
+ onGenerate: (oobQRProps: OobQRProps, payload: OobPayload) => {
66
+ this.registerState(qrVariables)
67
+ },
68
+ bgColor: 'white',
69
+ fgColor: '#352575',
70
+ level: 'L',
71
+ size: 250,
72
+ title: 'Sign in'
73
+ }
74
+ }
75
+ componentWillUnmount() {
76
+ if (this.refreshTimerHandle) {
77
+ clearTimeout(this.refreshTimerHandle)
78
+ }
79
+ this._isMounted = false
80
+ }
81
+
82
+ render() {
83
+ // Show the loader until we have details on which parameters to load into the QR code
84
+ return <div>{this.state.qrCode}</div>//this.state.qrCode
85
+ //
86
+ //<Loader type="BallTriangle" color="#352575" height="100" width="100"/>
87
+ }
88
+
89
+ /* Get the parameters that need to go into the QR code from the server. (We don't want to build/pack a new frontend version for every change to the QR code.) */
90
+ private getQRVariables = async () => {
91
+ const response = await axios.get("/backend/get-qr-variables")
92
+ const body = await response.data
93
+
94
+ if (response.status !== 200) {
95
+ throw Error(body.message)
96
+ }
97
+ return body
98
+ }
99
+
100
+ /* We don't want to keep used and unused states indefinitely, so expire the QR code after a configured timeout */
101
+ private refreshQR = () => {
102
+ console.log("Timeout expired, refreshing QR code...")
103
+ if (this.qrExpiryMs > 0) {
104
+ if (this.currentStateMapping) {
105
+ this.timedOutRequestMappings.add(this.currentStateMapping)
106
+ }
107
+ this.registerStateSent = false
108
+ if (this.state.qrVariables) {
109
+ createOobQrCode(this.createOobQRProps(this.state.qrVariables)).then(qr => {
110
+ return this.setState({qrCode: qr});
111
+ })
112
+ } else {
113
+ throw "qrVariables not defined";
114
+ }
115
+ }
116
+ }
117
+
118
+ /* Register the state along with the redirect URL in the backend */
119
+ private registerState = (qrVariables: QRVariables) => {
120
+ if (this.registerStateSent) return
121
+ this.registerStateSent = true
122
+
123
+ const stateMapping: StateMapping = new StateMapping()
124
+ stateMapping.stateId = qrVariables.id
125
+ stateMapping.redirectUrl = qrVariables.redirectUrl
126
+ stateMapping.sessionId = qrVariables.requestorDID
127
+ axios.post("/backend/register-state", stateMapping)
128
+ .then(response => {
129
+ console.log("register-state response status", response.status)
130
+ if (response.status !== 200) {
131
+ throw Error(response.data.message)
132
+ }
133
+ this.currentStateMapping = stateMapping
134
+ this.pollForResponse(stateMapping)
135
+ })
136
+ .catch(error => console.error("register-state failed", error))
137
+ }
138
+
139
+ /* Poll the backend until we get a response, abort when the component is unloaded or the QR code expired */
140
+ private pollForResponse = async (stateMapping: StateMapping) => {
141
+ let pollingResponse = await axios.post("/backend/poll-auth-response", {stateId: stateMapping.stateId})
142
+ while (pollingResponse.status === 202 && this._isMounted && !this.timedOutRequestMappings.has(stateMapping)) {
143
+ if (this.state.qrCode && pollingResponse.data && pollingResponse.data.authRequestCreated) {
144
+ this.setState({qrCode: undefined})
145
+ this.props.onAuthRequestCreated()
146
+ }
147
+ pollingResponse = await axios.post("/backend/poll-auth-response", {stateId: stateMapping.stateId})
148
+ }
149
+ if (this.timedOutRequestMappings.has(stateMapping)) {
150
+ console.log("Cancelling timed out auth request.")
151
+ await axios.post("/backend/cancel-auth-request", {stateId: stateMapping.stateId})
152
+ this.timedOutRequestMappings.delete(stateMapping)
153
+ } else if (pollingResponse.status === 200) {
154
+ this.props.onSignInComplete(pollingResponse.data as AuthResponse)
155
+ } else {
156
+ return Promise.reject(pollingResponse.data.message)
157
+ }
158
+ }
159
+ }
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import {Link} from 'react-router-dom';
3
+ import ProtectedResource from "../pages/ProtectedResource";
4
+ import Button from '@material-ui/core/Button';
5
+
6
+
7
+ export default class Nav extends ProtectedResource {
8
+
9
+ render() {
10
+ return (
11
+ <div
12
+ style={{
13
+ padding: "10px",
14
+ width: "14em",
15
+ height: "60em",
16
+ background: "rgb(53 52 56 / 95%)",
17
+ justifyContent: 'center',
18
+ alignItems: "center"
19
+ }}
20
+ >
21
+ <ul style={{listStyleType: "none", padding: 0}}>
22
+ <li>
23
+ <Link to="/" style={{textDecoration: "none"}}>
24
+ <Button style={{width: "90%", backgroundColor:'red', color: "white", marginBottom: 10}} variant="contained" >Home</Button>
25
+ </Link>
26
+ </li>
27
+ {this.protectedResources()}
28
+ </ul>
29
+ </div>
30
+ );
31
+ }
32
+
33
+ private protectedResources() {
34
+ if (this.isAuthenticated()) {
35
+ return <div style={{justifyContent: 'center', alignItems: "center"}}>
36
+ <li>
37
+ <Link to="/secret" style={{textDecoration: "none"}}>
38
+ <Button style={{width: "90%", backgroundColor:'red', color: "white", marginBottom: 10}} variant="contained" >secret page</Button>
39
+ </Link>
40
+ </li>
41
+ <li>
42
+ <Link to="/classified" style={{textDecoration: "none"}}>
43
+ <Button style={{width: "90%", backgroundColor:'red', color: "white", marginBottom: 10}} variant="contained" >classified page</Button>
44
+ </Link>
45
+ </li>
46
+ </div>;
47
+ } else {
48
+ return <div style={{justifyContent: 'center', alignItems: "center"}}>
49
+ <li>
50
+ <Link to="/classified" style={{textDecoration: "none"}}>
51
+ <Button style={{width: "90%", backgroundColor:'red', color: "white", marginBottom: 10}} variant="contained" >classified page</Button>
52
+ </Link>
53
+ </li>
54
+ </div>;
55
+ }
56
+ }
57
+ }
package/src/index.css ADDED
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import './index.css';
4
+ import App from './App';
5
+ import reportWebVitals from './reportWebVitals';
6
+ import 'bootstrap/dist/css/bootstrap.min.css';
7
+
8
+
9
+ ReactDOM.render(
10
+ // <React.StrictMode>
11
+ <App />,
12
+ // </React.StrictMode>,
13
+ document.getElementById('root')
14
+ );
15
+
16
+ // If you want to start measuring performance in your app, pass a function
17
+ // to log results (for example: reportWebVitals(console.log))
18
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
19
+ reportWebVitals();
package/src/logo.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
@@ -0,0 +1,22 @@
1
+ import React from "react"
2
+ import ProtectedResource from "./ProtectedResource";
3
+
4
+ export default class Landing extends ProtectedResource {
5
+
6
+ render() {
7
+ if (this.isAuthenticated()) {
8
+ return (
9
+ <div className="App" style={{
10
+ backgroundImage: `url("930-W.jpg")`,
11
+ backgroundRepeat: "no-repeat",
12
+ backgroundSize: "cover",
13
+ width:"100%"}}>
14
+ <img src="classified.svg" alt="logo"/>
15
+ <h5>The classified page</h5>
16
+ </div>
17
+ )
18
+ } else {
19
+ return this.accessDenied();
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,19 @@
1
+ import React, {Component} from "react";
2
+
3
+ export default class Landing extends Component {
4
+ render() {
5
+ return (
6
+ <div className="App" style={{ width: 750}}>
7
+ <h2 style={{textAlign: 'left'}}>
8
+ Welcome to the SSI demo
9
+ </h2>
10
+
11
+ <p style={{textAlign: "left" }}>This demo is using Presentation Exchange to fetch claims of the authorized users, with an associated 'wallet' app that securely holds the data as Verifiable Credentials (VCs).</p>
12
+
13
+ <p style={{textAlign: "left"}}>An example of company data as a Verifiable Credentials could be an extract from Chamber of Commerce, bank account details and the Ultimate Beneficial Owner (UBO). The data is validated and digitally signed in the process of issuing a Verifiable Credential by so-called "Issuers". Typically these are trusted parties like for example the Chamber of Commerce, the bank, a public notary, etc.. After issuance they are stored in the SSI-Wallet.</p>
14
+
15
+ <p style={{textAlign: "left"}}>By then sharing this data as a Verifiable Presentations, the requesting party, a "Verifier:" – like for example a Telco – receiving the data can automatically import the data and verify its authenticity.</p>
16
+ </div>
17
+ )
18
+ }
19
+ }
@@ -0,0 +1,25 @@
1
+ import {AuthResponse} from "@sphereon/did-auth-siop-web-demo-shared"
2
+ import React, {Component} from "react"
3
+ import {isBlank} from "underscore.string"
4
+
5
+ export type ProtectedResourceProps = {
6
+ AuthResponse: AuthResponse
7
+ }
8
+
9
+
10
+ export default class ProtectedResource extends Component<ProtectedResourceProps> {
11
+
12
+
13
+ protected isAuthenticated(): boolean {
14
+ return this.props.AuthResponse && !isBlank(this.props.AuthResponse.kvkNummer as string)
15
+ }
16
+
17
+
18
+ protected accessDenied() {
19
+ return (
20
+ <div className="App">
21
+ <img src="access-denied.jpg" alt="logo" width="50%"/>
22
+ </div>
23
+ )
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ import React from "react"
2
+ import ProtectedResource from "./ProtectedResource";
3
+
4
+ export default class Landing extends ProtectedResource {
5
+
6
+ render() {
7
+ if (this.isAuthenticated()) {
8
+ return (
9
+ <div className="App" style={{
10
+ backgroundImage: `url("930-W.jpg")`,
11
+ backgroundRepeat: "no-repeat",
12
+ backgroundSize: "cover",
13
+ width:"100%"}}>
14
+ <img src="secret.svg" alt="logo" width="350px"/>
15
+ <h5>The secret page</h5>
16
+ </div>
17
+ )
18
+ } else {
19
+ return this.accessDenied();
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="react-scripts" />
2
+
3
+ declare global {
4
+ namespace NodeJS {
5
+ interface ProcessEnv {
6
+ NODE_ENV: 'development' | 'production';
7
+ PORT?: string;
8
+ REACT_APP_QR_CODE_EXPIRES_AFTER_SEC : '300';
9
+ }
10
+ }
11
+ }
12
+
13
+ // If this file has no import/export statements (i.e. is a script)
14
+ // convert it into a module by adding an empty export statement.
15
+ export {}
@@ -0,0 +1,13 @@
1
+ const reportWebVitals = onPerfEntry => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;
@@ -0,0 +1,5 @@
1
+ // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
+ // allows you to do things like:
3
+ // expect(element).toHaveTextContent(/react/i)
4
+ // learn more: https://github.com/testing-library/jest-dom
5
+ import '@testing-library/jest-dom';
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "./dist",
4
+ "target": "es6",
5
+ "lib": [
6
+ "DOM",
7
+ "ES6",
8
+ "DOM.Iterable",
9
+ "ScriptHost",
10
+ "ES2016.Array.Include"
11
+ ],
12
+ "allowJs": true,
13
+ "skipLibCheck": true,
14
+ "esModuleInterop": true,
15
+ "allowSyntheticDefaultImports": true,
16
+ "strict": true,
17
+ "forceConsistentCasingInFileNames": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "module": "esnext",
20
+ "moduleResolution": "node",
21
+ "resolveJsonModule": true,
22
+ "isolatedModules": true,
23
+ "noEmit": true,
24
+ "jsx": "react-jsx"
25
+ },
26
+ "include": [
27
+ "./src/**/*"
28
+ ]
29
+ }