@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.34.1-feature.DIIPv4.144 → 0.34.1-feature.DIIPv4.156
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/src/webapp-api-functions.ts +0 -183
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,62 @@
|
|
|
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 * as _sphereon_did_auth_siop from '@sphereon/did-auth-siop';
|
|
11
|
+
import { ResponseType, ResponseMode } from '@sphereon/did-auth-siop';
|
|
12
|
+
|
|
13
|
+
declare const CreateAuthorizationRequestBodySchema: z.ZodObject<{
|
|
14
|
+
query_id: z.ZodString;
|
|
15
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
request_uri_base: z.ZodOptional<z.ZodString>;
|
|
17
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
request_uri_method: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
get: "get";
|
|
20
|
+
post: "post";
|
|
21
|
+
}>>;
|
|
22
|
+
response_type: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
vp_token: ResponseType.VP_TOKEN;
|
|
24
|
+
}>>;
|
|
25
|
+
response_mode: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
direct_post: ResponseMode.DIRECT_POST;
|
|
27
|
+
"direct_post.jwt": ResponseMode.DIRECT_POST_JWT;
|
|
28
|
+
}>>;
|
|
29
|
+
transaction_data: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
qr_code: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
color_dark: z.ZodOptional<z.ZodString>;
|
|
33
|
+
color_light: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
direct_post_response_redirect_uri: z.ZodOptional<z.ZodString>;
|
|
36
|
+
callback: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
verified_data: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
modes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
40
|
+
authorization_response: _sphereon_did_auth_siop.VerifiedDataMode.AUTHORIZATION_RESPONSE;
|
|
41
|
+
credential_claims_deserialized: _sphereon_did_auth_siop.VerifiedDataMode.CREDENTIAL_CLAIMS_DESERIALIZED;
|
|
42
|
+
vp_token: _sphereon_did_auth_siop.VerifiedDataMode.VP_TOKEN;
|
|
43
|
+
}>>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
46
|
+
authorization_request_created: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.CREATED;
|
|
47
|
+
authorization_request_retrieved: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.RETRIEVED;
|
|
48
|
+
authorization_response_received: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.RECEIVED;
|
|
49
|
+
authorization_response_verified: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.VERIFIED;
|
|
50
|
+
}>>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const CreateAuthorizationResponseSchema: z.ZodObject<{
|
|
54
|
+
correlation_id: z.ZodString;
|
|
55
|
+
query_id: z.ZodString;
|
|
56
|
+
request_uri: z.ZodString;
|
|
57
|
+
status_uri: z.ZodString;
|
|
58
|
+
qr_uri: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>;
|
|
7
60
|
|
|
8
61
|
interface ComponentOptions {
|
|
9
62
|
/**
|
|
@@ -235,13 +288,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
|
235
288
|
}
|
|
236
289
|
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
|
|
237
290
|
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
291
|
+
type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
|
|
292
|
+
type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
|
|
293
|
+
type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
|
|
294
|
+
type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
|
|
295
|
+
type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
296
|
+
type DeleteAuthorizationRequestPathParameters = {
|
|
297
|
+
correlationId: string;
|
|
298
|
+
};
|
|
299
|
+
type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
300
|
+
type GetAuthorizationRequestStatusPathParameters = {
|
|
301
|
+
correlationId: string;
|
|
302
|
+
};
|
|
303
|
+
type RequestError = {
|
|
304
|
+
status: number;
|
|
305
|
+
message: string;
|
|
306
|
+
error_details?: string;
|
|
307
|
+
};
|
|
308
|
+
interface AuthStatusResponse {
|
|
309
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
310
|
+
correlation_id: string;
|
|
311
|
+
query_id: string;
|
|
312
|
+
last_updated: number;
|
|
313
|
+
verified_data?: VerifiedData;
|
|
314
|
+
error?: RequestError;
|
|
315
|
+
}
|
|
316
|
+
type VerifiedData = {
|
|
317
|
+
authorization_response?: AuthorizationResponse;
|
|
318
|
+
credential_claims?: AdditionalClaims;
|
|
319
|
+
};
|
|
320
|
+
type AuthorizationResponse = {
|
|
321
|
+
presentation_submission?: Record<string, any>;
|
|
322
|
+
vp_token?: VpToken;
|
|
323
|
+
};
|
|
324
|
+
type SingleObjectVpTokenPE = Record<string, any>;
|
|
325
|
+
type SingleStringVpTokenPE = string;
|
|
326
|
+
type MultipleVpTokens = Array<SingleObjectVpTokenPE> | Array<SingleStringVpTokenPE>;
|
|
327
|
+
type MultipleVpTokenDCQL = {
|
|
328
|
+
[key: string]: MultipleVpTokens;
|
|
329
|
+
};
|
|
330
|
+
type VpToken = SingleObjectVpTokenPE | SingleStringVpTokenPE | MultipleVpTokens | MultipleVpTokenDCQL;
|
|
238
331
|
|
|
239
332
|
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
240
333
|
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
241
334
|
|
|
242
|
-
declare function
|
|
243
|
-
declare function
|
|
244
|
-
declare function
|
|
335
|
+
declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
|
|
336
|
+
declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
337
|
+
declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
245
338
|
declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
246
339
|
|
|
247
340
|
declare class SIOPv2RPApiServer {
|
|
@@ -263,4 +356,4 @@ declare class SIOPv2RPApiServer {
|
|
|
263
356
|
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
264
357
|
}
|
|
265
358
|
|
|
266
|
-
export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures,
|
|
359
|
+
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,9 +1,62 @@
|
|
|
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 * as _sphereon_did_auth_siop from '@sphereon/did-auth-siop';
|
|
11
|
+
import { ResponseType, ResponseMode } from '@sphereon/did-auth-siop';
|
|
12
|
+
|
|
13
|
+
declare const CreateAuthorizationRequestBodySchema: z.ZodObject<{
|
|
14
|
+
query_id: z.ZodString;
|
|
15
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
request_uri_base: z.ZodOptional<z.ZodString>;
|
|
17
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
request_uri_method: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
get: "get";
|
|
20
|
+
post: "post";
|
|
21
|
+
}>>;
|
|
22
|
+
response_type: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
vp_token: ResponseType.VP_TOKEN;
|
|
24
|
+
}>>;
|
|
25
|
+
response_mode: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
direct_post: ResponseMode.DIRECT_POST;
|
|
27
|
+
"direct_post.jwt": ResponseMode.DIRECT_POST_JWT;
|
|
28
|
+
}>>;
|
|
29
|
+
transaction_data: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
qr_code: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
color_dark: z.ZodOptional<z.ZodString>;
|
|
33
|
+
color_light: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
direct_post_response_redirect_uri: z.ZodOptional<z.ZodString>;
|
|
36
|
+
callback: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
verified_data: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
modes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
40
|
+
authorization_response: _sphereon_did_auth_siop.VerifiedDataMode.AUTHORIZATION_RESPONSE;
|
|
41
|
+
credential_claims_deserialized: _sphereon_did_auth_siop.VerifiedDataMode.CREDENTIAL_CLAIMS_DESERIALIZED;
|
|
42
|
+
vp_token: _sphereon_did_auth_siop.VerifiedDataMode.VP_TOKEN;
|
|
43
|
+
}>>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
46
|
+
authorization_request_created: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.CREATED;
|
|
47
|
+
authorization_request_retrieved: _sphereon_did_auth_siop.AuthorizationRequestStateStatus.RETRIEVED;
|
|
48
|
+
authorization_response_received: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.RECEIVED;
|
|
49
|
+
authorization_response_verified: _sphereon_did_auth_siop.AuthorizationResponseStateStatus.VERIFIED;
|
|
50
|
+
}>>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const CreateAuthorizationResponseSchema: z.ZodObject<{
|
|
54
|
+
correlation_id: z.ZodString;
|
|
55
|
+
query_id: z.ZodString;
|
|
56
|
+
request_uri: z.ZodString;
|
|
57
|
+
status_uri: z.ZodString;
|
|
58
|
+
qr_uri: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>;
|
|
7
60
|
|
|
8
61
|
interface ComponentOptions {
|
|
9
62
|
/**
|
|
@@ -235,13 +288,53 @@ interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
|
|
|
235
288
|
}
|
|
236
289
|
type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
|
|
237
290
|
type IRequiredContext = IAgentContext<IRequiredPlugins>;
|
|
291
|
+
type CreateAuthorizationRequest = Request<Record<string, never>, any, CreateAuthorizationRequestBody, Record<string, never>>;
|
|
292
|
+
type CreateAuthorizationRequestBody = z.infer<typeof CreateAuthorizationRequestBodySchema>;
|
|
293
|
+
type CreateAuthorizationResponse = Response<CreateAuthorizationRequestResponse>;
|
|
294
|
+
type CreateAuthorizationRequestResponse = z.infer<typeof CreateAuthorizationResponseSchema>;
|
|
295
|
+
type DeleteAuthorizationRequest = Request<DeleteAuthorizationRequestPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
296
|
+
type DeleteAuthorizationRequestPathParameters = {
|
|
297
|
+
correlationId: string;
|
|
298
|
+
};
|
|
299
|
+
type GetAuthorizationRequestStatus = Request<GetAuthorizationRequestStatusPathParameters, any, Record<string, any>, Record<string, any>>;
|
|
300
|
+
type GetAuthorizationRequestStatusPathParameters = {
|
|
301
|
+
correlationId: string;
|
|
302
|
+
};
|
|
303
|
+
type RequestError = {
|
|
304
|
+
status: number;
|
|
305
|
+
message: string;
|
|
306
|
+
error_details?: string;
|
|
307
|
+
};
|
|
308
|
+
interface AuthStatusResponse {
|
|
309
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
310
|
+
correlation_id: string;
|
|
311
|
+
query_id: string;
|
|
312
|
+
last_updated: number;
|
|
313
|
+
verified_data?: VerifiedData;
|
|
314
|
+
error?: RequestError;
|
|
315
|
+
}
|
|
316
|
+
type VerifiedData = {
|
|
317
|
+
authorization_response?: AuthorizationResponse;
|
|
318
|
+
credential_claims?: AdditionalClaims;
|
|
319
|
+
};
|
|
320
|
+
type AuthorizationResponse = {
|
|
321
|
+
presentation_submission?: Record<string, any>;
|
|
322
|
+
vp_token?: VpToken;
|
|
323
|
+
};
|
|
324
|
+
type SingleObjectVpTokenPE = Record<string, any>;
|
|
325
|
+
type SingleStringVpTokenPE = string;
|
|
326
|
+
type MultipleVpTokens = Array<SingleObjectVpTokenPE> | Array<SingleStringVpTokenPE>;
|
|
327
|
+
type MultipleVpTokenDCQL = {
|
|
328
|
+
[key: string]: MultipleVpTokens;
|
|
329
|
+
};
|
|
330
|
+
type VpToken = SingleObjectVpTokenPE | SingleStringVpTokenPE | MultipleVpTokens | MultipleVpTokenDCQL;
|
|
238
331
|
|
|
239
332
|
declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
240
333
|
declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
241
334
|
|
|
242
|
-
declare function
|
|
243
|
-
declare function
|
|
244
|
-
declare function
|
|
335
|
+
declare function createAuthRequestUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
|
|
336
|
+
declare function removeAuthRequestStateUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
337
|
+
declare function authStatusUniversalOID4VPEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
245
338
|
declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
|
|
246
339
|
|
|
247
340
|
declare class SIOPv2RPApiServer {
|
|
@@ -263,4 +356,4 @@ declare class SIOPv2RPApiServer {
|
|
|
263
356
|
get opts(): ISIOPv2RPRestAPIOpts | undefined;
|
|
264
357
|
}
|
|
265
358
|
|
|
266
|
-
export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures,
|
|
359
|
+
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 };
|