@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.34.1-fix.182 → 0.34.1-fix.223
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 +59 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -74
- package/dist/index.d.ts +6 -74
- package/dist/index.js +59 -74
- package/dist/index.js.map +1 -1
- package/package.json +21 -19
- package/src/siop-api-functions.ts +34 -16
- package/src/types/types.ts +8 -39
- package/src/universal-oid4vp-api-functions.ts +39 -27
- package/src/schemas/index.ts +0 -36
- package/src/webapp-api-functions.ts +0 -183
package/dist/index.d.ts
CHANGED
|
@@ -1,61 +1,10 @@
|
|
|
1
1
|
import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
|
|
2
2
|
import { Request, Response, Router, Express } from 'express';
|
|
3
|
-
import {
|
|
4
|
-
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
3
|
+
import { CreateAuthorizationRequestPayload, CreateAuthorizationResponsePayload, VerifiedData } from '@sphereon/did-auth-siop';
|
|
5
4
|
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
6
|
-
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
7
5
|
import { AuthorizationRequestStateStatus, AuthorizationResponseStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { ResponseType, ResponseMode } from '@sphereon/did-auth-siop';
|
|
11
|
-
|
|
12
|
-
declare const CreateAuthorizationRequestBodySchema: z.ZodObject<{
|
|
13
|
-
query_id: z.ZodString;
|
|
14
|
-
client_id: z.ZodOptional<z.ZodString>;
|
|
15
|
-
request_uri_base: z.ZodOptional<z.ZodString>;
|
|
16
|
-
correlation_id: z.ZodOptional<z.ZodString>;
|
|
17
|
-
request_uri_method: z.ZodOptional<z.ZodEnum<{
|
|
18
|
-
get: "get";
|
|
19
|
-
post: "post";
|
|
20
|
-
}>>;
|
|
21
|
-
response_type: z.ZodOptional<z.ZodEnum<{
|
|
22
|
-
vp_token: ResponseType.VP_TOKEN;
|
|
23
|
-
}>>;
|
|
24
|
-
response_mode: z.ZodOptional<z.ZodEnum<{
|
|
25
|
-
direct_post: ResponseMode.DIRECT_POST;
|
|
26
|
-
"direct_post.jwt": ResponseMode.DIRECT_POST_JWT;
|
|
27
|
-
}>>;
|
|
28
|
-
transaction_data: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
-
qr_code: z.ZodOptional<z.ZodObject<{
|
|
30
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
color_dark: z.ZodOptional<z.ZodString>;
|
|
32
|
-
color_light: z.ZodOptional<z.ZodString>;
|
|
33
|
-
}, z.core.$strip>>;
|
|
34
|
-
direct_post_response_redirect_uri: z.ZodOptional<z.ZodString>;
|
|
35
|
-
callback: z.ZodOptional<z.ZodObject<{
|
|
36
|
-
url: z.ZodString;
|
|
37
|
-
verified_data: z.ZodOptional<z.ZodObject<{
|
|
38
|
-
modes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
39
|
-
authorization_response: _sphereon_did_auth_siop.VerifiedDataMode.AUTHORIZATION_RESPONSE;
|
|
40
|
-
credential_claims_deserialized: _sphereon_did_auth_siop.VerifiedDataMode.CREDENTIAL_CLAIMS_DESERIALIZED;
|
|
41
|
-
vp_token: _sphereon_did_auth_siop.VerifiedDataMode.VP_TOKEN;
|
|
42
|
-
}>>>;
|
|
43
|
-
}, z.core.$strip>>;
|
|
44
|
-
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
45
|
-
authorization_request_created: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.CREATED;
|
|
46
|
-
authorization_request_retrieved: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.RETRIEVED;
|
|
47
|
-
authorization_response_received: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.RECEIVED;
|
|
48
|
-
authorization_response_verified: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.VERIFIED;
|
|
49
|
-
}>>>;
|
|
50
|
-
}, z.core.$strip>>;
|
|
51
|
-
}, z.core.$strip>;
|
|
52
|
-
declare const CreateAuthorizationResponseSchema: z.ZodObject<{
|
|
53
|
-
correlation_id: z.ZodString;
|
|
54
|
-
query_id: z.ZodString;
|
|
55
|
-
request_uri: z.ZodString;
|
|
56
|
-
status_uri: z.ZodString;
|
|
57
|
-
qr_uri: z.ZodOptional<z.ZodString>;
|
|
58
|
-
}, z.core.$strip>;
|
|
6
|
+
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
7
|
+
import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
|
|
59
8
|
|
|
60
9
|
interface ComponentOptions {
|
|
61
10
|
/**
|
|
@@ -287,10 +236,8 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
|
287
236
|
}
|
|
288
237
|
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPDManager;
|
|
289
238
|
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
290
|
-
type
|
|
291
|
-
type
|
|
292
|
-
type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
|
|
293
|
-
type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
|
|
239
|
+
type CreateAuthorizationRequestPayloadRequest = Request<Record<string, never>, any, CreateAuthorizationRequestPayload, Record<string, never>>;
|
|
240
|
+
type CreateAuthorizationResponsePayloadResponse = Response<CreateAuthorizationResponsePayload>;
|
|
294
241
|
type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
295
242
|
type DeleteAuthorizationRequestPathParameters = {
|
|
296
243
|
correlationId: string;
|
|
@@ -312,21 +259,6 @@ interface AuthStatusResponse {
|
|
|
312
259
|
verified_data?: VerifiedData;
|
|
313
260
|
error?: RequestError;
|
|
314
261
|
}
|
|
315
|
-
type VerifiedData = {
|
|
316
|
-
authorization_response?: AuthorizationResponse;
|
|
317
|
-
credential_claims?: AdditionalClaims;
|
|
318
|
-
};
|
|
319
|
-
type AuthorizationResponse = {
|
|
320
|
-
presentation_submission?: Record<string, any>;
|
|
321
|
-
vp_token?: VpToken;
|
|
322
|
-
};
|
|
323
|
-
type SingleObjectVpTokenPE = Record<string, any>;
|
|
324
|
-
type SingleStringVpTokenPE = string;
|
|
325
|
-
type MultipleVpTokens = Array<SingleObjectVpTokenPE> | Array<SingleStringVpTokenPE>;
|
|
326
|
-
type MultipleVpTokenDCQL = {
|
|
327
|
-
[key: string]: MultipleVpTokens;
|
|
328
|
-
};
|
|
329
|
-
type VpToken = SingleObjectVpTokenPE | SingleStringVpTokenPE | MultipleVpTokens | MultipleVpTokenDCQL;
|
|
330
262
|
|
|
331
263
|
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
332
264
|
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
@@ -355,4 +287,4 @@ declare class SIOPv2RPApiServer {
|
|
|
355
287
|
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
356
288
|
}
|
|
357
289
|
|
|
358
|
-
export { type AuthStatusResponse, type
|
|
290
|
+
export { type AuthStatusResponse, type ComponentOptions, type CreateAuthorizationRequestPayloadRequest, type CreateAuthorizationResponsePayloadResponse, type DeleteAuthorizationRequest, type DeleteAuthorizationRequestPathParameters, type GetAuthorizationRequestStatus, type GetAuthorizationRequestStatusPathParameters, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, type RequestError, SIOPv2RPApiServer, type SiopFeatures, authStatusUniversalOID4VPEndpoint, createAuthRequestUniversalOID4VPEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateUniversalOID4VPEndpoint, verifyAuthResponseSIOPv2Endpoint };
|
package/dist/index.js
CHANGED
|
@@ -31,27 +31,34 @@ function verifyAuthResponseSIOPv2Endpoint(router, context, opts) {
|
|
|
31
31
|
console.log(`verifyAuthResponse SIOP endpoint is disabled`);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const path = opts?.path ?? "/siop/
|
|
34
|
+
const path = opts?.path ?? "/siop/queries/:queryId/auth-responses/:correlationId";
|
|
35
35
|
router.post(path, checkAuth(opts?.endpoint), async (request, response) => {
|
|
36
36
|
try {
|
|
37
37
|
const { correlationId, queryId, tenantId, version } = request.params;
|
|
38
|
-
if (!correlationId
|
|
39
|
-
console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}
|
|
38
|
+
if (!correlationId) {
|
|
39
|
+
console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}`);
|
|
40
40
|
return sendErrorResponse(response, 404, "No authorization request could be found");
|
|
41
41
|
}
|
|
42
|
-
console.
|
|
43
|
-
console.
|
|
42
|
+
console.debug("Authorization Response (siop-sessions");
|
|
43
|
+
console.debug(JSON.stringify(request.body, null, 2));
|
|
44
44
|
const definitionItems = await context.agent.pdmGetDefinitions({
|
|
45
45
|
filter: [
|
|
46
46
|
{
|
|
47
47
|
queryId,
|
|
48
|
-
tenantId
|
|
49
|
-
|
|
48
|
+
...tenantId && {
|
|
49
|
+
tenantId
|
|
50
|
+
},
|
|
51
|
+
...version && {
|
|
52
|
+
version
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: queryId
|
|
50
57
|
}
|
|
51
58
|
]
|
|
52
59
|
});
|
|
53
60
|
if (definitionItems.length === 0) {
|
|
54
|
-
console.log(`Could not get
|
|
61
|
+
console.log(`Could not get dcql query with id ${queryId} from agent. Will return 404`);
|
|
55
62
|
response.statusCode = 404;
|
|
56
63
|
response.statusMessage = `No definition ${queryId}`;
|
|
57
64
|
return response.send();
|
|
@@ -62,7 +69,6 @@ function verifyAuthResponseSIOPv2Endpoint(router, context, opts) {
|
|
|
62
69
|
const verifiedResponse = await context.agent.siopVerifyAuthResponse({
|
|
63
70
|
authorizationResponse,
|
|
64
71
|
correlationId,
|
|
65
|
-
queryId,
|
|
66
72
|
dcqlQuery: definitionItem.query
|
|
67
73
|
});
|
|
68
74
|
const presentation = verifiedResponse?.oid4vpSubmission?.presentation;
|
|
@@ -105,24 +111,38 @@ function getAuthRequestSIOPv2Endpoint(router, context, opts) {
|
|
|
105
111
|
console.log(`getAuthRequest SIOP endpoint is disabled`);
|
|
106
112
|
return;
|
|
107
113
|
}
|
|
108
|
-
const path = opts?.path ?? "/siop/
|
|
114
|
+
const path = opts?.path ?? "/siop/queries/:queryId/auth-requests/:correlationId";
|
|
109
115
|
router.get(path, checkAuth(opts?.endpoint), async (request, response) => {
|
|
110
116
|
try {
|
|
111
117
|
const correlationId = request.params.correlationId;
|
|
112
|
-
const
|
|
113
|
-
if (!correlationId || !
|
|
114
|
-
console.log(`No authorization request could be found for the given url. correlationId: ${correlationId},
|
|
118
|
+
const queryId = request.params.queryId;
|
|
119
|
+
if (!correlationId || !queryId) {
|
|
120
|
+
console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, queryId: ${queryId}`);
|
|
115
121
|
return sendErrorResponse(response, 404, "No authorization request could be found");
|
|
116
122
|
}
|
|
117
123
|
const requestState = await context.agent.siopGetAuthRequestState({
|
|
118
124
|
correlationId,
|
|
119
|
-
queryId: definitionId,
|
|
120
125
|
errorOnNotFound: false
|
|
121
126
|
});
|
|
122
127
|
if (!requestState) {
|
|
123
|
-
console.log(`No authorization request could be found for the given url in the state manager. correlationId: ${correlationId}, definitionId: ${
|
|
128
|
+
console.log(`No authorization request could be found for the given url in the state manager. correlationId: ${correlationId}, definitionId: ${queryId}`);
|
|
124
129
|
return sendErrorResponse(response, 404, `No authorization request could be found`);
|
|
125
130
|
}
|
|
131
|
+
const definitionItems = await context.agent.pdmGetDefinitions({
|
|
132
|
+
filter: [
|
|
133
|
+
{
|
|
134
|
+
queryId
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
if (definitionItems.length === 0) {
|
|
139
|
+
console.log(`Could not get dcql query with id ${queryId} from agent. Will return 404`);
|
|
140
|
+
response.statusCode = 404;
|
|
141
|
+
response.statusMessage = `No definition ${queryId}`;
|
|
142
|
+
return response.send();
|
|
143
|
+
}
|
|
144
|
+
const payload = requestState.request?.requestObject?.getPayload();
|
|
145
|
+
payload.dcql_query = definitionItems[0].query;
|
|
126
146
|
const requestObject = await requestState.request?.requestObject?.toJwt();
|
|
127
147
|
console.log("JWT Request object:");
|
|
128
148
|
console.log(requestObject);
|
|
@@ -137,7 +157,6 @@ function getAuthRequestSIOPv2Endpoint(router, context, opts) {
|
|
|
137
157
|
} finally {
|
|
138
158
|
await context.agent.siopUpdateAuthRequestState({
|
|
139
159
|
correlationId,
|
|
140
|
-
queryId: definitionId,
|
|
141
160
|
state: "authorization_request_created",
|
|
142
161
|
error
|
|
143
162
|
});
|
|
@@ -150,7 +169,7 @@ function getAuthRequestSIOPv2Endpoint(router, context, opts) {
|
|
|
150
169
|
__name(getAuthRequestSIOPv2Endpoint, "getAuthRequestSIOPv2Endpoint");
|
|
151
170
|
|
|
152
171
|
// src/universal-oid4vp-api-functions.ts
|
|
153
|
-
import {
|
|
172
|
+
import { AuthorizationRequestStateStatus, createAuthorizationRequestFromPayload, CreateAuthorizationRequestPayloadSchema } from "@sphereon/did-auth-siop";
|
|
154
173
|
import { checkAuth as checkAuth2, sendErrorResponse as sendErrorResponse2 } from "@sphereon/ssi-express-support";
|
|
155
174
|
import { uriWithBase } from "@sphereon/ssi-sdk.siopv2-oid4vp-common";
|
|
156
175
|
import uuid from "short-uuid";
|
|
@@ -182,47 +201,6 @@ var validateData = /* @__PURE__ */ __name((schema) => {
|
|
|
182
201
|
};
|
|
183
202
|
}, "validateData");
|
|
184
203
|
|
|
185
|
-
// src/schemas/index.ts
|
|
186
|
-
import { CallbackOptsSchema, ResponseMode, ResponseType } from "@sphereon/did-auth-siop";
|
|
187
|
-
import { z } from "zod";
|
|
188
|
-
var ResponseTypeSchema = z.enum([
|
|
189
|
-
ResponseType.VP_TOKEN
|
|
190
|
-
]);
|
|
191
|
-
var ResponseModeSchema = z.enum([
|
|
192
|
-
ResponseMode.DIRECT_POST,
|
|
193
|
-
ResponseMode.DIRECT_POST_JWT
|
|
194
|
-
]);
|
|
195
|
-
var requestUriMethods = [
|
|
196
|
-
"get",
|
|
197
|
-
"post"
|
|
198
|
-
];
|
|
199
|
-
var RequestUriMethodSchema = z.enum(requestUriMethods);
|
|
200
|
-
var QRCodeOptsSchema = z.object({
|
|
201
|
-
size: z.number().optional(),
|
|
202
|
-
color_dark: z.string().optional(),
|
|
203
|
-
color_light: z.string().optional()
|
|
204
|
-
});
|
|
205
|
-
var CreateAuthorizationRequestBodySchema = z.object({
|
|
206
|
-
query_id: z.string(),
|
|
207
|
-
client_id: z.string().optional(),
|
|
208
|
-
request_uri_base: z.string().optional(),
|
|
209
|
-
correlation_id: z.string().optional(),
|
|
210
|
-
request_uri_method: RequestUriMethodSchema.optional(),
|
|
211
|
-
response_type: ResponseTypeSchema.optional(),
|
|
212
|
-
response_mode: ResponseModeSchema.optional(),
|
|
213
|
-
transaction_data: z.array(z.string()).optional(),
|
|
214
|
-
qr_code: QRCodeOptsSchema.optional(),
|
|
215
|
-
direct_post_response_redirect_uri: z.string().optional(),
|
|
216
|
-
callback: CallbackOptsSchema.optional()
|
|
217
|
-
});
|
|
218
|
-
var CreateAuthorizationResponseSchema = z.object({
|
|
219
|
-
correlation_id: z.string(),
|
|
220
|
-
query_id: z.string(),
|
|
221
|
-
request_uri: z.string(),
|
|
222
|
-
status_uri: z.string(),
|
|
223
|
-
qr_uri: z.string().optional()
|
|
224
|
-
});
|
|
225
|
-
|
|
226
204
|
// src/universal-oid4vp-api-functions.ts
|
|
227
205
|
function createAuthRequestUniversalOID4VPEndpoint(router, context, opts) {
|
|
228
206
|
if (opts?.enabled === false) {
|
|
@@ -230,16 +208,19 @@ function createAuthRequestUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
230
208
|
return;
|
|
231
209
|
}
|
|
232
210
|
const path = opts?.path ?? "/backend/auth/requests";
|
|
233
|
-
router.post(path, checkAuth2(opts?.endpoint), validateData(
|
|
211
|
+
router.post(path, checkAuth2(opts?.endpoint), validateData(CreateAuthorizationRequestPayloadSchema), async (request, response) => {
|
|
234
212
|
try {
|
|
235
|
-
const
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const
|
|
213
|
+
const authRequest = createAuthorizationRequestFromPayload(request.body);
|
|
214
|
+
const correlationId = authRequest.correlationId ?? uuid.uuid();
|
|
215
|
+
const qrCodeOpts = authRequest.qrCode ? {
|
|
216
|
+
...authRequest.qrCode
|
|
217
|
+
} : opts?.qrCodeOpts;
|
|
218
|
+
const queryId = authRequest.queryId;
|
|
241
219
|
const definitionItems = await context.agent.pdmGetDefinitions({
|
|
242
220
|
filter: [
|
|
221
|
+
{
|
|
222
|
+
id: queryId
|
|
223
|
+
},
|
|
243
224
|
{
|
|
244
225
|
queryId
|
|
245
226
|
}
|
|
@@ -252,10 +233,10 @@ function createAuthRequestUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
252
233
|
message: "No query could be found"
|
|
253
234
|
});
|
|
254
235
|
}
|
|
255
|
-
const requestByReferenceURI = uriWithBase(`/siop/
|
|
256
|
-
baseURI: requestUriBase ?? opts?.siopBaseURI
|
|
236
|
+
const requestByReferenceURI = uriWithBase(`/siop/queries/${queryId}/auth-requests/${correlationId}`, {
|
|
237
|
+
baseURI: authRequest.requestUriBase ?? opts?.siopBaseURI
|
|
257
238
|
});
|
|
258
|
-
const responseURI = uriWithBase(`/siop/
|
|
239
|
+
const responseURI = uriWithBase(`/siop/queries/${queryId}/auth-responses/${correlationId}`, {
|
|
259
240
|
baseURI: opts?.siopBaseURI
|
|
260
241
|
});
|
|
261
242
|
const authRequestURI = await context.agent.siopCreateAuthRequestURI({
|
|
@@ -265,10 +246,12 @@ function createAuthRequestUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
265
246
|
requestByReferenceURI,
|
|
266
247
|
responseURIType: "response_uri",
|
|
267
248
|
responseURI,
|
|
268
|
-
...directPostResponseRedirectUri && {
|
|
269
|
-
responseRedirectURI: directPostResponseRedirectUri
|
|
249
|
+
...authRequest.directPostResponseRedirectUri && {
|
|
250
|
+
responseRedirectURI: authRequest.directPostResponseRedirectUri
|
|
270
251
|
},
|
|
271
|
-
callback
|
|
252
|
+
...authRequest.callback && {
|
|
253
|
+
callback: authRequest.callback
|
|
254
|
+
}
|
|
272
255
|
});
|
|
273
256
|
let qrCodeDataUri;
|
|
274
257
|
if (qrCodeOpts) {
|
|
@@ -278,6 +261,8 @@ function createAuthRequestUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
278
261
|
text: authRequestURI
|
|
279
262
|
});
|
|
280
263
|
qrCodeDataUri = `data:image/png;base64,${(await qrCode.draw()).toString("base64")}`;
|
|
264
|
+
} else {
|
|
265
|
+
qrCodeDataUri = authRequestURI;
|
|
281
266
|
}
|
|
282
267
|
const authRequestBody = {
|
|
283
268
|
query_id: queryId,
|
|
@@ -356,7 +341,7 @@ function authStatusUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
356
341
|
});
|
|
357
342
|
}
|
|
358
343
|
let responseState;
|
|
359
|
-
if (requestState.status ===
|
|
344
|
+
if (requestState.status === AuthorizationRequestStateStatus.RETRIEVED) {
|
|
360
345
|
responseState = await context.agent.siopGetAuthResponseState({
|
|
361
346
|
correlationId,
|
|
362
347
|
errorOnNotFound: false
|
|
@@ -368,8 +353,8 @@ function authStatusUniversalOID4VPEndpoint(router, context, opts) {
|
|
|
368
353
|
correlation_id: overallState.correlationId,
|
|
369
354
|
query_id: overallState.queryId,
|
|
370
355
|
last_updated: overallState.lastUpdated,
|
|
371
|
-
...
|
|
372
|
-
verified_data:
|
|
356
|
+
..."verifiedData" in overallState && {
|
|
357
|
+
verified_data: overallState.verifiedData
|
|
373
358
|
},
|
|
374
359
|
...overallState.error && {
|
|
375
360
|
message: overallState.error.message
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/siop-api-functions.ts","../src/universal-oid4vp-api-functions.ts","../src/middleware/validationMiddleware.ts","../src/schemas/index.ts","../src/siopv2-rp-api-server.ts"],"sourcesContent":["import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop'\nimport { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'\nimport { AuthorizationChallengeValidationResponse } from '@sphereon/ssi-sdk.siopv2-oid4vp-common'\nimport { CredentialMapper } from '@sphereon/ssi-types'\nimport { Request, Response, Router } from 'express'\nimport { IRequiredContext } from './types'\n\nconst parseAuthorizationResponse = (request: Request): AuthorizationResponsePayload => {\n const contentType = request.header('content-type')\n\n if (contentType === 'application/json') {\n const payload = typeof request.body === 'string' ? JSON.parse(request.body) : request.body\n return payload as AuthorizationResponsePayload\n }\n\n if (contentType === 'application/x-www-form-urlencoded') {\n const payload = request.body as AuthorizationResponsePayload\n\n // Parse presentation_submission if it's a string\n if (typeof payload.presentation_submission === 'string') {\n console.log(`Supplied presentation_submission was a string instead of JSON. Correcting, but external party should fix their implementation!`)\n payload.presentation_submission = JSON.parse(payload.presentation_submission)\n }\n\n // when using FORM_URL_ENCODED, vp_token comes back as string not matter whether the input was string, object or array. Handled below.\n if (typeof payload.vp_token === 'string') {\n const { vp_token } = payload\n\n // The only use case where vp_object is an object is JsonLdAsString atm. For arrays, any objects will be parsed along with the array\n // (Leaving the vp_token JsonLdAsString causes problems because the original credential will remain string and will be interpreted as JWT in some parts of the code)\n if ((vp_token.startsWith('[') && vp_token.endsWith(']')) || CredentialMapper.isJsonLdAsString(vp_token)) {\n payload.vp_token = JSON.parse(vp_token)\n }\n }\n\n return payload\n }\n\n throw new Error(\n `Unsupported content type: ${contentType}. Currently only application/x-www-form-urlencoded and application/json (for direct_post) are supported`,\n )\n}\n\nexport function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`verifyAuthResponse SIOP endpoint is disabled`)\n return\n }\n const path = opts?.path ?? '/siop/definitions/:definitionId/auth-responses/:correlationId'\n router.post(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const { correlationId, queryId, tenantId, version } = request.params\n if (!correlationId || !queryId) {\n console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, queryId: ${queryId}`)\n return sendErrorResponse(response, 404, 'No authorization request could be found')\n }\n console.log('Authorization Response (siop-sessions')\n console.log(JSON.stringify(request.body, null, 2))\n const definitionItems = await context.agent.pdmGetDefinitions({ filter: [{ queryId, tenantId, version }] })\n if (definitionItems.length === 0) {\n console.log(`Could not get definition ${queryId} from agent. Will return 404`)\n response.statusCode = 404\n response.statusMessage = `No definition ${queryId}`\n return response.send()\n }\n\n const authorizationResponse = parseAuthorizationResponse(request)\n console.log(`URI: ${JSON.stringify(authorizationResponse)}`)\n\n const definitionItem = definitionItems[0]\n const verifiedResponse = await context.agent.siopVerifyAuthResponse({\n authorizationResponse,\n correlationId,\n queryId,\n dcqlQuery: definitionItem.query,\n })\n\n // FIXME SSISDK-55 add proper support for checking for DCQL presentations\n const presentation = verifiedResponse?.oid4vpSubmission?.presentation\n if (presentation && Object.keys(presentation).length > 0) {\n console.log('PRESENTATIONS:' + JSON.stringify(verifiedResponse?.oid4vpSubmission?.presentation, null, 2))\n response.statusCode = 200\n\n const authorizationChallengeValidationResponse: AuthorizationChallengeValidationResponse = {\n presentation_during_issuance_session: verifiedResponse.correlationId,\n }\n if (authorizationResponse.is_first_party) {\n response.setHeader('Content-Type', 'application/json')\n return response.send(JSON.stringify(authorizationChallengeValidationResponse))\n }\n\n const responseRedirectURI = await context.agent.siopGetRedirectURI({ correlationId, queryId: queryId, state: verifiedResponse.state })\n if (responseRedirectURI) {\n response.setHeader('Content-Type', 'application/json')\n return response.send(JSON.stringify({ redirect_uri: responseRedirectURI }))\n }\n // todo: delete session\n } else {\n console.log('Missing Presentation (Verifiable Credentials)')\n response.statusCode = 500\n response.statusMessage = 'Missing Presentation (Verifiable Credentials)'\n }\n return response.send()\n } catch (error) {\n console.error(error)\n return sendErrorResponse(response, 500, 'Could not verify auth status', error)\n }\n })\n}\n\nexport function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`getAuthRequest SIOP endpoint is disabled`)\n return\n }\n const path = opts?.path ?? '/siop/definitions/:definitionId/auth-requests/:correlationId'\n router.get(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const correlationId = request.params.correlationId\n const definitionId = request.params.definitionId\n if (!correlationId || !definitionId) {\n console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, definitionId: ${definitionId}`)\n return sendErrorResponse(response, 404, 'No authorization request could be found')\n }\n const requestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n queryId: definitionId,\n errorOnNotFound: false,\n })\n if (!requestState) {\n console.log(\n `No authorization request could be found for the given url in the state manager. correlationId: ${correlationId}, definitionId: ${definitionId}`,\n )\n return sendErrorResponse(response, 404, `No authorization request could be found`)\n }\n const requestObject = await requestState.request?.requestObject?.toJwt()\n console.log('JWT Request object:')\n console.log(requestObject)\n\n let error: string | undefined\n try {\n response.statusCode = 200\n response.setHeader('Content-Type', 'application/jwt')\n return response.send(requestObject)\n } catch (e) {\n error = typeof e === 'string' ? e : e instanceof Error ? e.message : undefined\n return sendErrorResponse(response, 500, 'Could not get authorization request', e)\n } finally {\n await context.agent.siopUpdateAuthRequestState({\n correlationId,\n queryId: definitionId,\n state: 'authorization_request_created',\n error,\n })\n }\n } catch (error) {\n return sendErrorResponse(response, 500, 'Could not get authorization request', error)\n }\n })\n}\n","import { AuthorizationResponseStateStatus } from '@sphereon/did-auth-siop'\nimport { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'\nimport { uriWithBase } from '@sphereon/ssi-sdk.siopv2-oid4vp-common'\nimport { Request, Response, Router } from 'express'\nimport uuid from 'short-uuid'\nimport { validateData } from './middleware/validationMiddleware'\nimport { CreateAuthorizationRequestBodySchema } from './schemas'\nimport {\n CreateAuthorizationRequest,\n CreateAuthorizationRequestResponse,\n CreateAuthorizationResponse,\n DeleteAuthorizationRequest,\n GetAuthorizationRequestStatus,\n AuthStatusResponse,\n ICreateAuthRequestWebappEndpointOpts,\n IRequiredContext,\n} from './types'\n\nexport function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`createAuthRequest universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/requests'\n router.post(\n path,\n checkAuth(opts?.endpoint),\n validateData(CreateAuthorizationRequestBodySchema),\n async (request: CreateAuthorizationRequest, response: CreateAuthorizationResponse) => {\n try {\n const correlationId = request.body.correlation_id ?? uuid.uuid()\n const qrCodeOpts = request.body.qr_code ?? opts?.qrCodeOpts\n const queryId = request.body.query_id\n const directPostResponseRedirectUri = request.body.direct_post_response_redirect_uri // TODO Uri not URI\n const requestUriBase = request.body.request_uri_base\n const callback = request.body.callback\n\n const definitionItems = await context.agent.pdmGetDefinitions({ filter: [{ queryId }] })\n if (definitionItems.length === 0) {\n console.log(`No query could be found for the given id. Query id: ${queryId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No query could be found' })\n }\n\n const requestByReferenceURI = uriWithBase(`/siop/definitions/${queryId}/auth-requests/${correlationId}`, {\n baseURI: requestUriBase ?? opts?.siopBaseURI,\n })\n const responseURI = uriWithBase(`/siop/definitions/${queryId}/auth-responses/${correlationId}`, { baseURI: opts?.siopBaseURI })\n\n const authRequestURI = await context.agent.siopCreateAuthRequestURI({\n queryId,\n correlationId,\n nonce: uuid.uuid(),\n requestByReferenceURI,\n responseURIType: 'response_uri',\n responseURI,\n ...(directPostResponseRedirectUri && { responseRedirectURI: directPostResponseRedirectUri }),\n callback,\n })\n\n let qrCodeDataUri: string | undefined\n if (qrCodeOpts) {\n const { AwesomeQR } = await import('awesome-qr')\n const qrCode = new AwesomeQR({ ...qrCodeOpts, text: authRequestURI })\n qrCodeDataUri = `data:image/png;base64,${(await qrCode.draw())!.toString('base64')}`\n }\n\n const authRequestBody = {\n query_id: queryId,\n correlation_id: correlationId,\n request_uri: authRequestURI,\n status_uri: `${uriWithBase(opts?.webappAuthStatusPath ?? `/backend/auth/status/${correlationId}`, { baseURI: opts?.webappBaseURI })}`,\n ...(qrCodeDataUri && { qr_uri: qrCodeDataUri }),\n } satisfies CreateAuthorizationRequestResponse\n console.log(`Auth Request URI data to send back: ${JSON.stringify(authRequestBody)}`)\n\n return response.status(201).json(authRequestBody)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: 'Could not create an authorization request URI' }, error)\n }\n },\n )\n}\n\nexport function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`removeAuthStatus universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/requests/:correlationId'\n router.delete(path, checkAuth(opts?.endpoint), async (request: DeleteAuthorizationRequest, response: Response) => {\n try {\n const correlationId: string = request.params.correlationId\n\n const authRequestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n errorOnNotFound: false,\n })\n if (!authRequestState) {\n console.log(`No authorization request could be found for the given correlationId. correlationId: ${correlationId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No authorization request could be found' })\n }\n\n await context.agent.siopDeleteAuthState({ correlationId })\n\n return response.status(204).json()\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n\nexport function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`authStatus universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/status/:correlationId'\n router.get(path, checkAuth(opts?.endpoint), async (request: GetAuthorizationRequestStatus, response: Response) => {\n try {\n console.log('Received auth-status request...')\n const correlationId: string = request.params.correlationId\n\n const requestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n errorOnNotFound: false,\n })\n\n if (!requestState) {\n console.log(`No authorization request could be found for the given correlationId. correlationId: ${correlationId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No authorization request could be found' })\n }\n\n let responseState\n if (requestState.status === 'authorization_request_created') {\n responseState = await context.agent.siopGetAuthResponseState({ correlationId, errorOnNotFound: false })\n }\n const overallState = responseState ?? requestState\n\n const statusBody = {\n status: overallState.status,\n correlation_id: overallState.correlationId,\n query_id: overallState.queryId,\n last_updated: overallState.lastUpdated,\n ...(responseState?.status === AuthorizationResponseStateStatus.VERIFIED &&\n responseState.verifiedData !== undefined && { verified_data: responseState.verifiedData }),\n ...(overallState.error && { message: overallState.error.message }),\n } satisfies AuthStatusResponse\n console.debug(`Will send auth status: ${JSON.stringify(statusBody)}`)\n\n if (overallState.status === 'error') {\n return response.status(500).json(statusBody)\n }\n return response.status(200).json(statusBody)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n\nexport function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`getDefinitions universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/definitions'\n router.get(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const definitions = await context.agent.pdmGetDefinitions()\n response.statusCode = 200\n return response.json(definitions)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n","import { Request, Response, NextFunction } from 'express';\nimport { z, ZodError } from 'zod';\n\nexport const validateData = (schema: z.ZodObject<any, any>) => {\n return (req: Request, res: Response, next: NextFunction) => {\n try {\n schema.parse(req.body);\n next();\n } catch (error) {\n if (error instanceof ZodError) {\n const errorMessages = error.issues.map((issue: any) => ({\n message: `${issue.path.join('.')} is ${issue.message}`,\n }))\n res.status(400).json({ status: 400, message: 'Invalid data', error_details: errorMessages[0].message });\n } else {\n res.status(500).json({ status: 500, message: 'Internal Server Error' });\n }\n }\n };\n}\n","import { CallbackOptsSchema, RequestUriMethod, ResponseMode, ResponseType } from '@sphereon/did-auth-siop'\nimport { z } from 'zod'\n\nexport const ResponseTypeSchema = z.enum([ResponseType.VP_TOKEN])\n\nexport const ResponseModeSchema = z.enum([ResponseMode.DIRECT_POST, ResponseMode.DIRECT_POST_JWT])\n\nconst requestUriMethods = ['get', 'post'] as const satisfies Array<RequestUriMethod>\nexport const RequestUriMethodSchema = z.enum(requestUriMethods)\nexport const QRCodeOptsSchema = z.object({\n size: z.number().optional(),\n color_dark: z.string().optional(),\n color_light: z.string().optional(),\n})\n\nexport const CreateAuthorizationRequestBodySchema = z.object({\n query_id: z.string(),\n client_id: z.string().optional(),\n request_uri_base: z.string().optional(),\n correlation_id: z.string().optional(),\n request_uri_method: RequestUriMethodSchema.optional(),\n response_type: ResponseTypeSchema.optional(),\n response_mode: ResponseModeSchema.optional(),\n transaction_data: z.array(z.string()).optional(),\n qr_code: QRCodeOptsSchema.optional(),\n direct_post_response_redirect_uri: z.string().optional(),\n callback: CallbackOptsSchema.optional(),\n})\n\nexport const CreateAuthorizationResponseSchema = z.object({\n correlation_id: z.string(),\n query_id: z.string(),\n request_uri: z.string(),\n status_uri: z.string(),\n qr_uri: z.string().optional(),\n})\n","import { agentContext } from '@sphereon/ssi-sdk.core'\nimport { copyGlobalAuthToEndpoints, ExpressSupport } from '@sphereon/ssi-express-support'\nimport { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth'\nimport { TAgent } from '@veramo/core'\nimport express, { Express, Request, Response, Router } from 'express'\nimport { getAuthRequestSIOPv2Endpoint, verifyAuthResponseSIOPv2Endpoint } from './siop-api-functions'\nimport { IRequiredPlugins, ISIOPv2RPRestAPIOpts } from './types'\nimport {\n authStatusUniversalOID4VPEndpoint,\n createAuthRequestUniversalOID4VPEndpoint,\n getDefinitionsEndpoint,\n removeAuthRequestStateUniversalOID4VPEndpoint,\n} from './universal-oid4vp-api-functions'\nimport swaggerUi from 'swagger-ui-express'\n\nexport class SIOPv2RPApiServer {\n private readonly _express: Express\n private readonly _router: Router\n private readonly _agent: TAgent<ISIOPv2RP>\n private readonly _opts?: ISIOPv2RPRestAPIOpts\n private readonly _basePath: string\n\n private readonly OID4VP_SWAGGER_URL = 'https://api.swaggerhub.com/apis/SphereonInt/OID4VP/0.1.0'\n constructor(args: { agent: TAgent<IRequiredPlugins>; expressSupport: ExpressSupport; opts?: ISIOPv2RPRestAPIOpts }) {\n const { agent, opts } = args\n this._agent = agent\n copyGlobalAuthToEndpoints({ opts, keys: ['webappCreateAuthRequest', 'webappAuthStatus', 'webappDeleteAuthRequest'] })\n if (opts?.endpointOpts?.globalAuth?.secureSiopEndpoints) {\n copyGlobalAuthToEndpoints({ opts, keys: ['siopGetAuthRequest', 'siopVerifyAuthResponse'] })\n }\n\n this._opts = opts\n this._express = args.expressSupport.express\n this._router = express.Router()\n const context = agentContext(agent)\n\n const features = opts?.enableFeatures ?? ['rp-status', 'siop']\n console.log(`SIOPv2 API enabled, with features: ${JSON.stringify(features)}}`)\n\n // Webapp endpoints\n if (features.includes('rp-status')) {\n createAuthRequestUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappCreateAuthRequest)\n authStatusUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappAuthStatus)\n removeAuthRequestStateUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappDeleteAuthRequest)\n getDefinitionsEndpoint(this._router, context, opts?.endpointOpts?.webappGetDefinitions)\n }\n\n // SIOPv2 endpoints\n if (features.includes('siop')) {\n getAuthRequestSIOPv2Endpoint(this._router, context, opts?.endpointOpts?.siopGetAuthRequest)\n verifyAuthResponseSIOPv2Endpoint(this._router, context, opts?.endpointOpts?.siopVerifyAuthResponse)\n }\n this._basePath = opts?.endpointOpts?.basePath ?? ''\n this._express.use(this._basePath, this.router)\n this._express.set('trust proxy', opts?.endpointOpts?.trustProxy ?? true)\n this.setupSwaggerUi()\n }\n\n private setupSwaggerUi() {\n fetch(this.OID4VP_SWAGGER_URL)\n .then((res) => res.json())\n .then((swagger: any) => {\n const apiDocs = `${this._basePath}/api-docs`\n console.log(`[OID4P] API docs available at ${apiDocs}`)\n\n this._router.use(\n '/api-docs',\n (req: Request, res: Response, next: any) => {\n const regex = `${apiDocs.replace(/\\//, '\\/')}`.replace('/oid4vp', '').replace(/\\/api-docs.*/, '')\n swagger.servers = [{ url: `${req.protocol}://${req.get('host')}${regex}`, description: 'This server' }]\n // @ts-ignore\n req.swaggerDoc = swagger\n next()\n },\n swaggerUi.serveFiles(swagger, options),\n swaggerUi.setup(),\n )\n })\n .catch((err) => {\n console.log(`[OID4VP] Unable to fetch swagger document: ${err}. Will not host api-docs on this instance`)\n })\n const options = {\n // customCss: '.swagger-ui .topbar { display: none }',\n }\n }\n get express(): Express {\n return this._express\n }\n\n get router(): Router {\n return this._router\n }\n\n get agent(): TAgent<ISIOPv2RP> {\n return this._agent\n }\n\n get opts(): ISIOPv2RPRestAPIOpts | undefined {\n return this._opts\n }\n}\n"],"mappings":";;;;AACA,SAASA,WAAgCC,yBAAyB;AAElE,SAASC,wBAAwB;AAIjC,IAAMC,6BAA6B,wBAACC,YAAAA;AAClC,QAAMC,cAAcD,QAAQE,OAAO,cAAA;AAEnC,MAAID,gBAAgB,oBAAoB;AACtC,UAAME,UAAU,OAAOH,QAAQI,SAAS,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,aAAAA;MACF,GACAS,UAAUC,WAAWb,SAASc,OAAAA,GAC9BF,UAAUG,MAAK,CAAA;IAEnB,CAAA,EACCC,MAAM,CAACC,QAAAA;AACN5C,cAAQC,IAAI,8CAA8C2C,GAAAA,2CAA8C;IAC1G,CAAA;AACF,UAAMH,UAAU,CAEhB;EACF;EACA,IAAI/C,UAAmB;AACrB,WAAO,KAAKf;EACd;EAEA,IAAIwC,SAAiB;AACnB,WAAO,KAAKvC;EACd;EAEA,IAAIM,QAA2B;AAC7B,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAyC;AAC3C,WAAO,KAAKL;EACd;AACF;","names":["checkAuth","sendErrorResponse","CredentialMapper","parseAuthorizationResponse","request","contentType","header","payload","body","JSON","parse","presentation_submission","console","log","vp_token","startsWith","endsWith","CredentialMapper","isJsonLdAsString","Error","verifyAuthResponseSIOPv2Endpoint","router","context","opts","enabled","path","post","checkAuth","endpoint","response","correlationId","queryId","tenantId","version","params","sendErrorResponse","stringify","definitionItems","agent","pdmGetDefinitions","filter","length","statusCode","statusMessage","send","authorizationResponse","definitionItem","verifiedResponse","siopVerifyAuthResponse","dcqlQuery","query","presentation","oid4vpSubmission","Object","keys","authorizationChallengeValidationResponse","presentation_during_issuance_session","is_first_party","setHeader","responseRedirectURI","siopGetRedirectURI","state","redirect_uri","error","getAuthRequestSIOPv2Endpoint","get","definitionId","requestState","siopGetAuthRequestState","errorOnNotFound","requestObject","toJwt","e","message","undefined","siopUpdateAuthRequestState","AuthorizationResponseStateStatus","checkAuth","sendErrorResponse","uriWithBase","uuid","ZodError","validateData","schema","req","res","next","parse","body","error","ZodError","errorMessages","issues","map","issue","message","path","join","status","json","error_details","CallbackOptsSchema","ResponseMode","ResponseType","z","ResponseTypeSchema","enum","VP_TOKEN","ResponseModeSchema","DIRECT_POST","DIRECT_POST_JWT","requestUriMethods","RequestUriMethodSchema","QRCodeOptsSchema","object","size","number","optional","color_dark","string","color_light","CreateAuthorizationRequestBodySchema","query_id","client_id","request_uri_base","correlation_id","request_uri_method","response_type","response_mode","transaction_data","array","qr_code","direct_post_response_redirect_uri","callback","CreateAuthorizationResponseSchema","request_uri","status_uri","qr_uri","createAuthRequestUniversalOID4VPEndpoint","router","context","opts","enabled","console","log","path","post","checkAuth","endpoint","validateData","CreateAuthorizationRequestBodySchema","request","response","correlationId","body","correlation_id","uuid","qrCodeOpts","qr_code","queryId","query_id","directPostResponseRedirectUri","direct_post_response_redirect_uri","requestUriBase","request_uri_base","callback","definitionItems","agent","pdmGetDefinitions","filter","length","sendErrorResponse","status","message","requestByReferenceURI","uriWithBase","baseURI","siopBaseURI","responseURI","authRequestURI","siopCreateAuthRequestURI","nonce","responseURIType","responseRedirectURI","qrCodeDataUri","AwesomeQR","qrCode","text","draw","toString","authRequestBody","request_uri","status_uri","webappAuthStatusPath","webappBaseURI","qr_uri","JSON","stringify","json","error","removeAuthRequestStateUniversalOID4VPEndpoint","delete","params","authRequestState","siopGetAuthRequestState","errorOnNotFound","siopDeleteAuthState","authStatusUniversalOID4VPEndpoint","get","requestState","responseState","siopGetAuthResponseState","overallState","statusBody","last_updated","lastUpdated","AuthorizationResponseStateStatus","VERIFIED","verifiedData","undefined","verified_data","debug","getDefinitionsEndpoint","definitions","statusCode","agentContext","copyGlobalAuthToEndpoints","express","swaggerUi","SIOPv2RPApiServer","_express","_router","_agent","_opts","_basePath","OID4VP_SWAGGER_URL","args","agent","opts","copyGlobalAuthToEndpoints","keys","endpointOpts","globalAuth","secureSiopEndpoints","expressSupport","express","Router","context","agentContext","features","enableFeatures","console","log","JSON","stringify","includes","createAuthRequestUniversalOID4VPEndpoint","webappCreateAuthRequest","authStatusUniversalOID4VPEndpoint","webappAuthStatus","removeAuthRequestStateUniversalOID4VPEndpoint","webappDeleteAuthRequest","getDefinitionsEndpoint","webappGetDefinitions","getAuthRequestSIOPv2Endpoint","siopGetAuthRequest","verifyAuthResponseSIOPv2Endpoint","siopVerifyAuthResponse","basePath","use","router","set","trustProxy","setupSwaggerUi","fetch","then","res","json","swagger","apiDocs","req","next","regex","replace","servers","url","protocol","get","description","swaggerDoc","swaggerUi","serveFiles","options","setup","catch","err"]}
|
|
1
|
+
{"version":3,"sources":["../src/siop-api-functions.ts","../src/universal-oid4vp-api-functions.ts","../src/middleware/validationMiddleware.ts","../src/siopv2-rp-api-server.ts"],"sourcesContent":["import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop'\nimport { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'\nimport { AuthorizationChallengeValidationResponse } from '@sphereon/ssi-sdk.siopv2-oid4vp-common'\nimport { CredentialMapper } from '@sphereon/ssi-types'\nimport { Request, Response, Router } from 'express'\nimport { IRequiredContext } from './types'\n\nconst parseAuthorizationResponse = (request: Request): AuthorizationResponsePayload => {\n const contentType = request.header('content-type')\n\n if (contentType === 'application/json') {\n const payload = typeof request.body === 'string' ? JSON.parse(request.body) : request.body\n return payload as AuthorizationResponsePayload\n }\n\n if (contentType === 'application/x-www-form-urlencoded') {\n const payload = request.body as AuthorizationResponsePayload\n\n // Parse presentation_submission if it's a string\n if (typeof payload.presentation_submission === 'string') {\n console.log(`Supplied presentation_submission was a string instead of JSON. Correcting, but external party should fix their implementation!`)\n payload.presentation_submission = JSON.parse(payload.presentation_submission)\n }\n\n // when using FORM_URL_ENCODED, vp_token comes back as string not matter whether the input was string, object or array. Handled below.\n if (typeof payload.vp_token === 'string') {\n const { vp_token } = payload\n\n // The only use case where vp_object is an object is JsonLdAsString atm. For arrays, any objects will be parsed along with the array\n // (Leaving the vp_token JsonLdAsString causes problems because the original credential will remain string and will be interpreted as JWT in some parts of the code)\n if ((vp_token.startsWith('[') && vp_token.endsWith(']')) || CredentialMapper.isJsonLdAsString(vp_token)) {\n payload.vp_token = JSON.parse(vp_token)\n }\n }\n\n return payload\n }\n\n throw new Error(\n `Unsupported content type: ${contentType}. Currently only application/x-www-form-urlencoded and application/json (for direct_post) are supported`,\n )\n}\n\nexport function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`verifyAuthResponse SIOP endpoint is disabled`)\n return\n }\n const path = opts?.path ?? '/siop/queries/:queryId/auth-responses/:correlationId'\n router.post(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const { correlationId, queryId, tenantId, version } = request.params\n if (!correlationId) {\n console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}`)\n return sendErrorResponse(response, 404, 'No authorization request could be found')\n }\n console.debug('Authorization Response (siop-sessions') // TODO use logger\n console.debug(JSON.stringify(request.body, null, 2))\n const definitionItems = await context.agent.pdmGetDefinitions({\n filter: [\n {\n queryId,\n ...(tenantId && { tenantId }),\n ...(version && { version }),\n },\n {\n id: queryId,\n },\n ],\n })\n if (definitionItems.length === 0) {\n console.log(`Could not get dcql query with id ${queryId} from agent. Will return 404`)\n response.statusCode = 404\n response.statusMessage = `No definition ${queryId}`\n return response.send()\n }\n\n const authorizationResponse = parseAuthorizationResponse(request)\n console.log(`URI: ${JSON.stringify(authorizationResponse)}`)\n\n const definitionItem = definitionItems[0]\n const verifiedResponse = await context.agent.siopVerifyAuthResponse({\n authorizationResponse,\n correlationId,\n dcqlQuery: definitionItem.query,\n })\n\n // FIXME SSISDK-55 add proper support for checking for DCQL presentations\n const presentation = verifiedResponse?.oid4vpSubmission?.presentation\n if (presentation && Object.keys(presentation).length > 0) {\n console.log('PRESENTATIONS:' + JSON.stringify(verifiedResponse?.oid4vpSubmission?.presentation, null, 2))\n response.statusCode = 200\n\n const authorizationChallengeValidationResponse: AuthorizationChallengeValidationResponse = {\n presentation_during_issuance_session: verifiedResponse.correlationId,\n }\n if (authorizationResponse.is_first_party) {\n response.setHeader('Content-Type', 'application/json')\n return response.send(JSON.stringify(authorizationChallengeValidationResponse))\n }\n\n const responseRedirectURI = await context.agent.siopGetRedirectURI({ correlationId, queryId, state: verifiedResponse.state })\n if (responseRedirectURI) {\n response.setHeader('Content-Type', 'application/json')\n return response.send(JSON.stringify({ redirect_uri: responseRedirectURI }))\n }\n // todo: delete session\n } else {\n console.log('Missing Presentation (Verifiable Credentials)')\n response.statusCode = 500\n response.statusMessage = 'Missing Presentation (Verifiable Credentials)'\n }\n return response.send()\n } catch (error) {\n console.error(error)\n return sendErrorResponse(response, 500, 'Could not verify auth status', error)\n }\n })\n}\n\nexport function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`getAuthRequest SIOP endpoint is disabled`)\n return\n }\n const path = opts?.path ?? '/siop/queries/:queryId/auth-requests/:correlationId'\n router.get(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const correlationId = request.params.correlationId\n const queryId = request.params.queryId\n if (!correlationId || !queryId) {\n console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, queryId: ${queryId}`)\n return sendErrorResponse(response, 404, 'No authorization request could be found')\n }\n const requestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n errorOnNotFound: false,\n })\n if (!requestState) {\n console.log(\n `No authorization request could be found for the given url in the state manager. correlationId: ${correlationId}, definitionId: ${queryId}`,\n )\n return sendErrorResponse(response, 404, `No authorization request could be found`)\n }\n\n const definitionItems = await context.agent.pdmGetDefinitions({ filter: [{ queryId }] });\n if (definitionItems.length === 0) {\n console.log(`Could not get dcql query with id ${queryId} from agent. Will return 404`)\n response.statusCode = 404\n response.statusMessage = `No definition ${queryId}`\n return response.send()\n }\n const payload = requestState.request?.requestObject?.getPayload()!\n payload.dcql_query = definitionItems[0].query\n const requestObject = await requestState.request?.requestObject?.toJwt()\n console.log('JWT Request object:')\n console.log(requestObject)\n\n let error: string | undefined\n try {\n response.statusCode = 200\n response.setHeader('Content-Type', 'application/jwt')\n return response.send(requestObject)\n } catch (e) {\n error = typeof e === 'string' ? e : e instanceof Error ? e.message : undefined\n return sendErrorResponse(response, 500, 'Could not get authorization request', e)\n } finally {\n await context.agent.siopUpdateAuthRequestState({\n correlationId,\n state: 'authorization_request_created',\n error,\n })\n }\n } catch (error) {\n return sendErrorResponse(response, 500, 'Could not get authorization request', error)\n }\n })\n}\n","import {\n AuthorizationRequestStateStatus,\n CreateAuthorizationRequest,\n createAuthorizationRequestFromPayload,\n CreateAuthorizationRequestPayloadSchema,\n CreateAuthorizationResponsePayload,\n} from '@sphereon/did-auth-siop'\nimport { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'\nimport { uriWithBase } from '@sphereon/ssi-sdk.siopv2-oid4vp-common'\nimport { Request, Response, Router } from 'express'\nimport uuid from 'short-uuid'\nimport { validateData } from './middleware/validationMiddleware'\nimport {\n AuthStatusResponse,\n CreateAuthorizationRequestPayloadRequest,\n CreateAuthorizationResponsePayloadResponse,\n DeleteAuthorizationRequest,\n GetAuthorizationRequestStatus,\n ICreateAuthRequestWebappEndpointOpts,\n IRequiredContext,\n QRCodeOpts,\n} from './types'\n\nexport function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`createAuthRequest universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/requests'\n router.post(\n path,\n checkAuth(opts?.endpoint),\n validateData(CreateAuthorizationRequestPayloadSchema),\n async (request: CreateAuthorizationRequestPayloadRequest, response: CreateAuthorizationResponsePayloadResponse) => {\n try {\n const authRequest: CreateAuthorizationRequest = createAuthorizationRequestFromPayload(request.body)\n const correlationId = authRequest.correlationId ?? uuid.uuid()\n const qrCodeOpts = authRequest.qrCode ? ({ ...authRequest.qrCode } satisfies QRCodeOpts) : opts?.qrCodeOpts\n const queryId = authRequest.queryId\n\n const definitionItems = await context.agent.pdmGetDefinitions({\n filter: [\n { id: queryId }, // Allow both PK (unique queryId + version combi) or just plain queryId which assumes the latest version\n { queryId },\n ],\n })\n if (definitionItems.length === 0) {\n console.log(`No query could be found for the given id. Query id: ${queryId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No query could be found' })\n }\n\n const requestByReferenceURI = uriWithBase(`/siop/queries/${queryId}/auth-requests/${correlationId}`, {\n baseURI: authRequest.requestUriBase ?? opts?.siopBaseURI,\n })\n const responseURI = uriWithBase(`/siop/queries/${queryId}/auth-responses/${correlationId}`, { baseURI: opts?.siopBaseURI })\n\n const authRequestURI = await context.agent.siopCreateAuthRequestURI({\n queryId,\n correlationId,\n nonce: uuid.uuid(),\n requestByReferenceURI,\n responseURIType: 'response_uri',\n responseURI,\n ...(authRequest.directPostResponseRedirectUri && { responseRedirectURI: authRequest.directPostResponseRedirectUri }),\n ...(authRequest.callback && { callback: authRequest.callback }),\n })\n\n let qrCodeDataUri: string | undefined\n if (qrCodeOpts) {\n const { AwesomeQR } = await import('awesome-qr')\n const qrCode = new AwesomeQR({ ...qrCodeOpts, text: authRequestURI })\n qrCodeDataUri = `data:image/png;base64,${(await qrCode.draw())!.toString('base64')}`\n } else {\n qrCodeDataUri = authRequestURI\n }\n\n const authRequestBody = {\n query_id: queryId,\n correlation_id: correlationId,\n request_uri: authRequestURI,\n status_uri: `${uriWithBase(opts?.webappAuthStatusPath ?? `/backend/auth/status/${correlationId}`, { baseURI: opts?.webappBaseURI })}`,\n ...(qrCodeDataUri && { qr_uri: qrCodeDataUri }),\n } satisfies CreateAuthorizationResponsePayload\n console.log(`Auth Request URI data to send back: ${JSON.stringify(authRequestBody)}`)\n\n return response.status(201).json(authRequestBody)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: 'Could not create an authorization request URI' }, error)\n }\n },\n )\n}\n\nexport function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`removeAuthStatus universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/requests/:correlationId'\n router.delete(path, checkAuth(opts?.endpoint), async (request: DeleteAuthorizationRequest, response: Response) => {\n try {\n const correlationId: string = request.params.correlationId\n\n const authRequestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n errorOnNotFound: false,\n })\n if (!authRequestState) {\n console.log(`No authorization request could be found for the given correlationId. correlationId: ${correlationId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No authorization request could be found' })\n }\n\n await context.agent.siopDeleteAuthState({ correlationId })\n\n return response.status(204).json()\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n\nexport function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`authStatus universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/auth/status/:correlationId'\n router.get(path, checkAuth(opts?.endpoint), async (request: GetAuthorizationRequestStatus, response: Response) => {\n try {\n console.log('Received auth-status request...')\n const correlationId: string = request.params.correlationId\n\n const requestState = await context.agent.siopGetAuthRequestState({\n correlationId,\n errorOnNotFound: false,\n })\n\n if (!requestState) {\n console.log(`No authorization request could be found for the given correlationId. correlationId: ${correlationId}`)\n return sendErrorResponse(response, 404, { status: 404, message: 'No authorization request could be found' })\n }\n\n let responseState\n if (requestState.status === AuthorizationRequestStateStatus.RETRIEVED) {\n responseState = await context.agent.siopGetAuthResponseState({\n correlationId,\n errorOnNotFound: false\n })\n }\n const overallState = responseState ?? requestState\n\n const statusBody = {\n status: overallState.status,\n correlation_id: overallState.correlationId,\n query_id: overallState.queryId,\n last_updated: overallState.lastUpdated,\n ...('verifiedData' in overallState && { verified_data: overallState.verifiedData }),\n ...(overallState.error && { message: overallState.error.message })\n } satisfies AuthStatusResponse\n console.debug(`Will send auth status: ${JSON.stringify(statusBody)}`)\n\n if (overallState.status === 'error') {\n return response.status(500).json(statusBody)\n }\n return response.status(200).json(statusBody)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n\nexport function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts) {\n if (opts?.enabled === false) {\n console.log(`getDefinitions universal OID4VP endpoint is disabled`)\n return\n }\n\n const path = opts?.path ?? '/backend/definitions'\n router.get(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {\n try {\n const definitions = await context.agent.pdmGetDefinitions()\n response.statusCode = 200\n return response.json(definitions)\n } catch (error) {\n return sendErrorResponse(response, 500, { status: 500, message: error.message }, error)\n }\n })\n}\n","import { Request, Response, NextFunction } from 'express';\nimport { z, ZodError } from 'zod';\n\nexport const validateData = (schema: z.ZodObject<any, any>) => {\n return (req: Request, res: Response, next: NextFunction) => {\n try {\n schema.parse(req.body);\n next();\n } catch (error) {\n if (error instanceof ZodError) {\n const errorMessages = error.issues.map((issue: any) => ({\n message: `${issue.path.join('.')} is ${issue.message}`,\n }))\n res.status(400).json({ status: 400, message: 'Invalid data', error_details: errorMessages[0].message });\n } else {\n res.status(500).json({ status: 500, message: 'Internal Server Error' });\n }\n }\n };\n}\n","import { agentContext } from '@sphereon/ssi-sdk.core'\nimport { copyGlobalAuthToEndpoints, ExpressSupport } from '@sphereon/ssi-express-support'\nimport { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth'\nimport { TAgent } from '@veramo/core'\nimport express, { Express, Request, Response, Router } from 'express'\nimport { getAuthRequestSIOPv2Endpoint, verifyAuthResponseSIOPv2Endpoint } from './siop-api-functions'\nimport { IRequiredPlugins, ISIOPv2RPRestAPIOpts } from './types'\nimport {\n authStatusUniversalOID4VPEndpoint,\n createAuthRequestUniversalOID4VPEndpoint,\n getDefinitionsEndpoint,\n removeAuthRequestStateUniversalOID4VPEndpoint,\n} from './universal-oid4vp-api-functions'\nimport swaggerUi from 'swagger-ui-express'\n\nexport class SIOPv2RPApiServer {\n private readonly _express: Express\n private readonly _router: Router\n private readonly _agent: TAgent<ISIOPv2RP>\n private readonly _opts?: ISIOPv2RPRestAPIOpts\n private readonly _basePath: string\n\n private readonly OID4VP_SWAGGER_URL = 'https://api.swaggerhub.com/apis/SphereonInt/OID4VP/0.1.0'\n constructor(args: { agent: TAgent<IRequiredPlugins>; expressSupport: ExpressSupport; opts?: ISIOPv2RPRestAPIOpts }) {\n const { agent, opts } = args\n this._agent = agent\n copyGlobalAuthToEndpoints({ opts, keys: ['webappCreateAuthRequest', 'webappAuthStatus', 'webappDeleteAuthRequest'] })\n if (opts?.endpointOpts?.globalAuth?.secureSiopEndpoints) {\n copyGlobalAuthToEndpoints({ opts, keys: ['siopGetAuthRequest', 'siopVerifyAuthResponse'] })\n }\n\n this._opts = opts\n this._express = args.expressSupport.express\n this._router = express.Router()\n const context = agentContext(agent)\n\n const features = opts?.enableFeatures ?? ['rp-status', 'siop']\n console.log(`SIOPv2 API enabled, with features: ${JSON.stringify(features)}}`)\n\n // Webapp endpoints\n if (features.includes('rp-status')) {\n createAuthRequestUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappCreateAuthRequest)\n authStatusUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappAuthStatus)\n removeAuthRequestStateUniversalOID4VPEndpoint(this._router, context, opts?.endpointOpts?.webappDeleteAuthRequest)\n getDefinitionsEndpoint(this._router, context, opts?.endpointOpts?.webappGetDefinitions)\n }\n\n // SIOPv2 endpoints\n if (features.includes('siop')) {\n getAuthRequestSIOPv2Endpoint(this._router, context, opts?.endpointOpts?.siopGetAuthRequest)\n verifyAuthResponseSIOPv2Endpoint(this._router, context, opts?.endpointOpts?.siopVerifyAuthResponse)\n }\n this._basePath = opts?.endpointOpts?.basePath ?? ''\n this._express.use(this._basePath, this.router)\n this._express.set('trust proxy', opts?.endpointOpts?.trustProxy ?? true)\n this.setupSwaggerUi()\n }\n\n private setupSwaggerUi() {\n fetch(this.OID4VP_SWAGGER_URL)\n .then((res) => res.json())\n .then((swagger: any) => {\n const apiDocs = `${this._basePath}/api-docs`\n console.log(`[OID4P] API docs available at ${apiDocs}`)\n\n this._router.use(\n '/api-docs',\n (req: Request, res: Response, next: any) => {\n const regex = `${apiDocs.replace(/\\//, '\\/')}`.replace('/oid4vp', '').replace(/\\/api-docs.*/, '')\n swagger.servers = [{ url: `${req.protocol}://${req.get('host')}${regex}`, description: 'This server' }]\n // @ts-ignore\n req.swaggerDoc = swagger\n next()\n },\n swaggerUi.serveFiles(swagger, options),\n swaggerUi.setup(),\n )\n })\n .catch((err) => {\n console.log(`[OID4VP] Unable to fetch swagger document: ${err}. Will not host api-docs on this instance`)\n })\n const options = {\n // customCss: '.swagger-ui .topbar { display: none }',\n }\n }\n get express(): Express {\n return this._express\n }\n\n get router(): Router {\n return this._router\n }\n\n get agent(): TAgent<ISIOPv2RP> {\n return this._agent\n }\n\n get opts(): ISIOPv2RPRestAPIOpts | undefined {\n return this._opts\n }\n}\n"],"mappings":";;;;AACA,SAASA,WAAgCC,yBAAyB;AAElE,SAASC,wBAAwB;AAIjC,IAAMC,6BAA6B,wBAACC,YAAAA;AAClC,QAAMC,cAAcD,QAAQE,OAAO,cAAA;AAEnC,MAAID,gBAAgB,oBAAoB;AACtC,UAAME,UAAU,OAAOH,QAAQI,SAAS,WAAWC,KAAKC,MAAMN,QAAQI,IAAI,IAAIJ,QAAQI;AACtF,WAAOD;EACT;AAEA,MAAIF,gBAAgB,qCAAqC;AACvD,UAAME,UAAUH,QAAQI;AAGxB,QAAI,OAAOD,QAAQI,4BAA4B,UAAU;AACvDC,cAAQC,IAAI,gIAAgI;AAC5IN,cAAQI,0BAA0BF,KAAKC,MAAMH,QAAQI,uBAAuB;IAC9E;AAGA,QAAI,OAAOJ,QAAQO,aAAa,UAAU;AACxC,YAAM,EAAEA,SAAQ,IAAKP;AAIrB,UAAKO,SAASC,WAAW,GAAA,KAAQD,SAASE,SAAS,GAAA,KAASC,iBAAiBC,iBAAiBJ,QAAAA,GAAW;AACvGP,gBAAQO,WAAWL,KAAKC,MAAMI,QAAAA;MAChC;IACF;AAEA,WAAOP;EACT;AAEA,QAAM,IA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X;AACjBG,aAAAA;MACF,GACAS,UAAUC,WAAWb,SAASc,OAAAA,GAC9BF,UAAUG,MAAK,CAAA;IAEnB,CAAA,EACCC,MAAM,CAACC,QAAAA;AACN5C,cAAQC,IAAI,8CAA8C2C,GAAAA,2CAA8C;IAC1G,CAAA;AACF,UAAMH,UAAU,CAEhB;EACF;EACA,IAAI/C,UAAmB;AACrB,WAAO,KAAKf;EACd;EAEA,IAAIwC,SAAiB;AACnB,WAAO,KAAKvC;EACd;EAEA,IAAIM,QAA2B;AAC7B,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAyC;AAC3C,WAAO,KAAKL;EACd;AACF;","names":["checkAuth","sendErrorResponse","CredentialMapper","parseAuthorizationResponse","request","contentType","header","payload","body","JSON","parse","presentation_submission","console","log","vp_token","startsWith","endsWith","CredentialMapper","isJsonLdAsString","Error","verifyAuthResponseSIOPv2Endpoint","router","context","opts","enabled","path","post","checkAuth","endpoint","response","correlationId","queryId","tenantId","version","params","sendErrorResponse","debug","stringify","definitionItems","agent","pdmGetDefinitions","filter","id","length","statusCode","statusMessage","send","authorizationResponse","definitionItem","verifiedResponse","siopVerifyAuthResponse","dcqlQuery","query","presentation","oid4vpSubmission","Object","keys","authorizationChallengeValidationResponse","presentation_during_issuance_session","is_first_party","setHeader","responseRedirectURI","siopGetRedirectURI","state","redirect_uri","error","getAuthRequestSIOPv2Endpoint","get","requestState","siopGetAuthRequestState","errorOnNotFound","requestObject","getPayload","dcql_query","toJwt","e","message","undefined","siopUpdateAuthRequestState","AuthorizationRequestStateStatus","createAuthorizationRequestFromPayload","CreateAuthorizationRequestPayloadSchema","checkAuth","sendErrorResponse","uriWithBase","uuid","ZodError","validateData","schema","req","res","next","parse","body","error","ZodError","errorMessages","issues","map","issue","message","path","join","status","json","error_details","createAuthRequestUniversalOID4VPEndpoint","router","context","opts","enabled","console","log","path","post","checkAuth","endpoint","validateData","CreateAuthorizationRequestPayloadSchema","request","response","authRequest","createAuthorizationRequestFromPayload","body","correlationId","uuid","qrCodeOpts","qrCode","queryId","definitionItems","agent","pdmGetDefinitions","filter","id","length","sendErrorResponse","status","message","requestByReferenceURI","uriWithBase","baseURI","requestUriBase","siopBaseURI","responseURI","authRequestURI","siopCreateAuthRequestURI","nonce","responseURIType","directPostResponseRedirectUri","responseRedirectURI","callback","qrCodeDataUri","AwesomeQR","text","draw","toString","authRequestBody","query_id","correlation_id","request_uri","status_uri","webappAuthStatusPath","webappBaseURI","qr_uri","JSON","stringify","json","error","removeAuthRequestStateUniversalOID4VPEndpoint","delete","params","authRequestState","siopGetAuthRequestState","errorOnNotFound","siopDeleteAuthState","authStatusUniversalOID4VPEndpoint","get","requestState","responseState","AuthorizationRequestStateStatus","RETRIEVED","siopGetAuthResponseState","overallState","statusBody","last_updated","lastUpdated","verified_data","verifiedData","debug","getDefinitionsEndpoint","definitions","statusCode","agentContext","copyGlobalAuthToEndpoints","express","swaggerUi","SIOPv2RPApiServer","_express","_router","_agent","_opts","_basePath","OID4VP_SWAGGER_URL","args","agent","opts","copyGlobalAuthToEndpoints","keys","endpointOpts","globalAuth","secureSiopEndpoints","expressSupport","express","Router","context","agentContext","features","enableFeatures","console","log","JSON","stringify","includes","createAuthRequestUniversalOID4VPEndpoint","webappCreateAuthRequest","authStatusUniversalOID4VPEndpoint","webappAuthStatus","removeAuthRequestStateUniversalOID4VPEndpoint","webappDeleteAuthRequest","getDefinitionsEndpoint","webappGetDefinitions","getAuthRequestSIOPv2Endpoint","siopGetAuthRequest","verifyAuthResponseSIOPv2Endpoint","siopVerifyAuthResponse","basePath","use","router","set","trustProxy","setupSwaggerUi","fetch","then","res","json","swagger","apiDocs","req","next","regex","replace","servers","url","protocol","get","description","swaggerDoc","swaggerUi","serveFiles","options","setup","catch","err"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api",
|
|
3
|
-
"version": "0.34.1-fix.
|
|
3
|
+
"version": "0.34.1-fix.223+9c86d039",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"start:dev": "ts-node __tests__/RestAPI.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sphereon/did-auth-siop": "0.19.1-feature.DIIPv4.
|
|
27
|
-
"@sphereon/ssi-express-support": "0.34.1-fix.
|
|
28
|
-
"@sphereon/ssi-sdk.core": "0.34.1-fix.
|
|
29
|
-
"@sphereon/ssi-sdk.credential-validation": "0.34.1-fix.
|
|
30
|
-
"@sphereon/ssi-sdk.kv-store-temp": "0.34.1-fix.
|
|
31
|
-
"@sphereon/ssi-sdk.pd-manager": "0.34.1-fix.
|
|
32
|
-
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-fix.
|
|
33
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-fix.
|
|
34
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth": "0.34.1-fix.
|
|
35
|
-
"@sphereon/ssi-types": "0.34.1-fix.
|
|
26
|
+
"@sphereon/did-auth-siop": "0.19.1-feature.DIIPv4.170",
|
|
27
|
+
"@sphereon/ssi-express-support": "0.34.1-fix.223+9c86d039",
|
|
28
|
+
"@sphereon/ssi-sdk.core": "0.34.1-fix.223+9c86d039",
|
|
29
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-fix.223+9c86d039",
|
|
30
|
+
"@sphereon/ssi-sdk.kv-store-temp": "0.34.1-fix.223+9c86d039",
|
|
31
|
+
"@sphereon/ssi-sdk.pd-manager": "0.34.1-fix.223+9c86d039",
|
|
32
|
+
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-fix.223+9c86d039",
|
|
33
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-fix.223+9c86d039",
|
|
34
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth": "0.34.1-fix.223+9c86d039",
|
|
35
|
+
"@sphereon/ssi-types": "0.34.1-fix.223+9c86d039",
|
|
36
36
|
"@veramo/core": "4.2.0",
|
|
37
37
|
"@veramo/credential-w3c": "4.2.0",
|
|
38
38
|
"awesome-qr": "^2.1.5-rc.0",
|
|
@@ -49,14 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@decentralized-identity/ion-sdk": "^0.6.0",
|
|
52
|
-
"@sphereon/did-auth-siop-adapter": "0.19.1-feature.DIIPv4.
|
|
52
|
+
"@sphereon/did-auth-siop-adapter": "0.19.1-feature.DIIPv4.170",
|
|
53
53
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
54
|
-
"@sphereon/
|
|
55
|
-
"@sphereon/
|
|
56
|
-
"@sphereon/ssi-sdk-ext.
|
|
57
|
-
"@sphereon/ssi-sdk.
|
|
58
|
-
"@sphereon/ssi-sdk.
|
|
59
|
-
"@sphereon/ssi-sdk.
|
|
54
|
+
"@sphereon/pex": "5.0.0-unstable.28",
|
|
55
|
+
"@sphereon/pex-models": "^2.3.2",
|
|
56
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.34.1-fix.223+9c86d039",
|
|
57
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-fix.223+9c86d039",
|
|
58
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-fix.223+9c86d039",
|
|
59
|
+
"@sphereon/ssi-sdk.credential-vcdm": "0.34.1-fix.223+9c86d039",
|
|
60
|
+
"@sphereon/ssi-sdk.credential-vcdm-jsonld-provider": "0.34.1-fix.223+9c86d039",
|
|
61
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-fix.223+9c86d039",
|
|
60
62
|
"@types/body-parser": "^1.19.5",
|
|
61
63
|
"@types/cookie-parser": "^1.4.7",
|
|
62
64
|
"@types/cors": "^2.8.17",
|
|
@@ -115,5 +117,5 @@
|
|
|
115
117
|
"OpenID Connect",
|
|
116
118
|
"Authenticator"
|
|
117
119
|
],
|
|
118
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "9c86d03951f1267495e456d1fbfd9eb380f27e78"
|
|
119
121
|
}
|