@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.32.1-feature.MWALL.715.state.persist.237 → 0.32.1-feature.MWALL.715.state.persist.239
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/dist/siopv2-rp-api-server.d.ts.map +1 -1
- package/dist/siopv2-rp-api-server.js.map +1 -1
- package/dist/types/QRCode.types.d.ts +204 -0
- package/dist/types/QRCode.types.d.ts.map +1 -0
- package/dist/types/QRCode.types.js +3 -0
- package/dist/types/QRCode.types.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/{types.d.ts → types/types.d.ts} +2 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js.map +1 -0
- package/dist/webapp-api-functions.d.ts.map +1 -1
- package/dist/webapp-api-functions.js +34 -7
- package/dist/webapp-api-functions.js.map +1 -1
- package/package.json +15 -14
- package/src/siopv2-rp-api-server.ts +21 -22
- package/src/types/QRCode.types.ts +227 -0
- package/src/types/index.ts +2 -0
- package/src/{types.ts → types/types.ts} +2 -0
- package/src/webapp-api-functions.ts +9 -0
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{types.js → types/types.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siopv2-rp-api-server.d.ts","sourceRoot":"","sources":["../src/siopv2-rp-api-server.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAgB,
|
|
1
|
+
{"version":3,"file":"siopv2-rp-api-server.d.ts","sourceRoot":"","sources":["../src/siopv2-rp-api-server.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAgB,EAAE,OAAO,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAA;AAErE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAShE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAElC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6D;gBACpF,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAAC,cAAc,EAAE,cAAc,CAAC;QAAC,IAAI,CAAC,EAAE,oBAAoB,CAAA;KAAE;IAkClH,OAAO,CAAC,cAAc;IA2BtB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAErD;IAED,IAAI,IAAI,IAAI,oBAAoB,GAAG,SAAS,CAE3C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siopv2-rp-api-server.js","sourceRoot":"","sources":["../src/siopv2-rp-api-server.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAqD;AACrD,uEAAyF;AAIzF,
|
|
1
|
+
{"version":3,"file":"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R,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AApFD,8CAoFC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
export interface ComponentOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Component options for data/ECC.
|
|
4
|
+
*/
|
|
5
|
+
data?: {
|
|
6
|
+
/**
|
|
7
|
+
* Scale factor for data/ECC dots.
|
|
8
|
+
* @default 1
|
|
9
|
+
*/
|
|
10
|
+
scale?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Component options for timing patterns.
|
|
14
|
+
*/
|
|
15
|
+
timing?: {
|
|
16
|
+
/**
|
|
17
|
+
* Scale factor for timing patterns.
|
|
18
|
+
* @default 1
|
|
19
|
+
*/
|
|
20
|
+
scale?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Protector for timing patterns.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
protectors?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Component options for alignment patterns.
|
|
29
|
+
*/
|
|
30
|
+
alignment?: {
|
|
31
|
+
/**
|
|
32
|
+
* Scale factor for alignment patterns.
|
|
33
|
+
* @default 1
|
|
34
|
+
*/
|
|
35
|
+
scale?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Protector for alignment patterns.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
protectors?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Component options for alignment pattern on the bottom-right corner.
|
|
44
|
+
*/
|
|
45
|
+
cornerAlignment?: {
|
|
46
|
+
/**
|
|
47
|
+
* Scale factor for alignment pattern on the bottom-right corner.
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
scale?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Protector for alignment pattern on the bottom-right corner.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
protectors?: boolean;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface QRCodeOpts {
|
|
59
|
+
/**
|
|
60
|
+
* Size of the QR code in pixel.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue 400
|
|
63
|
+
*/
|
|
64
|
+
size?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Size of margins around the QR code body in pixel.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue 20
|
|
69
|
+
*/
|
|
70
|
+
margin?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Error correction level of the QR code.
|
|
73
|
+
*
|
|
74
|
+
* Accepts a value provided by _QRErrorCorrectLevel_.
|
|
75
|
+
*
|
|
76
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/error_correction.html](https://www.qrcode.com/en/about/error_correction.html).
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue 0
|
|
79
|
+
*/
|
|
80
|
+
correctLevel?: number;
|
|
81
|
+
/**
|
|
82
|
+
* **This is an advanced option.**
|
|
83
|
+
*
|
|
84
|
+
* Specify the mask pattern to be used in QR code encoding.
|
|
85
|
+
*
|
|
86
|
+
* Accepts a value provided by _QRMaskPattern_.
|
|
87
|
+
*
|
|
88
|
+
* To find out all eight mask patterns, please refer to [https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg](https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg)
|
|
89
|
+
*
|
|
90
|
+
* For more information, please refer to [https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking](https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking).
|
|
91
|
+
*/
|
|
92
|
+
maskPattern?: number;
|
|
93
|
+
/**
|
|
94
|
+
* **This is an advanced option.**
|
|
95
|
+
*
|
|
96
|
+
* Specify the version to be used in QR code encoding.
|
|
97
|
+
*
|
|
98
|
+
* Accepts an integer in range [1, 40].
|
|
99
|
+
*
|
|
100
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/version.html](https://www.qrcode.com/en/about/version.html).
|
|
101
|
+
*/
|
|
102
|
+
version?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Options to control components in the QR code.
|
|
105
|
+
*
|
|
106
|
+
* @deafultValue undefined
|
|
107
|
+
*/
|
|
108
|
+
components?: ComponentOptions;
|
|
109
|
+
/**
|
|
110
|
+
* Color of the blocks on the QR code.
|
|
111
|
+
*
|
|
112
|
+
* Accepts a CSS <color>.
|
|
113
|
+
*
|
|
114
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
115
|
+
*
|
|
116
|
+
* @defaultValue "#000000"
|
|
117
|
+
*/
|
|
118
|
+
colorDark?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Color of the empty areas on the QR code.
|
|
121
|
+
*
|
|
122
|
+
* Accepts a CSS <color>.
|
|
123
|
+
*
|
|
124
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
125
|
+
*
|
|
126
|
+
* @defaultValue "#ffffff"
|
|
127
|
+
*/
|
|
128
|
+
colorLight?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Automatically calculate the _colorLight_ value from the QR code's background.
|
|
131
|
+
*
|
|
132
|
+
* @defaultValue true
|
|
133
|
+
*/
|
|
134
|
+
autoColor?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Background image to be used in the QR code.
|
|
137
|
+
*
|
|
138
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue undefined
|
|
141
|
+
*/
|
|
142
|
+
backgroundImage?: string | Buffer;
|
|
143
|
+
/**
|
|
144
|
+
* Color of the dimming mask above the background image.
|
|
145
|
+
*
|
|
146
|
+
* Accepts a CSS <color>.
|
|
147
|
+
*
|
|
148
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
149
|
+
*
|
|
150
|
+
* @defaultValue "rgba(0, 0, 0, 0)"
|
|
151
|
+
*/
|
|
152
|
+
backgroundDimming?: string;
|
|
153
|
+
/**
|
|
154
|
+
* GIF background image to be used in the QR code.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue undefined
|
|
157
|
+
*/
|
|
158
|
+
gifBackground?: ArrayBuffer;
|
|
159
|
+
/**
|
|
160
|
+
* Use a white margin instead of a transparent one which reveals the background of the QR code on margins.
|
|
161
|
+
*
|
|
162
|
+
* @defaultValue true
|
|
163
|
+
*/
|
|
164
|
+
whiteMargin?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Logo image to be displayed at the center of the QR code.
|
|
167
|
+
*
|
|
168
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
169
|
+
*
|
|
170
|
+
* When set to `undefined` or `null`, the logo is disabled.
|
|
171
|
+
*
|
|
172
|
+
* @defaultValue undefined
|
|
173
|
+
*/
|
|
174
|
+
logoImage?: string | Buffer;
|
|
175
|
+
/**
|
|
176
|
+
* Ratio of the logo size to the QR code size.
|
|
177
|
+
*
|
|
178
|
+
* @defaultValue 0.2
|
|
179
|
+
*/
|
|
180
|
+
logoScale?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Size of margins around the logo image in pixels.
|
|
183
|
+
*
|
|
184
|
+
* @defaultValue 6
|
|
185
|
+
*/
|
|
186
|
+
logoMargin?: number;
|
|
187
|
+
/**
|
|
188
|
+
* Corner radius of the logo image in pixels.
|
|
189
|
+
*
|
|
190
|
+
* @defaultValue 8
|
|
191
|
+
*/
|
|
192
|
+
logoCornerRadius?: number;
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated
|
|
195
|
+
*
|
|
196
|
+
* Ratio of the real size to the full size of the blocks.
|
|
197
|
+
*
|
|
198
|
+
* This can be helpful when you want to make more parts of the background visible.
|
|
199
|
+
*
|
|
200
|
+
* @deafultValue 0.4
|
|
201
|
+
*/
|
|
202
|
+
dotScale?: number;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=QRCode.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.types.d.ts","sourceRoot":"","sources":["../../src/types/QRCode.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IAED;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,eAAe,CAAC,EAAE;QAChB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;CACF;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAE7B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEjC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,WAAW,CAAA;IAE3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAE3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.types.js","sourceRoot":"","sources":["../../src/types/QRCode.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./QRCode.types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,iDAA8B"}
|
|
@@ -3,6 +3,7 @@ import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
|
|
|
3
3
|
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
4
4
|
import { IAgentContext, ICredentialVerifier } from '@veramo/core';
|
|
5
5
|
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
6
|
+
import { QRCodeOpts } from './QRCode.types';
|
|
6
7
|
export type SiopFeatures = 'rp-status' | 'siop';
|
|
7
8
|
export interface ISIOPv2RPRestAPIOpts {
|
|
8
9
|
enableFeatures?: SiopFeatures[];
|
|
@@ -21,6 +22,7 @@ export interface ISIOPv2RPRestAPIOpts {
|
|
|
21
22
|
}
|
|
22
23
|
export interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
23
24
|
siopBaseURI?: string;
|
|
25
|
+
qrCodeOpts?: QRCodeOpts;
|
|
24
26
|
webappAuthStatusPath?: string;
|
|
25
27
|
web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AAM,CAAA;CAC7B;AAED,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,GAAG,qBAAqB,GAAG,UAAU,CAAA;AACnG,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webapp-api-functions.d.ts","sourceRoot":"","sources":["../src/webapp-api-functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,mBAAmB,EAAqB,MAAM,+BAA+B,CAAA;AAGjG,OAAO,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EAAE,oCAAoC,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAGhF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,oCAAoC,
|
|
1
|
+
{"version":3,"file":"webapp-api-functions.d.ts","sourceRoot":"","sources":["../src/webapp-api-functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,mBAAmB,EAAqB,MAAM,+BAA+B,CAAA;AAGjG,OAAO,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EAAE,oCAAoC,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAGhF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,oCAAoC,QAyDrI;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QA2E7G;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QAoBzH;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QAe3G"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -30,7 +53,7 @@ function createAuthRequestWebappEndpoint(router, context, opts) {
|
|
|
30
53
|
}
|
|
31
54
|
const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/webapp/definitions/:definitionId/auth-requests';
|
|
32
55
|
router.post(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a, _b, _c, _d;
|
|
56
|
+
var _a, _b, _c, _d, _e;
|
|
34
57
|
try {
|
|
35
58
|
// if (!request.agent) throw Error('No agent configured')
|
|
36
59
|
const definitionId = request.params.definitionId;
|
|
@@ -39,22 +62,26 @@ function createAuthRequestWebappEndpoint(router, context, opts) {
|
|
|
39
62
|
}
|
|
40
63
|
const state = (_a = request.body.state) !== null && _a !== void 0 ? _a : short_uuid_1.default.uuid();
|
|
41
64
|
const correlationId = (_b = request.body.correlationId) !== null && _b !== void 0 ? _b : state;
|
|
65
|
+
const qrCodeOpts = (_c = request.body.qrCodeOpts) !== null && _c !== void 0 ? _c : opts === null || opts === void 0 ? void 0 : opts.qrCodeOpts;
|
|
42
66
|
const requestByReferenceURI = (0, ssi_sdk_siopv2_oid4vp_common_1.uriWithBase)(`/siop/definitions/${definitionId}/auth-requests/${state}`, {
|
|
43
67
|
baseURI: opts === null || opts === void 0 ? void 0 : opts.siopBaseURI,
|
|
44
68
|
});
|
|
45
69
|
const responseURI = (0, ssi_sdk_siopv2_oid4vp_common_1.uriWithBase)(`/siop/definitions/${definitionId}/auth-responses/${state}`, { baseURI: opts === null || opts === void 0 ? void 0 : opts.siopBaseURI });
|
|
46
70
|
// first version is for backwards compat
|
|
47
|
-
const responseRedirectURI = (
|
|
71
|
+
const responseRedirectURI = (_d = ('response_redirect_uri' in request.body && request.body.response_redirect_uri)) !== null && _d !== void 0 ? _d : ('responseRedirectURI' in request.body && request.body.responseRedirectURI);
|
|
48
72
|
const authRequestURI = yield context.agent.siopCreateAuthRequestURI(Object.assign({ definitionId,
|
|
49
73
|
correlationId,
|
|
50
74
|
state, nonce: short_uuid_1.default.uuid(), requestByReferenceURI, responseURIType: 'response_uri', responseURI }, (responseRedirectURI && { responseRedirectURI })));
|
|
51
|
-
|
|
52
|
-
|
|
75
|
+
let qrCodeDataUri;
|
|
76
|
+
if (qrCodeOpts) {
|
|
77
|
+
const { AwesomeQR } = yield Promise.resolve().then(() => __importStar(require('awesome-qr')));
|
|
78
|
+
const qrCode = new AwesomeQR(Object.assign(Object.assign({}, qrCodeOpts), { text: authRequestURI }));
|
|
79
|
+
qrCodeDataUri = `data:image/png;base64,${(yield qrCode.draw()).toString('base64')}`;
|
|
80
|
+
}
|
|
81
|
+
const authRequestBody = Object.assign({ correlationId,
|
|
53
82
|
state,
|
|
54
83
|
definitionId,
|
|
55
|
-
authRequestURI,
|
|
56
|
-
authStatusURI: `${(0, ssi_sdk_siopv2_oid4vp_common_1.uriWithBase)((_d = opts === null || opts === void 0 ? void 0 : opts.webappAuthStatusPath) !== null && _d !== void 0 ? _d : '/webapp/auth-status', { baseURI: opts === null || opts === void 0 ? void 0 : opts.webappBaseURI })}`,
|
|
57
|
-
};
|
|
84
|
+
authRequestURI, authStatusURI: `${(0, ssi_sdk_siopv2_oid4vp_common_1.uriWithBase)((_e = opts === null || opts === void 0 ? void 0 : opts.webappAuthStatusPath) !== null && _e !== void 0 ? _e : '/webapp/auth-status', { baseURI: opts === null || opts === void 0 ? void 0 : opts.webappBaseURI })}` }, (qrCodeDataUri && { qrCodeDataUri }));
|
|
58
85
|
console.log(`Auth Request URI data to send back: ${JSON.stringify(authRequestBody)}`);
|
|
59
86
|
return response.json(authRequestBody);
|
|
60
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webapp-api-functions.js","sourceRoot":"","sources":["../src/webapp-api-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webapp-api-functions.js","sourceRoot":"","sources":["../src/webapp-api-functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,0EAyDC;AA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;IACD,MAAM,IAAI,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,mCAAI,qBAAqB,CAAA;IAChD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAA,+BAAS,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,EAAE,CAAO,OAAgB,EAAE,QAAkB,EAAE,EAAE;QACzF,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAA;YAC3D,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAA;YACzB,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,uCAAiB,EAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC/D,CAAC;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api",
|
|
3
|
-
"version": "0.32.1-feature.MWALL.715.state.persist.
|
|
3
|
+
"version": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@sphereon/did-auth-siop": "0.16.1-feature.MWALL.715.397",
|
|
15
|
-
"@sphereon/ssi-express-support": "0.32.1-feature.MWALL.715.state.persist.
|
|
16
|
-
"@sphereon/ssi-sdk.core": "0.32.1-feature.MWALL.715.state.persist.
|
|
17
|
-
"@sphereon/ssi-sdk.credential-validation": "0.32.1-feature.MWALL.715.state.persist.
|
|
18
|
-
"@sphereon/ssi-sdk.kv-store-temp": "0.32.1-feature.MWALL.715.state.persist.
|
|
19
|
-
"@sphereon/ssi-sdk.pd-manager": "0.32.1-feature.MWALL.715.state.persist.
|
|
20
|
-
"@sphereon/ssi-sdk.presentation-exchange": "0.32.1-feature.MWALL.715.state.persist.
|
|
21
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.32.1-feature.MWALL.715.state.persist.
|
|
22
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth": "0.32.1-feature.MWALL.715.state.persist.
|
|
23
|
-
"@sphereon/ssi-types": "0.32.1-feature.MWALL.715.state.persist.
|
|
15
|
+
"@sphereon/ssi-express-support": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
16
|
+
"@sphereon/ssi-sdk.core": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
17
|
+
"@sphereon/ssi-sdk.credential-validation": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
18
|
+
"@sphereon/ssi-sdk.kv-store-temp": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
19
|
+
"@sphereon/ssi-sdk.pd-manager": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
20
|
+
"@sphereon/ssi-sdk.presentation-exchange": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
21
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
22
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
23
|
+
"@sphereon/ssi-types": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
24
24
|
"@veramo/core": "4.2.0",
|
|
25
25
|
"@veramo/credential-w3c": "4.2.0",
|
|
26
|
+
"awesome-qr": "^2.1.5-rc.0",
|
|
26
27
|
"body-parser": "^1.20.2",
|
|
27
28
|
"cookie-parser": "^1.4.6",
|
|
28
29
|
"cors": "^2.8.5",
|
|
@@ -39,9 +40,9 @@
|
|
|
39
40
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
40
41
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
41
42
|
"@sphereon/pex-models": "^2.3.2",
|
|
42
|
-
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.27.1-next.
|
|
43
|
-
"@sphereon/ssi-sdk.data-store": "0.32.1-feature.MWALL.715.state.persist.
|
|
44
|
-
"@sphereon/ssi-sdk.vc-handler-ld-local": "0.32.1-feature.MWALL.715.state.persist.
|
|
43
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.27.1-next.15",
|
|
44
|
+
"@sphereon/ssi-sdk.data-store": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
45
|
+
"@sphereon/ssi-sdk.vc-handler-ld-local": "0.32.1-feature.MWALL.715.state.persist.239+c9749f73",
|
|
45
46
|
"@types/body-parser": "^1.19.5",
|
|
46
47
|
"@types/cookie-parser": "^1.4.7",
|
|
47
48
|
"@types/cors": "^2.8.17",
|
|
@@ -102,5 +103,5 @@
|
|
|
102
103
|
"Authenticator"
|
|
103
104
|
],
|
|
104
105
|
"nx": {},
|
|
105
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "c9749f7356545d8ff9c36c499f56afc0fc9a5ac9"
|
|
106
107
|
}
|
|
@@ -3,7 +3,7 @@ import { copyGlobalAuthToEndpoints, ExpressSupport } from '@sphereon/ssi-express
|
|
|
3
3
|
import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange'
|
|
4
4
|
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth'
|
|
5
5
|
import { TAgent } from '@veramo/core'
|
|
6
|
-
import express, {Express, Request, Response, Router} from 'express'
|
|
6
|
+
import express, { Express, Request, Response, Router } from 'express'
|
|
7
7
|
import { getAuthRequestSIOPv2Endpoint, verifyAuthResponseSIOPv2Endpoint } from './siop-api-functions'
|
|
8
8
|
import { IRequiredPlugins, ISIOPv2RPRestAPIOpts } from './types'
|
|
9
9
|
import {
|
|
@@ -57,29 +57,28 @@ export class SIOPv2RPApiServer {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
private setupSwaggerUi() {
|
|
60
|
-
|
|
61
60
|
fetch(this.OID4VP_SWAGGER_URL)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
.then((res) => res.json())
|
|
62
|
+
.then((swagger) => {
|
|
63
|
+
const apiDocs = `${this._basePath}/api-docs`
|
|
64
|
+
console.log(`[OID4P] API docs available at ${apiDocs}`)
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
this._router.use(
|
|
67
|
+
'/api-docs',
|
|
68
|
+
(req: Request, res: Response, next: any) => {
|
|
69
|
+
const regex = `${apiDocs.replace(/\//, '\/')}`.replace('/oid4vp', '').replace(/\/api-docs.*/, '')
|
|
70
|
+
swagger.servers = [{ url: `${req.protocol}://${req.get('host')}${regex}`, description: 'This server' }]
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
req.swaggerDoc = swagger
|
|
73
|
+
next()
|
|
74
|
+
},
|
|
75
|
+
swaggerUi.serveFiles(swagger, options),
|
|
76
|
+
swaggerUi.setup(),
|
|
77
|
+
)
|
|
78
|
+
})
|
|
79
|
+
.catch((err) => {
|
|
80
|
+
console.log(`[OID4VP] Unable to fetch swagger document: ${err}. Will not host api-docs on this instance`)
|
|
81
|
+
})
|
|
83
82
|
const options = {
|
|
84
83
|
// customCss: '.swagger-ui .topbar { display: none }',
|
|
85
84
|
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export interface ComponentOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Component options for data/ECC.
|
|
4
|
+
*/
|
|
5
|
+
data?: {
|
|
6
|
+
/**
|
|
7
|
+
* Scale factor for data/ECC dots.
|
|
8
|
+
* @default 1
|
|
9
|
+
*/
|
|
10
|
+
scale?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component options for timing patterns.
|
|
15
|
+
*/
|
|
16
|
+
timing?: {
|
|
17
|
+
/**
|
|
18
|
+
* Scale factor for timing patterns.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
|
+
scale?: number
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Protector for timing patterns.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
protectors?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Component options for alignment patterns.
|
|
32
|
+
*/
|
|
33
|
+
alignment?: {
|
|
34
|
+
/**
|
|
35
|
+
* Scale factor for alignment patterns.
|
|
36
|
+
* @default 1
|
|
37
|
+
*/
|
|
38
|
+
scale?: number
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Protector for alignment patterns.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
protectors?: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Component options for alignment pattern on the bottom-right corner.
|
|
49
|
+
*/
|
|
50
|
+
cornerAlignment?: {
|
|
51
|
+
/**
|
|
52
|
+
* Scale factor for alignment pattern on the bottom-right corner.
|
|
53
|
+
* @default 1
|
|
54
|
+
*/
|
|
55
|
+
scale?: number
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Protector for alignment pattern on the bottom-right corner.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
protectors?: boolean
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface QRCodeOpts {
|
|
66
|
+
/**
|
|
67
|
+
* Size of the QR code in pixel.
|
|
68
|
+
*
|
|
69
|
+
* @defaultValue 400
|
|
70
|
+
*/
|
|
71
|
+
size?: number
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Size of margins around the QR code body in pixel.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue 20
|
|
77
|
+
*/
|
|
78
|
+
margin?: number
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Error correction level of the QR code.
|
|
82
|
+
*
|
|
83
|
+
* Accepts a value provided by _QRErrorCorrectLevel_.
|
|
84
|
+
*
|
|
85
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/error_correction.html](https://www.qrcode.com/en/about/error_correction.html).
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue 0
|
|
88
|
+
*/
|
|
89
|
+
correctLevel?: number
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* **This is an advanced option.**
|
|
93
|
+
*
|
|
94
|
+
* Specify the mask pattern to be used in QR code encoding.
|
|
95
|
+
*
|
|
96
|
+
* Accepts a value provided by _QRMaskPattern_.
|
|
97
|
+
*
|
|
98
|
+
* To find out all eight mask patterns, please refer to [https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg](https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg)
|
|
99
|
+
*
|
|
100
|
+
* For more information, please refer to [https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking](https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking).
|
|
101
|
+
*/
|
|
102
|
+
maskPattern?: number
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* **This is an advanced option.**
|
|
106
|
+
*
|
|
107
|
+
* Specify the version to be used in QR code encoding.
|
|
108
|
+
*
|
|
109
|
+
* Accepts an integer in range [1, 40].
|
|
110
|
+
*
|
|
111
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/version.html](https://www.qrcode.com/en/about/version.html).
|
|
112
|
+
*/
|
|
113
|
+
version?: number
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Options to control components in the QR code.
|
|
117
|
+
*
|
|
118
|
+
* @deafultValue undefined
|
|
119
|
+
*/
|
|
120
|
+
components?: ComponentOptions
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Color of the blocks on the QR code.
|
|
124
|
+
*
|
|
125
|
+
* Accepts a CSS <color>.
|
|
126
|
+
*
|
|
127
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue "#000000"
|
|
130
|
+
*/
|
|
131
|
+
colorDark?: string
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Color of the empty areas on the QR code.
|
|
135
|
+
*
|
|
136
|
+
* Accepts a CSS <color>.
|
|
137
|
+
*
|
|
138
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue "#ffffff"
|
|
141
|
+
*/
|
|
142
|
+
colorLight?: string
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Automatically calculate the _colorLight_ value from the QR code's background.
|
|
146
|
+
*
|
|
147
|
+
* @defaultValue true
|
|
148
|
+
*/
|
|
149
|
+
autoColor?: boolean
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Background image to be used in the QR code.
|
|
153
|
+
*
|
|
154
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue undefined
|
|
157
|
+
*/
|
|
158
|
+
backgroundImage?: string | Buffer
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Color of the dimming mask above the background image.
|
|
162
|
+
*
|
|
163
|
+
* Accepts a CSS <color>.
|
|
164
|
+
*
|
|
165
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
166
|
+
*
|
|
167
|
+
* @defaultValue "rgba(0, 0, 0, 0)"
|
|
168
|
+
*/
|
|
169
|
+
backgroundDimming?: string
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* GIF background image to be used in the QR code.
|
|
173
|
+
*
|
|
174
|
+
* @defaultValue undefined
|
|
175
|
+
*/
|
|
176
|
+
gifBackground?: ArrayBuffer
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Use a white margin instead of a transparent one which reveals the background of the QR code on margins.
|
|
180
|
+
*
|
|
181
|
+
* @defaultValue true
|
|
182
|
+
*/
|
|
183
|
+
whiteMargin?: boolean
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Logo image to be displayed at the center of the QR code.
|
|
187
|
+
*
|
|
188
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
189
|
+
*
|
|
190
|
+
* When set to `undefined` or `null`, the logo is disabled.
|
|
191
|
+
*
|
|
192
|
+
* @defaultValue undefined
|
|
193
|
+
*/
|
|
194
|
+
logoImage?: string | Buffer
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Ratio of the logo size to the QR code size.
|
|
198
|
+
*
|
|
199
|
+
* @defaultValue 0.2
|
|
200
|
+
*/
|
|
201
|
+
logoScale?: number
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Size of margins around the logo image in pixels.
|
|
205
|
+
*
|
|
206
|
+
* @defaultValue 6
|
|
207
|
+
*/
|
|
208
|
+
logoMargin?: number
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Corner radius of the logo image in pixels.
|
|
212
|
+
*
|
|
213
|
+
* @defaultValue 8
|
|
214
|
+
*/
|
|
215
|
+
logoCornerRadius?: number
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @deprecated
|
|
219
|
+
*
|
|
220
|
+
* Ratio of the real size to the full size of the blocks.
|
|
221
|
+
*
|
|
222
|
+
* This can be helpful when you want to make more parts of the background visible.
|
|
223
|
+
*
|
|
224
|
+
* @deafultValue 0.4
|
|
225
|
+
*/
|
|
226
|
+
dotScale?: number
|
|
227
|
+
}
|
|
@@ -3,6 +3,7 @@ import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange'
|
|
|
3
3
|
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth'
|
|
4
4
|
import { IAgentContext, ICredentialVerifier } from '@veramo/core'
|
|
5
5
|
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager'
|
|
6
|
+
import { QRCodeOpts } from './QRCode.types'
|
|
6
7
|
|
|
7
8
|
export type SiopFeatures = 'rp-status' | 'siop'
|
|
8
9
|
export interface ISIOPv2RPRestAPIOpts {
|
|
@@ -20,6 +21,7 @@ export interface ISIOPv2RPRestAPIOpts {
|
|
|
20
21
|
}
|
|
21
22
|
export interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
22
23
|
siopBaseURI?: string
|
|
24
|
+
qrCodeOpts?: QRCodeOpts
|
|
23
25
|
webappAuthStatusPath?: string
|
|
24
26
|
webappBaseURI?: string
|
|
25
27
|
responseRedirectURI?: string
|
|
@@ -22,6 +22,7 @@ export function createAuthRequestWebappEndpoint(router: Router, context: IRequir
|
|
|
22
22
|
}
|
|
23
23
|
const state: string = request.body.state ?? uuid.uuid()
|
|
24
24
|
const correlationId = request.body.correlationId ?? state
|
|
25
|
+
const qrCodeOpts = request.body.qrCodeOpts ?? opts?.qrCodeOpts
|
|
25
26
|
|
|
26
27
|
const requestByReferenceURI = uriWithBase(`/siop/definitions/${definitionId}/auth-requests/${state}`, {
|
|
27
28
|
baseURI: opts?.siopBaseURI,
|
|
@@ -42,12 +43,20 @@ export function createAuthRequestWebappEndpoint(router: Router, context: IRequir
|
|
|
42
43
|
responseURI,
|
|
43
44
|
...(responseRedirectURI && { responseRedirectURI }),
|
|
44
45
|
})
|
|
46
|
+
|
|
47
|
+
let qrCodeDataUri: string | undefined
|
|
48
|
+
if (qrCodeOpts) {
|
|
49
|
+
const { AwesomeQR } = await import('awesome-qr')
|
|
50
|
+
const qrCode = new AwesomeQR({ ...qrCodeOpts, text: authRequestURI })
|
|
51
|
+
qrCodeDataUri = `data:image/png;base64,${(await qrCode.draw())!.toString('base64')}`
|
|
52
|
+
}
|
|
45
53
|
const authRequestBody: GenerateAuthRequestURIResponse = {
|
|
46
54
|
correlationId,
|
|
47
55
|
state,
|
|
48
56
|
definitionId,
|
|
49
57
|
authRequestURI,
|
|
50
58
|
authStatusURI: `${uriWithBase(opts?.webappAuthStatusPath ?? '/webapp/auth-status', { baseURI: opts?.webappBaseURI })}`,
|
|
59
|
+
...(qrCodeDataUri && { qrCodeDataUri }),
|
|
51
60
|
}
|
|
52
61
|
console.log(`Auth Request URI data to send back: ${JSON.stringify(authRequestBody)}`)
|
|
53
62
|
return response.json(authRequestBody)
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAA;AAC/C,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAA;IAC/B,Y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