@sphereon/ssi-sdk.siopv2-oid4vp-rp-rest-api 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.3

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.
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.verifyAuthResponseSIOPv2Endpoint = verifyAuthResponseSIOPv2Endpoint;
13
+ exports.getAuthRequestSIOPv2Endpoint = getAuthRequestSIOPv2Endpoint;
14
+ const did_auth_siop_1 = require("@sphereon/did-auth-siop");
15
+ const ssi_express_support_1 = require("@sphereon/ssi-express-support");
16
+ const ssi_types_1 = require("@sphereon/ssi-types");
17
+ const parseAuthorizationResponse = (request) => {
18
+ const contentType = request.header('content-type');
19
+ if (contentType === 'application/json') {
20
+ const payload = typeof request.body === 'string' ? JSON.parse(request.body) : request.body;
21
+ return payload;
22
+ }
23
+ if (contentType === 'application/x-www-form-urlencoded') {
24
+ const payload = request.body;
25
+ // Parse presentation_submission if it's a string
26
+ if (typeof payload.presentation_submission === 'string') {
27
+ console.log(`Supplied presentation_submission was a string instead of JSON. Correcting, but external party should fix their implementation!`);
28
+ payload.presentation_submission = JSON.parse(payload.presentation_submission);
29
+ }
30
+ // when using FORM_URL_ENCODED, vp_token comes back as string not matter whether the input was string, object or array. Handled below.
31
+ if (typeof payload.vp_token === 'string') {
32
+ const { vp_token } = payload;
33
+ // The only use case where vp_object is an object is JsonLdAsString atm. For arrays, any objects will be parsed along with the array
34
+ // (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)
35
+ if ((vp_token.startsWith('[') && vp_token.endsWith(']')) || ssi_types_1.CredentialMapper.isJsonLdAsString(vp_token)) {
36
+ payload.vp_token = JSON.parse(vp_token);
37
+ }
38
+ }
39
+ return payload;
40
+ }
41
+ throw new Error(`Unsupported content type: ${contentType}. Currently only application/x-www-form-urlencoded and application/json (for direct_post) are supported`);
42
+ };
43
+ function verifyAuthResponseSIOPv2Endpoint(router, context, opts) {
44
+ var _a;
45
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
46
+ console.log(`verifyAuthResponse SIOP endpoint is disabled`);
47
+ return;
48
+ }
49
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/siop/definitions/:definitionId/auth-responses/:correlationId';
50
+ router.post(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
51
+ var _a, _b;
52
+ try {
53
+ const { correlationId, definitionId, tenantId, version } = request.params;
54
+ if (!correlationId || !definitionId) {
55
+ console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, definitionId: ${definitionId}`);
56
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 404, 'No authorization request could be found');
57
+ }
58
+ console.log('Authorization Response (siop-sessions');
59
+ console.log(JSON.stringify(request.body, null, 2));
60
+ const definitionItems = yield context.agent.pdmGetDefinitions({ filter: [{ definitionId, tenantId, version }] });
61
+ if (definitionItems.length === 0) {
62
+ console.log(`Could not get definition ${definitionId} from agent. Will return 404`);
63
+ response.statusCode = 404;
64
+ response.statusMessage = `No definition ${definitionId}`;
65
+ return response.send();
66
+ }
67
+ const authorizationResponse = parseAuthorizationResponse(request);
68
+ console.log(`URI: ${JSON.stringify(authorizationResponse)}`);
69
+ const definitionItem = definitionItems[0];
70
+ const verifiedResponse = yield context.agent.siopVerifyAuthResponse({
71
+ authorizationResponse,
72
+ correlationId,
73
+ definitionId,
74
+ presentationDefinitions: [
75
+ {
76
+ location: (_a = opts === null || opts === void 0 ? void 0 : opts.presentationDefinitionLocation) !== null && _a !== void 0 ? _a : did_auth_siop_1.PresentationDefinitionLocation.TOPLEVEL_PRESENTATION_DEF,
77
+ definition: definitionItem.definitionPayload,
78
+ },
79
+ ],
80
+ dcqlQuery: definitionItem.dcqlPayload,
81
+ });
82
+ const wrappedPresentation = (_b = verifiedResponse === null || verifiedResponse === void 0 ? void 0 : verifiedResponse.oid4vpSubmission) === null || _b === void 0 ? void 0 : _b.presentations[0];
83
+ if (wrappedPresentation) {
84
+ // const credentialSubject = wrappedPresentation.presentation.verifiableCredential[0]?.credential?.credentialSubject
85
+ // console.log(JSON.stringify(credentialSubject, null, 2))
86
+ console.log('PRESENTATION:' + JSON.stringify(wrappedPresentation.presentation, null, 2));
87
+ response.statusCode = 200;
88
+ const authorizationChallengeValidationResponse = {
89
+ presentation_during_issuance_session: verifiedResponse.correlationId,
90
+ };
91
+ if (authorizationResponse.is_first_party) {
92
+ response.setHeader('Content-Type', 'application/json');
93
+ return response.send(JSON.stringify(authorizationChallengeValidationResponse));
94
+ }
95
+ const responseRedirectURI = yield context.agent.siopGetRedirectURI({ correlationId, definitionId, state: verifiedResponse.state });
96
+ if (responseRedirectURI) {
97
+ response.setHeader('Content-Type', 'application/json');
98
+ return response.send(JSON.stringify({ redirect_uri: responseRedirectURI }));
99
+ }
100
+ // todo: delete session
101
+ }
102
+ else {
103
+ console.log('Missing Presentation (Verifiable Credentials)');
104
+ response.statusCode = 500;
105
+ response.statusMessage = 'Missing Presentation (Verifiable Credentials)';
106
+ }
107
+ return response.send();
108
+ }
109
+ catch (error) {
110
+ console.error(error);
111
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, 'Could not verify auth status', error);
112
+ }
113
+ }));
114
+ }
115
+ function getAuthRequestSIOPv2Endpoint(router, context, opts) {
116
+ var _a;
117
+ if ((opts === null || opts === void 0 ? void 0 : opts.enabled) === false) {
118
+ console.log(`getAuthRequest SIOP endpoint is disabled`);
119
+ return;
120
+ }
121
+ const path = (_a = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _a !== void 0 ? _a : '/siop/definitions/:definitionId/auth-requests/:correlationId';
122
+ router.get(path, (0, ssi_express_support_1.checkAuth)(opts === null || opts === void 0 ? void 0 : opts.endpoint), (request, response) => __awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b;
124
+ try {
125
+ const correlationId = request.params.correlationId;
126
+ const definitionId = request.params.definitionId;
127
+ if (!correlationId || !definitionId) {
128
+ console.log(`No authorization request could be found for the given url. correlationId: ${correlationId}, definitionId: ${definitionId}`);
129
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 404, 'No authorization request could be found');
130
+ }
131
+ const requestState = yield context.agent.siopGetAuthRequestState({
132
+ correlationId,
133
+ definitionId,
134
+ errorOnNotFound: false,
135
+ });
136
+ if (!requestState) {
137
+ console.log(`No authorization request could be found for the given url in the state manager. correlationId: ${correlationId}, definitionId: ${definitionId}`);
138
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 404, `No authorization request could be found`);
139
+ }
140
+ const requestObject = yield ((_b = (_a = requestState.request) === null || _a === void 0 ? void 0 : _a.requestObject) === null || _b === void 0 ? void 0 : _b.toJwt());
141
+ console.log('JWT Request object:');
142
+ console.log(requestObject);
143
+ let error;
144
+ try {
145
+ response.statusCode = 200;
146
+ response.setHeader('Content-Type', 'application/jwt');
147
+ return response.send(requestObject);
148
+ }
149
+ catch (e) {
150
+ error = typeof e === 'string' ? e : e instanceof Error ? e.message : undefined;
151
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, 'Could not get authorization request', e);
152
+ }
153
+ finally {
154
+ yield context.agent.siopUpdateAuthRequestState({
155
+ correlationId,
156
+ definitionId,
157
+ state: 'sent',
158
+ error,
159
+ });
160
+ }
161
+ }
162
+ catch (error) {
163
+ return (0, ssi_express_support_1.sendErrorResponse)(response, 500, 'Could not get authorization request', error);
164
+ }
165
+ }));
166
+ }
167
+ //# sourceMappingURL=siop-api-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"siop-api-functions.js","sourceRoot":"","sources":["../src/siop-api-functions.ts"],"names":[],"mappings":";;;;;;;;;;;AA2CA,4EA4EC;AAED,oEAiDC;AA1KD,2DAAsG;AACtG,uEAAiG;AACjG,mDAAsD;AAKtD,MAAM,0BAA0B,GAAG,CAAC,OAAgB,EAAgC,EAAE;IACpF,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAElD,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAA;QAC1F,OAAO,OAAuC,CAAA;IAChD,CAAC;IAED,IAAI,WAAW,KAAK,mCAAmC,EAAE,CAAC;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAoC,CAAA;QAE5D,iDAAiD;QACjD,IAAI,OAAO,OAAO,CAAC,uBAAuB,KAAK,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,gIAAgI,CAAC,CAAA;YAC7I,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAA;QAC/E,CAAC;QAED,sIAAsI;QACtI,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;YAE5B,oIAAoI;YACpI,oKAAoK;YACpK,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,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from '@sphereon/ssi-sdk.presentation-exchange';
3
+ import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
4
+ import { TAgent } from '@veramo/core';
5
+ import { Express, Router } from 'express';
6
+ import { IRequiredPlugins, ISIOPv2RPRestAPIOpts } from './types';
7
+ export declare class SIOPv2RPApiServer {
8
+ private readonly _express;
9
+ private readonly _router;
10
+ private readonly _agent;
11
+ private readonly _opts?;
12
+ private readonly _basePath;
13
+ private readonly OID4VP_SWAGGER_URL;
14
+ constructor(args: {
15
+ agent: TAgent<IRequiredPlugins>;
16
+ expressSupport: ExpressSupport;
17
+ opts?: ISIOPv2RPRestAPIOpts;
18
+ });
19
+ private setupSwaggerUi;
20
+ get express(): Express;
21
+ get router(): Router;
22
+ get agent(): TAgent<IPresentationExchange & ISIOPv2RP>;
23
+ get opts(): ISIOPv2RPRestAPIOpts | undefined;
24
+ }
25
+ //# sourceMappingURL=siopv2-rp-api-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"siopv2-rp-api-server.d.ts","sourceRoot":"","sources":["../src/siopv2-rp-api-server.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAgB,EAAE,OAAO,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAA;AAErE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAShE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAElC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6D;gBACpF,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAAC,cAAc,EAAE,cAAc,CAAC;QAAC,IAAI,CAAC,EAAE,oBAAoB,CAAA;KAAE;IAmClH,OAAO,CAAC,cAAc;IA2BtB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAErD;IAED,IAAI,IAAI,IAAI,oBAAoB,GAAG,SAAS,CAE3C;CACF"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SIOPv2RPApiServer = void 0;
7
+ const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
8
+ const ssi_express_support_1 = require("@sphereon/ssi-express-support");
9
+ const express_1 = __importDefault(require("express"));
10
+ const siop_api_functions_1 = require("./siop-api-functions");
11
+ const webapp_api_functions_1 = require("./webapp-api-functions");
12
+ const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
13
+ class SIOPv2RPApiServer {
14
+ constructor(args) {
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16
+ this.OID4VP_SWAGGER_URL = 'https://api.swaggerhub.com/apis/SphereonInt/OID4VP/0.1.0';
17
+ const { agent, opts } = args;
18
+ this._agent = agent;
19
+ (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['webappCreateAuthRequest', 'webappAuthStatus', 'webappDeleteAuthRequest'] });
20
+ if ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _a === void 0 ? void 0 : _a.globalAuth) === null || _b === void 0 ? void 0 : _b.secureSiopEndpoints) {
21
+ (0, ssi_express_support_1.copyGlobalAuthToEndpoints)({ opts, keys: ['siopGetAuthRequest', 'siopVerifyAuthResponse'] });
22
+ }
23
+ this._opts = opts;
24
+ this._express = args.expressSupport.express;
25
+ this._router = express_1.default.Router();
26
+ const context = (0, ssi_sdk_core_1.agentContext)(agent);
27
+ const features = (_c = opts === null || opts === void 0 ? void 0 : opts.enableFeatures) !== null && _c !== void 0 ? _c : ['rp-status', 'siop'];
28
+ console.log(`SIOPv2 API enabled, with features: ${JSON.stringify(features)}}`);
29
+ // Webapp endpoints
30
+ if (features.includes('rp-status')) {
31
+ (0, webapp_api_functions_1.createAuthRequestWebappEndpoint)(this._router, context, (_d = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _d === void 0 ? void 0 : _d.webappCreateAuthRequest);
32
+ (0, webapp_api_functions_1.authStatusWebappEndpoint)(this._router, context, (_e = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _e === void 0 ? void 0 : _e.webappAuthStatus);
33
+ (0, webapp_api_functions_1.removeAuthRequestStateWebappEndpoint)(this._router, context, (_f = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _f === void 0 ? void 0 : _f.webappDeleteAuthRequest);
34
+ (0, webapp_api_functions_1.getDefinitionsEndpoint)(this._router, context, (_g = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _g === void 0 ? void 0 : _g.webappGetDefinitions);
35
+ }
36
+ // SIOPv2 endpoints
37
+ if (features.includes('siop')) {
38
+ (0, siop_api_functions_1.getAuthRequestSIOPv2Endpoint)(this._router, context, (_h = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _h === void 0 ? void 0 : _h.siopGetAuthRequest);
39
+ (0, siop_api_functions_1.verifyAuthResponseSIOPv2Endpoint)(this._router, context, (_j = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _j === void 0 ? void 0 : _j.siopVerifyAuthResponse);
40
+ }
41
+ this._basePath = (_l = (_k = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _k === void 0 ? void 0 : _k.basePath) !== null && _l !== void 0 ? _l : '';
42
+ this._express.use(this._basePath, this.router);
43
+ this._express.set('trust proxy', (_o = (_m = opts === null || opts === void 0 ? void 0 : opts.endpointOpts) === null || _m === void 0 ? void 0 : _m.trustProxy) !== null && _o !== void 0 ? _o : true);
44
+ this.setupSwaggerUi();
45
+ }
46
+ setupSwaggerUi() {
47
+ fetch(this.OID4VP_SWAGGER_URL)
48
+ .then((res) => res.json())
49
+ .then((swagger) => {
50
+ const apiDocs = `${this._basePath}/api-docs`;
51
+ console.log(`[OID4P] API docs available at ${apiDocs}`);
52
+ this._router.use('/api-docs', (req, res, next) => {
53
+ const regex = `${apiDocs.replace(/\//, '\/')}`.replace('/oid4vp', '').replace(/\/api-docs.*/, '');
54
+ swagger.servers = [{ url: `${req.protocol}://${req.get('host')}${regex}`, description: 'This server' }];
55
+ // @ts-ignore
56
+ req.swaggerDoc = swagger;
57
+ next();
58
+ }, swagger_ui_express_1.default.serveFiles(swagger, options), swagger_ui_express_1.default.setup());
59
+ })
60
+ .catch((err) => {
61
+ console.log(`[OID4VP] Unable to fetch swagger document: ${err}. Will not host api-docs on this instance`);
62
+ });
63
+ const options = {
64
+ // customCss: '.swagger-ui .topbar { display: none }',
65
+ };
66
+ }
67
+ get express() {
68
+ return this._express;
69
+ }
70
+ get router() {
71
+ return this._router;
72
+ }
73
+ get agent() {
74
+ return this._agent;
75
+ }
76
+ get opts() {
77
+ return this._opts;
78
+ }
79
+ }
80
+ exports.SIOPv2RPApiServer = SIOPv2RPApiServer;
81
+ //# sourceMappingURL=siopv2-rp-api-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"siopv2-rp-api-server.js","sourceRoot":"","sources":["../src/siopv2-rp-api-server.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAqD;AACrD,uEAAyF;AAIzF,s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,CAAA;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AArFD,8CAqFC"}
@@ -1,12 +1,4 @@
1
- import { PresentationDefinitionLocation } from '@sphereon/did-auth-siop';
2
- import { ISingleEndpointOpts, GenericAuthArgs, ExpressSupport } from '@sphereon/ssi-express-support';
3
- import { Router, Express } from 'express';
4
- import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
5
- import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
6
- import { IAgentContext, ICredentialVerifier, TAgent } from '@veramo/core';
7
- import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
8
-
9
- interface ComponentOptions {
1
+ export interface ComponentOptions {
10
2
  /**
11
3
  * Component options for data/ECC.
12
4
  */
@@ -63,7 +55,7 @@ interface ComponentOptions {
63
55
  protectors?: boolean;
64
56
  };
65
57
  }
66
- interface QRCodeOpts {
58
+ export interface QRCodeOpts {
67
59
  /**
68
60
  * Size of the QR code in pixel.
69
61
  *
@@ -143,7 +135,7 @@ interface QRCodeOpts {
143
135
  /**
144
136
  * Background image to be used in the QR code.
145
137
  *
146
- * Accepts a `data:` string in web browsers or a Buffer in Node.
138
+ * Accepts a `data:` string in web browsers or a Buffer in Node.js.
147
139
  *
148
140
  * @defaultValue undefined
149
141
  */
@@ -173,7 +165,7 @@ interface QRCodeOpts {
173
165
  /**
174
166
  * Logo image to be displayed at the center of the QR code.
175
167
  *
176
- * Accepts a `data:` string in web browsers or a Buffer in Node.
168
+ * Accepts a `data:` string in web browsers or a Buffer in Node.js.
177
169
  *
178
170
  * When set to `undefined` or `null`, the logo is disabled.
179
171
  *
@@ -209,61 +201,4 @@ interface QRCodeOpts {
209
201
  */
210
202
  dotScale?: number;
211
203
  }
212
-
213
- type SiopFeatures = 'rp-status' | 'siop';
214
- interface ISIOPv2RPRestAPIOpts {
215
- enableFeatures?: SiopFeatures[];
216
- endpointOpts?: {
217
- basePath?: string;
218
- trustProxy?: boolean | Array<string>;
219
- globalAuth?: GenericAuthArgs & {
220
- secureSiopEndpoints?: boolean;
221
- };
222
- webappCreateAuthRequest?: ICreateAuthRequestWebappEndpointOpts;
223
- webappDeleteAuthRequest?: ISingleEndpointOpts;
224
- webappGetDefinitions?: ISingleEndpointOpts;
225
- webappAuthStatus?: ISingleEndpointOpts;
226
- siopVerifyAuthResponse?: ISingleEndpointOpts;
227
- siopGetAuthRequest?: ISingleEndpointOpts;
228
- };
229
- }
230
- interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
231
- siopBaseURI?: string;
232
- qrCodeOpts?: QRCodeOpts;
233
- webappAuthStatusPath?: string;
234
- webappBaseURI?: string;
235
- responseRedirectURI?: string;
236
- }
237
- type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
238
- type IRequiredContext = IAgentContext<IRequiredPlugins>;
239
-
240
- declare function verifyAuthResponseSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts & {
241
- presentationDefinitionLocation?: PresentationDefinitionLocation;
242
- }): void;
243
- declare function getAuthRequestSIOPv2Endpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
244
-
245
- declare function createAuthRequestWebappEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
246
- declare function authStatusWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
247
- declare function removeAuthRequestStateWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
248
- declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
249
-
250
- declare class SIOPv2RPApiServer {
251
- private readonly _express;
252
- private readonly _router;
253
- private readonly _agent;
254
- private readonly _opts?;
255
- private readonly _basePath;
256
- private readonly OID4VP_SWAGGER_URL;
257
- constructor(args: {
258
- agent: TAgent<IRequiredPlugins>;
259
- expressSupport: ExpressSupport;
260
- opts?: ISIOPv2RPRestAPIOpts;
261
- });
262
- private setupSwaggerUi;
263
- get express(): Express;
264
- get router(): Router;
265
- get agent(): TAgent<IPresentationExchange & ISIOPv2RP>;
266
- get opts(): ISIOPv2RPRestAPIOpts | undefined;
267
- }
268
-
269
- export { type ComponentOptions, type ICreateAuthRequestWebappEndpointOpts, type IRequiredContext, type IRequiredPlugins, type ISIOPv2RPRestAPIOpts, type QRCodeOpts, SIOPv2RPApiServer, type SiopFeatures, authStatusWebappEndpoint, createAuthRequestWebappEndpoint, getAuthRequestSIOPv2Endpoint, getDefinitionsEndpoint, removeAuthRequestStateWebappEndpoint, verifyAuthResponseSIOPv2Endpoint };
204
+ //# sourceMappingURL=QRCode.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QRCode.types.d.ts","sourceRoot":"","sources":["../../src/types/QRCode.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IAED;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,eAAe,CAAC,EAAE;QAChB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QAEd;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;CACF;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAE7B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEjC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,WAAW,CAAA;IAE3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAE3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=QRCode.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QRCode.types.js","sourceRoot":"","sources":["../../src/types/QRCode.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './QRCode.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./QRCode.types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,iDAA8B"}
@@ -0,0 +1,33 @@
1
+ import { GenericAuthArgs, ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
+ import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
3
+ import { ISIOPv2RP } from '@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth';
4
+ import { IAgentContext, ICredentialVerifier } from '@veramo/core';
5
+ import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
6
+ import { QRCodeOpts } from './QRCode.types';
7
+ export type SiopFeatures = 'rp-status' | 'siop';
8
+ export interface ISIOPv2RPRestAPIOpts {
9
+ enableFeatures?: SiopFeatures[];
10
+ endpointOpts?: {
11
+ basePath?: string;
12
+ trustProxy?: boolean | Array<string>;
13
+ globalAuth?: GenericAuthArgs & {
14
+ secureSiopEndpoints?: boolean;
15
+ };
16
+ webappCreateAuthRequest?: ICreateAuthRequestWebappEndpointOpts;
17
+ webappDeleteAuthRequest?: ISingleEndpointOpts;
18
+ webappGetDefinitions?: ISingleEndpointOpts;
19
+ webappAuthStatus?: ISingleEndpointOpts;
20
+ siopVerifyAuthResponse?: ISingleEndpointOpts;
21
+ siopGetAuthRequest?: ISingleEndpointOpts;
22
+ };
23
+ }
24
+ export interface ICreateAuthRequestWebappEndpointOpts extends ISingleEndpointOpts {
25
+ siopBaseURI?: string;
26
+ qrCodeOpts?: QRCodeOpts;
27
+ webappAuthStatusPath?: string;
28
+ webappBaseURI?: string;
29
+ responseRedirectURI?: string;
30
+ }
31
+ export type IRequiredPlugins = ICredentialVerifier & ISIOPv2RP & IPresentationExchange & IPDManager;
32
+ export type IRequiredContext = IAgentContext<IRequiredPlugins>;
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAA;AAC/C,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,YAAY,EAAE,CAAA;IAC/B,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;QACpC,UAAU,CAAC,EAAE,eAAe,GAAG;YAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;QAChE,uBAAuB,CAAC,EAAE,oCAAoC,CAAA;QAC9D,uBAAuB,CAAC,EAAE,mBAAmB,CAAA;QAC7C,oBAAoB,CAAC,EAAE,mBAAmB,CAAA;QAC1C,gBAAgB,CAAC,EAAE,mBAAmB,CAAA;QACtC,sBAAsB,CAAC,EAAE,mBAAmB,CAAA;QAC5C,kBAAkB,CAAC,EAAE,mBAAmB,CAAA;KACzC,CAAA;CACF;AACD,MAAM,WAAW,oCAAqC,SAAQ,mBAAmB;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,GAAG,qBAAqB,GAAG,UAAU,CAAA;AACnG,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { ISingleEndpointOpts } from '@sphereon/ssi-express-support';
2
+ import { Router } from 'express';
3
+ import { ICreateAuthRequestWebappEndpointOpts, IRequiredContext } from './types';
4
+ export declare function createAuthRequestWebappEndpoint(router: Router, context: IRequiredContext, opts?: ICreateAuthRequestWebappEndpointOpts): void;
5
+ export declare function authStatusWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
6
+ export declare function removeAuthRequestStateWebappEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
7
+ export declare function getDefinitionsEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
8
+ //# sourceMappingURL=webapp-api-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webapp-api-functions.d.ts","sourceRoot":"","sources":["../src/webapp-api-functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,mBAAmB,EAAqB,MAAM,+BAA+B,CAAA;AAGjG,OAAO,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EAAE,oCAAoC,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAGhF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,oCAAoC,QAyDrI;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QA2E7G;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QAoBzH;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,mBAAmB,QAe3G"}