@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.33.1-next.2 → 0.33.1-next.68
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/index.cjs +474 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{types/QRCode.types.d.ts → index.d.cts} +70 -5
- package/dist/index.d.ts +269 -8
- package/dist/index.js +441 -22
- package/dist/index.js.map +1 -1
- package/package.json +36 -25
- package/src/siopv2-rp-api-server.ts +1 -1
- package/src/types/QRCode.types.ts +2 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/siop-api-functions.d.ts +0 -9
- package/dist/siop-api-functions.d.ts.map +0 -1
- package/dist/siop-api-functions.js +0 -167
- package/dist/siop-api-functions.js.map +0 -1
- package/dist/siopv2-rp-api-server.d.ts +0 -25
- package/dist/siopv2-rp-api-server.d.ts.map +0 -1
- package/dist/siopv2-rp-api-server.js +0 -81
- package/dist/siopv2-rp-api-server.js.map +0 -1
- package/dist/types/QRCode.types.d.ts.map +0 -1
- package/dist/types/QRCode.types.js +0 -3
- package/dist/types/QRCode.types.js.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/types.d.ts +0 -33
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -3
- package/dist/types/types.js.map +0 -1
- package/dist/webapp-api-functions.d.ts +0 -8
- package/dist/webapp-api-functions.d.ts.map +0 -1
- package/dist/webapp-api-functions.js +0 -200
- package/dist/webapp-api-functions.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,269 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { PresentationDefinitionLocation } from '@sphereon/did-auth-siop';
|
|
2
|
+
import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
|
|
3
|
+
import { Router, Express } from 'express';
|
|
4
|
+
import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
|
|
5
|
+
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
6
|
+
import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
|
|
7
|
+
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
8
|
+
|
|
9
|
+
interface ComponentOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Component options for data/ECC.
|
|
12
|
+
*/
|
|
13
|
+
data?: {
|
|
14
|
+
/**
|
|
15
|
+
* Scale factor for data/ECC dots.
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
scale?: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Component options for timing patterns.
|
|
22
|
+
*/
|
|
23
|
+
timing?: {
|
|
24
|
+
/**
|
|
25
|
+
* Scale factor for timing patterns.
|
|
26
|
+
* @default 1
|
|
27
|
+
*/
|
|
28
|
+
scale?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Protector for timing patterns.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
protectors?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Component options for alignment patterns.
|
|
37
|
+
*/
|
|
38
|
+
alignment?: {
|
|
39
|
+
/**
|
|
40
|
+
* Scale factor for alignment patterns.
|
|
41
|
+
* @default 1
|
|
42
|
+
*/
|
|
43
|
+
scale?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Protector for alignment patterns.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
protectors?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Component options for alignment pattern on the bottom-right corner.
|
|
52
|
+
*/
|
|
53
|
+
cornerAlignment?: {
|
|
54
|
+
/**
|
|
55
|
+
* Scale factor for alignment pattern on the bottom-right corner.
|
|
56
|
+
* @default 1
|
|
57
|
+
*/
|
|
58
|
+
scale?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Protector for alignment pattern on the bottom-right corner.
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
protectors?: boolean;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface QRCodeOpts {
|
|
67
|
+
/**
|
|
68
|
+
* Size of the QR code in pixel.
|
|
69
|
+
*
|
|
70
|
+
* @defaultValue 400
|
|
71
|
+
*/
|
|
72
|
+
size?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Size of margins around the QR code body in pixel.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue 20
|
|
77
|
+
*/
|
|
78
|
+
margin?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Error correction level of the QR code.
|
|
81
|
+
*
|
|
82
|
+
* Accepts a value provided by _QRErrorCorrectLevel_.
|
|
83
|
+
*
|
|
84
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/error_correction.html](https://www.qrcode.com/en/about/error_correction.html).
|
|
85
|
+
*
|
|
86
|
+
* @defaultValue 0
|
|
87
|
+
*/
|
|
88
|
+
correctLevel?: number;
|
|
89
|
+
/**
|
|
90
|
+
* **This is an advanced option.**
|
|
91
|
+
*
|
|
92
|
+
* Specify the mask pattern to be used in QR code encoding.
|
|
93
|
+
*
|
|
94
|
+
* Accepts a value provided by _QRMaskPattern_.
|
|
95
|
+
*
|
|
96
|
+
* 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)
|
|
97
|
+
*
|
|
98
|
+
* 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).
|
|
99
|
+
*/
|
|
100
|
+
maskPattern?: number;
|
|
101
|
+
/**
|
|
102
|
+
* **This is an advanced option.**
|
|
103
|
+
*
|
|
104
|
+
* Specify the version to be used in QR code encoding.
|
|
105
|
+
*
|
|
106
|
+
* Accepts an integer in range [1, 40].
|
|
107
|
+
*
|
|
108
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/version.html](https://www.qrcode.com/en/about/version.html).
|
|
109
|
+
*/
|
|
110
|
+
version?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Options to control components in the QR code.
|
|
113
|
+
*
|
|
114
|
+
* @deafultValue undefined
|
|
115
|
+
*/
|
|
116
|
+
components?: ComponentOptions;
|
|
117
|
+
/**
|
|
118
|
+
* Color of the blocks on the QR code.
|
|
119
|
+
*
|
|
120
|
+
* Accepts a CSS <color>.
|
|
121
|
+
*
|
|
122
|
+
* 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).
|
|
123
|
+
*
|
|
124
|
+
* @defaultValue "#000000"
|
|
125
|
+
*/
|
|
126
|
+
colorDark?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Color of the empty areas on the QR code.
|
|
129
|
+
*
|
|
130
|
+
* Accepts a CSS <color>.
|
|
131
|
+
*
|
|
132
|
+
* 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).
|
|
133
|
+
*
|
|
134
|
+
* @defaultValue "#ffffff"
|
|
135
|
+
*/
|
|
136
|
+
colorLight?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Automatically calculate the _colorLight_ value from the QR code's background.
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue true
|
|
141
|
+
*/
|
|
142
|
+
autoColor?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Background image to be used in the QR code.
|
|
145
|
+
*
|
|
146
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.
|
|
147
|
+
*
|
|
148
|
+
* @defaultValue undefined
|
|
149
|
+
*/
|
|
150
|
+
backgroundImage?: string | Buffer;
|
|
151
|
+
/**
|
|
152
|
+
* Color of the dimming mask above the background image.
|
|
153
|
+
*
|
|
154
|
+
* Accepts a CSS <color>.
|
|
155
|
+
*
|
|
156
|
+
* 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).
|
|
157
|
+
*
|
|
158
|
+
* @defaultValue "rgba(0, 0, 0, 0)"
|
|
159
|
+
*/
|
|
160
|
+
backgroundDimming?: string;
|
|
161
|
+
/**
|
|
162
|
+
* GIF background image to be used in the QR code.
|
|
163
|
+
*
|
|
164
|
+
* @defaultValue undefined
|
|
165
|
+
*/
|
|
166
|
+
gifBackground?: ArrayBuffer;
|
|
167
|
+
/**
|
|
168
|
+
* Use a white margin instead of a transparent one which reveals the background of the QR code on margins.
|
|
169
|
+
*
|
|
170
|
+
* @defaultValue true
|
|
171
|
+
*/
|
|
172
|
+
whiteMargin?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Logo image to be displayed at the center of the QR code.
|
|
175
|
+
*
|
|
176
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.
|
|
177
|
+
*
|
|
178
|
+
* When set to `undefined` or `null`, the logo is disabled.
|
|
179
|
+
*
|
|
180
|
+
* @defaultValue undefined
|
|
181
|
+
*/
|
|
182
|
+
logoImage?: string | Buffer;
|
|
183
|
+
/**
|
|
184
|
+
* Ratio of the logo size to the QR code size.
|
|
185
|
+
*
|
|
186
|
+
* @defaultValue 0.2
|
|
187
|
+
*/
|
|
188
|
+
logoScale?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Size of margins around the logo image in pixels.
|
|
191
|
+
*
|
|
192
|
+
* @defaultValue 6
|
|
193
|
+
*/
|
|
194
|
+
logoMargin?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Corner radius of the logo image in pixels.
|
|
197
|
+
*
|
|
198
|
+
* @defaultValue 8
|
|
199
|
+
*/
|
|
200
|
+
logoCornerRadius?: number;
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated
|
|
203
|
+
*
|
|
204
|
+
* Ratio of the real size to the full size of the blocks.
|
|
205
|
+
*
|
|
206
|
+
* This can be helpful when you want to make more parts of the background visible.
|
|
207
|
+
*
|
|
208
|
+
* @deafultValue 0.4
|
|
209
|
+
*/
|
|
210
|
+
dotScale?: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
type SiopFeatures = 'rp-status' | 'siop';
|
|
214
|
+
interface ISIOPv2RPRestAPIOpts {
|
|
215
|
+
enableFeatures?: SiopFeatures[];
|
|
216
|
+
endpointOpts?: {
|
|
217
|
+
basePath?: string;
|
|
218
|
+
trustProxy?: boolean | Array<string>;
|
|
219
|
+
globalAuth?: GenericAuthArgs & {
|
|
220
|
+
secureSiopEndpoints?: boolean;
|
|
221
|
+
};
|
|
222
|
+
webappCreateAuthRequest?: ICreateAuthRequestWebappEndpointOpts;
|
|
223
|
+
webappDeleteAuthRequest?: ISingleEndpointOpts;
|
|
224
|
+
webappGetDefinitions?: ISingleEndpointOpts;
|
|
225
|
+
webappAuthStatus?: ISingleEndpointOpts;
|
|
226
|
+
siopVerifyAuthResponse?: ISingleEndpointOpts;
|
|
227
|
+
siopGetAuthRequest?: ISingleEndpointOpts;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
231
|
+
siopBaseURI?: string;
|
|
232
|
+
qrCodeOpts?: QRCodeOpts;
|
|
233
|
+
webappAuthStatusPath?: string;
|
|
234
|
+
webappBaseURI?: string;
|
|
235
|
+
responseRedirectURI?: string;
|
|
236
|
+
}
|
|
237
|
+
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
|
|
238
|
+
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
239
|
+
|
|
240
|
+
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts & {
|
|
241
|
+
presentationDefinitionLocation?: PresentationDefinitionLocation;
|
|
242
|
+
}): void;
|
|
243
|
+
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
244
|
+
|
|
245
|
+
declare function createAuthRequestWebappEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
|
|
246
|
+
declare function authStatusWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
247
|
+
declare function removeAuthRequestStateWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
248
|
+
declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
249
|
+
|
|
250
|
+
declare class SIOPv2RPApiServer {
|
|
251
|
+
private readonly _express;
|
|
252
|
+
private readonly _router;
|
|
253
|
+
private readonly _agent;
|
|
254
|
+
private readonly _opts?;
|
|
255
|
+
private readonly _basePath;
|
|
256
|
+
private readonly OID4VP_SWAGGER_URL;
|
|
257
|
+
constructor(args: {
|
|
258
|
+
agent: TAgent<IRequiredPlugins>;
|
|
259
|
+
expressSupport: ExpressSupport;
|
|
260
|
+
opts?: ISIOPv2RPRestAPIOpts;
|
|
261
|
+
});
|
|
262
|
+
private setupSwaggerUi;
|
|
263
|
+
get express(): Express;
|
|
264
|
+
get router(): Router;
|
|
265
|
+
get agent(): TAgent<IPresentationExchange & ISIOPv2RP>;
|
|
266
|
+
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures, authStatusWebappEndpoint, createAuthRequestWebappEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateWebappEndpoint, verifyAuthResponseSIOPv2Endpoint };
|