@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.34.1-feature.DIIPv4.144 → 0.34.1-feature.DIIPv4.152

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.d.cts CHANGED
@@ -1,9 +1,55 @@
1
1
  import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
2
- import { Router, Express } from 'express';
2
+ import { Request, Response, Router, Express } from 'express';
3
+ import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
3
4
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
4
5
  import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
5
- import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
6
6
  import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
7
+ import { AdditionalClaims } from '@sphereon/ssi-types';
8
+ import { AuthorizationRequestStateStatus, AuthorizationResponseStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
9
+ import { z } from 'zod';
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
+ status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
38
+ authorization_request_created: "authorization_request_created";
39
+ authorization_request_retrieved: "authorization_request_retrieved";
40
+ error: "error";
41
+ authorization_response_received: "authorization_response_received";
42
+ authorization_response_verified: "authorization_response_verified";
43
+ }>>>;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>;
46
+ declare const CreateAuthorizationResponseSchema: z.ZodObject<{
47
+ correlation_id: z.ZodString;
48
+ query_id: z.ZodString;
49
+ request_uri: z.ZodString;
50
+ status_uri: z.ZodString;
51
+ qr_uri: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>;
7
53
 
8
54
  interface ComponentOptions {
9
55
  /**
@@ -235,13 +281,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
235
281
  }
236
282
  type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
237
283
  type IRequiredContext = IAgentContext<IRequiredPlugins>;
284
+ type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
285
+ type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
286
+ type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
287
+ type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
288
+ type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
289
+ type DeleteAuthorizationRequestPathParameters = {
290
+ correlationId: string;
291
+ };
292
+ type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
293
+ type GetAuthorizationRequestStatusPathParameters = {
294
+ correlationId: string;
295
+ };
296
+ type RequestError = {
297
+ status: number;
298
+ message: string;
299
+ error_details?: string;
300
+ };
301
+ type GetAuthStatusResponse = {
302
+ status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
303
+ correlation_id: string;
304
+ query_id: string;
305
+ last_updated: number;
306
+ verified_data?: VerifiedData;
307
+ error?: RequestError;
308
+ };
309
+ type VerifiedData = {
310
+ authorization_response?: AuthorizationResponse;
311
+ credential_claims?: AdditionalClaims;
312
+ };
313
+ type AuthorizationResponse = {
314
+ presentation_submission?: Record<string, any>;
315
+ vp_token?: VpToken;
316
+ };
317
+ type SingleObjectVpTokenPE = Record<string, any>;
318
+ type SingleStringVpTokenPE = string;
319
+ type MultipleVpTokens = Array<SingleObjectVpTokenPE> | Array<SingleStringVpTokenPE>;
320
+ type MultipleVpTokenDCQL = {
321
+ [key: string]: MultipleVpTokens;
322
+ };
323
+ type VpToken = SingleObjectVpTokenPE | SingleStringVpTokenPE | MultipleVpTokens | MultipleVpTokenDCQL;
238
324
 
239
325
  declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
240
326
  declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
241
327
 
242
- declare function createAuthRequestWebappEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
243
- declare function authStatusWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
244
- declare function removeAuthRequestStateWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
328
+ declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
329
+ declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
330
+ declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
245
331
  declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
246
332
 
247
333
  declare class SIOPv2RPApiServer {
@@ -263,4 +349,4 @@ declare class SIOPv2RPApiServer {
263
349
  get opts(): ISIOPv2RPRestAPIOpts | undefined;
264
350
  }
265
351
 
266
- export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures, authStatusWebappEndpoint, createAuthRequestWebappEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateWebappEndpoint, verifyAuthResponseSIOPv2Endpoint };
352
+ export { type AuthorizationResponse, type ComponentOptions, type CreateAuthorizationRequest, type CreateAuthorizationRequestBody, type CreateAuthorizationRequestResponse, type CreateAuthorizationResponse, type DeleteAuthorizationRequest, type DeleteAuthorizationRequestPathParameters, type GetAuthStatusResponse, 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,9 +1,55 @@
1
1
  import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
2
- import { Router, Express } from 'express';
2
+ import { Request, Response, Router, Express } from 'express';
3
+ import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
3
4
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
4
5
  import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
5
- import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
6
6
  import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
7
+ import { AdditionalClaims } from '@sphereon/ssi-types';
8
+ import { AuthorizationRequestStateStatus, AuthorizationResponseStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
9
+ import { z } from 'zod';
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
+ status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
38
+ authorization_request_created: "authorization_request_created";
39
+ authorization_request_retrieved: "authorization_request_retrieved";
40
+ error: "error";
41
+ authorization_response_received: "authorization_response_received";
42
+ authorization_response_verified: "authorization_response_verified";
43
+ }>>>;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>;
46
+ declare const CreateAuthorizationResponseSchema: z.ZodObject<{
47
+ correlation_id: z.ZodString;
48
+ query_id: z.ZodString;
49
+ request_uri: z.ZodString;
50
+ status_uri: z.ZodString;
51
+ qr_uri: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>;
7
53
 
8
54
  interface ComponentOptions {
9
55
  /**
@@ -235,13 +281,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
235
281
  }
236
282
  type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
237
283
  type IRequiredContext = IAgentContext<IRequiredPlugins>;
284
+ type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
285
+ type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
286
+ type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
287
+ type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
288
+ type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
289
+ type DeleteAuthorizationRequestPathParameters = {
290
+ correlationId: string;
291
+ };
292
+ type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
293
+ type GetAuthorizationRequestStatusPathParameters = {
294
+ correlationId: string;
295
+ };
296
+ type RequestError = {
297
+ status: number;
298
+ message: string;
299
+ error_details?: string;
300
+ };
301
+ type GetAuthStatusResponse = {
302
+ status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
303
+ correlation_id: string;
304
+ query_id: string;
305
+ last_updated: number;
306
+ verified_data?: VerifiedData;
307
+ error?: RequestError;
308
+ };
309
+ type VerifiedData = {
310
+ authorization_response?: AuthorizationResponse;
311
+ credential_claims?: AdditionalClaims;
312
+ };
313
+ type AuthorizationResponse = {
314
+ presentation_submission?: Record<string, any>;
315
+ vp_token?: VpToken;
316
+ };
317
+ type SingleObjectVpTokenPE = Record<string, any>;
318
+ type SingleStringVpTokenPE = string;
319
+ type MultipleVpTokens = Array<SingleObjectVpTokenPE> | Array<SingleStringVpTokenPE>;
320
+ type MultipleVpTokenDCQL = {
321
+ [key: string]: MultipleVpTokens;
322
+ };
323
+ type VpToken = SingleObjectVpTokenPE | SingleStringVpTokenPE | MultipleVpTokens | MultipleVpTokenDCQL;
238
324
 
239
325
  declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
240
326
  declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
241
327
 
242
- declare function createAuthRequestWebappEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
243
- declare function authStatusWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
244
- declare function removeAuthRequestStateWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
328
+ declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
329
+ declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
330
+ declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
245
331
  declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
246
332
 
247
333
  declare class SIOPv2RPApiServer {
@@ -263,4 +349,4 @@ declare class SIOPv2RPApiServer {
263
349
  get opts(): ISIOPv2RPRestAPIOpts | undefined;
264
350
  }
265
351
 
266
- export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures, authStatusWebappEndpoint, createAuthRequestWebappEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateWebappEndpoint, verifyAuthResponseSIOPv2Endpoint };
352
+ export { type AuthorizationResponse, type ComponentOptions, type CreateAuthorizationRequest, type CreateAuthorizationRequestBody, type CreateAuthorizationRequestResponse, type CreateAuthorizationResponse, type DeleteAuthorizationRequest, type DeleteAuthorizationRequestPathParameters, type GetAuthStatusResponse, 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 };