@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.34.1-fix.148 → 0.34.1-fix.161
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 +195 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -6
- package/dist/index.d.ts +99 -6
- package/dist/index.js +192 -115
- package/dist/index.js.map +1 -1
- package/package.json +21 -18
- package/src/index.ts +1 -1
- package/src/middleware/validationMiddleware.ts +20 -0
- package/src/schemas/index.ts +42 -0
- package/src/siop-api-functions.ts +4 -5
- package/src/siopv2-rp-api-server.ts +7 -7
- package/src/types/types.ts +68 -1
- package/src/universal-oid4vp-api-functions.ts +173 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
1
|
import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
|
|
2
|
-
import { Router, Express } from 'express';
|
|
3
|
-
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
2
|
+
import { Request, Response, Router, Express } from 'express';
|
|
4
3
|
import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
|
|
4
|
+
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
5
5
|
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
6
|
+
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
7
|
+
import { AuthorizationRequestStateStatus, AuthorizationResponseStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import * as _sphereon_did_auth_siop from '@sphereon/did-auth-siop';
|
|
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
59
|
|
|
7
60
|
interface ComponentOptions {
|
|
8
61
|
/**
|
|
@@ -234,13 +287,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
|
234
287
|
}
|
|
235
288
|
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPDManager;
|
|
236
289
|
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
290
|
+
type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
|
|
291
|
+
type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
|
|
292
|
+
type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
|
|
293
|
+
type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
|
|
294
|
+
type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
295
|
+
type DeleteAuthorizationRequestPathParameters = {
|
|
296
|
+
correlationId: string;
|
|
297
|
+
};
|
|
298
|
+
type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
299
|
+
type GetAuthorizationRequestStatusPathParameters = {
|
|
300
|
+
correlationId: string;
|
|
301
|
+
};
|
|
302
|
+
type RequestError = {
|
|
303
|
+
status: number;
|
|
304
|
+
message: string;
|
|
305
|
+
error_details?: string;
|
|
306
|
+
};
|
|
307
|
+
interface AuthStatusResponse {
|
|
308
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
309
|
+
correlation_id: string;
|
|
310
|
+
query_id: string;
|
|
311
|
+
last_updated: number;
|
|
312
|
+
verified_data?: VerifiedData;
|
|
313
|
+
error?: RequestError;
|
|
314
|
+
}
|
|
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;
|
|
237
330
|
|
|
238
331
|
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
239
332
|
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
240
333
|
|
|
241
|
-
declare function
|
|
242
|
-
declare function
|
|
243
|
-
declare function
|
|
334
|
+
declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
|
|
335
|
+
declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
336
|
+
declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
244
337
|
declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
245
338
|
|
|
246
339
|
declare class SIOPv2RPApiServer {
|
|
@@ -262,4 +355,4 @@ declare class SIOPv2RPApiServer {
|
|
|
262
355
|
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
263
356
|
}
|
|
264
357
|
|
|
265
|
-
export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures,
|
|
358
|
+
export { type AuthStatusResponse, type AuthorizationResponse, type ComponentOptions, type CreateAuthorizationRequest, type CreateAuthorizationRequestBody, type CreateAuthorizationRequestResponse, type CreateAuthorizationResponse, type DeleteAuthorizationRequest, type DeleteAuthorizationRequestPathParameters, type GetAuthorizationRequestStatus, type GetAuthorizationRequestStatusPathParameters, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type MultipleVpTokenDCQL, type MultipleVpTokens, type QRCodeOpts, type RequestError, SIOPv2RPApiServer, type SingleObjectVpTokenPE, type SingleStringVpTokenPE, type SiopFeatures, type VerifiedData, type VpToken, authStatusUniversalOID4VPEndpoint, createAuthRequestUniversalOID4VPEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateUniversalOID4VPEndpoint, verifyAuthResponseSIOPv2Endpoint };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
1
|
import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
|
|
2
|
-
import { Router, Express } from 'express';
|
|
3
|
-
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
2
|
+
import { Request, Response, Router, Express } from 'express';
|
|
4
3
|
import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
|
|
4
|
+
import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
|
|
5
5
|
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
6
|
+
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
7
|
+
import { AuthorizationRequestStateStatus, AuthorizationResponseStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import * as _sphereon_did_auth_siop from '@sphereon/did-auth-siop';
|
|
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
59
|
|
|
7
60
|
interface ComponentOptions {
|
|
8
61
|
/**
|
|
@@ -234,13 +287,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
|
234
287
|
}
|
|
235
288
|
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPDManager;
|
|
236
289
|
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
290
|
+
type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
|
|
291
|
+
type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
|
|
292
|
+
type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
|
|
293
|
+
type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
|
|
294
|
+
type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
295
|
+
type DeleteAuthorizationRequestPathParameters = {
|
|
296
|
+
correlationId: string;
|
|
297
|
+
};
|
|
298
|
+
type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
299
|
+
type GetAuthorizationRequestStatusPathParameters = {
|
|
300
|
+
correlationId: string;
|
|
301
|
+
};
|
|
302
|
+
type RequestError = {
|
|
303
|
+
status: number;
|
|
304
|
+
message: string;
|
|
305
|
+
error_details?: string;
|
|
306
|
+
};
|
|
307
|
+
interface AuthStatusResponse {
|
|
308
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
309
|
+
correlation_id: string;
|
|
310
|
+
query_id: string;
|
|
311
|
+
last_updated: number;
|
|
312
|
+
verified_data?: VerifiedData;
|
|
313
|
+
error?: RequestError;
|
|
314
|
+
}
|
|
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;
|
|
237
330
|
|
|
238
331
|
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
239
332
|
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
240
333
|
|
|
241
|
-
declare function
|
|
242
|
-
declare function
|
|
243
|
-
declare function
|
|
334
|
+
declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
|
|
335
|
+
declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
336
|
+
declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
244
337
|
declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
245
338
|
|
|
246
339
|
declare class SIOPv2RPApiServer {
|
|
@@ -262,4 +355,4 @@ declare class SIOPv2RPApiServer {
|
|
|
262
355
|
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
263
356
|
}
|
|
264
357
|
|
|
265
|
-
export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures,
|
|
358
|
+
export { type AuthStatusResponse, type AuthorizationResponse, type ComponentOptions, type CreateAuthorizationRequest, type CreateAuthorizationRequestBody, type CreateAuthorizationRequestResponse, type CreateAuthorizationResponse, type DeleteAuthorizationRequest, type DeleteAuthorizationRequestPathParameters, type GetAuthorizationRequestStatus, type GetAuthorizationRequestStatusPathParameters, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type MultipleVpTokenDCQL, type MultipleVpTokens, type QRCodeOpts, type RequestError, SIOPv2RPApiServer, type SingleObjectVpTokenPE, type SingleStringVpTokenPE, type SiopFeatures, type VerifiedData, type VpToken, authStatusUniversalOID4VPEndpoint, createAuthRequestUniversalOID4VPEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateUniversalOID4VPEndpoint, verifyAuthResponseSIOPv2Endpoint };
|