@verana-labs/vs-agent-plugin-openid4vc 1.11.0

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.
Files changed (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +193 -0
  3. package/build/config.d.ts +5 -0
  4. package/build/config.js +279 -0
  5. package/build/config.js.map +1 -0
  6. package/build/index.d.ts +12 -0
  7. package/build/index.js +28 -0
  8. package/build/index.js.map +1 -0
  9. package/build/nestjs/IssuerController.d.ts +8 -0
  10. package/build/nestjs/IssuerController.js +66 -0
  11. package/build/nestjs/IssuerController.js.map +1 -0
  12. package/build/nestjs/OpenId4VcPlugin.d.ts +3 -0
  13. package/build/nestjs/OpenId4VcPlugin.js +61 -0
  14. package/build/nestjs/OpenId4VcPlugin.js.map +1 -0
  15. package/build/nestjs/VerifierController.d.ts +8 -0
  16. package/build/nestjs/VerifierController.js +66 -0
  17. package/build/nestjs/VerifierController.js.map +1 -0
  18. package/build/nestjs/dto.d.ts +7 -0
  19. package/build/nestjs/dto.js +34 -0
  20. package/build/nestjs/dto.js.map +1 -0
  21. package/build/sdk/setupOpenId4Vc.d.ts +18 -0
  22. package/build/sdk/setupOpenId4Vc.js +111 -0
  23. package/build/sdk/setupOpenId4Vc.js.map +1 -0
  24. package/build/services/CertificateService.d.ts +22 -0
  25. package/build/services/CertificateService.js +249 -0
  26. package/build/services/CertificateService.js.map +1 -0
  27. package/build/services/IssuerService.d.ts +47 -0
  28. package/build/services/IssuerService.js +185 -0
  29. package/build/services/IssuerService.js.map +1 -0
  30. package/build/services/VerifierService.d.ts +57 -0
  31. package/build/services/VerifierService.js +289 -0
  32. package/build/services/VerifierService.js.map +1 -0
  33. package/build/trust/CertificateTrust.d.ts +7 -0
  34. package/build/trust/CertificateTrust.js +29 -0
  35. package/build/trust/CertificateTrust.js.map +1 -0
  36. package/build/trust/TrustClient.d.ts +12 -0
  37. package/build/trust/TrustClient.js +120 -0
  38. package/build/trust/TrustClient.js.map +1 -0
  39. package/build/trust/keyBinding.d.ts +14 -0
  40. package/build/trust/keyBinding.js +171 -0
  41. package/build/trust/keyBinding.js.map +1 -0
  42. package/build/trust/types.d.ts +28 -0
  43. package/build/trust/types.js +3 -0
  44. package/build/trust/types.js.map +1 -0
  45. package/build/trust/verdict.d.ts +2 -0
  46. package/build/trust/verdict.js +13 -0
  47. package/build/trust/verdict.js.map +1 -0
  48. package/build/types.d.ts +55 -0
  49. package/build/types.js +3 -0
  50. package/build/types.js.map +1 -0
  51. package/package.json +47 -0
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateOpenId4VcOptions = validateOpenId4VcOptions;
4
+ exports.findCredentialConfiguration = findCredentialConfiguration;
5
+ exports.findVerifierPolicy = findVerifierPolicy;
6
+ exports.parseOfferClaims = parseOfferClaims;
7
+ const core_1 = require("@credo-ts/core");
8
+ const CertificateService_1 = require("./services/CertificateService");
9
+ const CertificateTrust_1 = require("./trust/CertificateTrust");
10
+ const keyBinding_1 = require("./trust/keyBinding");
11
+ const MAX_TTL_SECONDS = 31536000;
12
+ const MIN_TTL_SECONDS = 60;
13
+ const RESERVED_CREDENTIAL_CLAIMS = new Set(['vct', 'iat', 'exp', 'iss', 'cnf']);
14
+ function validateOpenId4VcOptions(options) {
15
+ assertHttpsUrl(options.publicApiBaseUrl, 'publicApiBaseUrl');
16
+ if (!options.issuer && !options.verifier) {
17
+ throw new Error('OpenID4VC plugin requires an issuer or verifier capability');
18
+ }
19
+ if (options.issuer) {
20
+ assertNonEmptyString(options.issuer.id, 'issuer.id');
21
+ assertNonEmptyString(options.issuer.displayName, 'issuer.displayName');
22
+ assertSigningOptions(options.issuer.signing, 'issuer.signing');
23
+ if (options.issuer.requireWalletAttestation &&
24
+ !hasNonEmptyString(options.issuer.walletAttestationCertificates)) {
25
+ throw new Error('issuer.walletAttestationCertificates is required when wallet attestation is enabled');
26
+ }
27
+ }
28
+ if (options.verifier) {
29
+ assertNonEmptyString(options.verifier.id, 'verifier.id');
30
+ assertNonEmptyString(options.verifier.displayName, 'verifier.displayName');
31
+ assertSigningOptions(options.verifier.signing, 'verifier.signing');
32
+ assertTrustOptions(options.trust, true);
33
+ }
34
+ else if (options.trust) {
35
+ assertTrustOptions(options.trust, false);
36
+ }
37
+ assertCredentialConfigurations(options.credentialConfigurations);
38
+ assertVerifierPolicies(options.verifierPolicies, options.credentialConfigurations);
39
+ }
40
+ function findCredentialConfiguration(options, id) {
41
+ return options.credentialConfigurations.find(configuration => configuration.id === id);
42
+ }
43
+ function findVerifierPolicy(options, id) {
44
+ return options.verifierPolicies.find(policy => policy.id === id);
45
+ }
46
+ function parseOfferClaims(configuration, input) {
47
+ if (!isRecord(input)) {
48
+ throw new Error('claims must be an object');
49
+ }
50
+ for (const name of Object.keys(input)) {
51
+ if (!configuration.claims.includes(name)) {
52
+ throw new Error(`unknown claim '${name}'`);
53
+ }
54
+ }
55
+ const claims = {};
56
+ for (const name of configuration.claims) {
57
+ const value = input[name];
58
+ if (isEmptyClaim(value)) {
59
+ throw new Error(`claim '${name}' must be non-empty`);
60
+ }
61
+ claims[name] = value;
62
+ }
63
+ return claims;
64
+ }
65
+ function assertCredentialConfigurations(configurations) {
66
+ if (!Array.isArray(configurations)) {
67
+ throw new Error('credentialConfigurations must be an array');
68
+ }
69
+ assertUniqueNonEmptyIds(configurations, 'credential configuration');
70
+ for (const configuration of configurations) {
71
+ const prefix = `credential configuration '${configuration.id}'`;
72
+ if (configuration.format !== 'dc+sd-jwt') {
73
+ throw new Error(`${prefix}: format must be 'dc+sd-jwt'`);
74
+ }
75
+ assertHttpUrl(configuration.vct, `${prefix}.vct`);
76
+ assertHttpUrl(configuration.vtjscId, `${prefix}.vtjscId`);
77
+ assertNonEmptyString(configuration.name, `${prefix}.name`);
78
+ assertNonEmptyUniqueStrings(configuration.claims, `${prefix}.claims`);
79
+ const reservedClaim = configuration.claims.find(claim => RESERVED_CREDENTIAL_CLAIMS.has(claim));
80
+ if (reservedClaim) {
81
+ throw new Error(`${prefix}.claims contains reserved claim '${reservedClaim}'`);
82
+ }
83
+ assertSubset(configuration.disclosureFrame, configuration.claims, `${prefix}.disclosureFrame`);
84
+ if (!Number.isInteger(configuration.ttlSeconds) ||
85
+ configuration.ttlSeconds < MIN_TTL_SECONDS ||
86
+ configuration.ttlSeconds > MAX_TTL_SECONDS) {
87
+ throw new Error(`${prefix}.ttlSeconds must be an integer between ${MIN_TTL_SECONDS} and ${MAX_TTL_SECONDS}`);
88
+ }
89
+ }
90
+ }
91
+ function assertVerifierPolicies(policies, configurations) {
92
+ if (!Array.isArray(policies)) {
93
+ throw new Error('verifierPolicies must be an array');
94
+ }
95
+ assertUniqueNonEmptyIds(policies, 'verifier policy');
96
+ for (const policy of policies) {
97
+ const configuration = configurations.find(item => item.id === policy.credentialConfigurationId);
98
+ if (!configuration) {
99
+ throw new Error(`verifier policy '${policy.id}': unknown credentialConfigurationId '${policy.credentialConfigurationId}'`);
100
+ }
101
+ assertSubset(policy.requestedClaims, configuration.claims, `verifier policy '${policy.id}'.requestedClaims`);
102
+ }
103
+ }
104
+ function assertTrustOptions(trust, requiresAnchor) {
105
+ if (!trust) {
106
+ if (requiresAnchor)
107
+ throw new Error('verifier requires trust configuration');
108
+ return;
109
+ }
110
+ assertHttpsUrl(trust.resolverUrl, 'trust.resolverUrl');
111
+ if (!Number.isInteger(trust.timeoutMs) ||
112
+ trust.timeoutMs <= 0 ||
113
+ trust.timeoutMs > keyBinding_1.MAX_DID_RESOLUTION_TIMEOUT_MS) {
114
+ throw new Error(`trust.timeoutMs must be a positive integer no greater than ${keyBinding_1.MAX_DID_RESOLUTION_TIMEOUT_MS}`);
115
+ }
116
+ assertNonEmptyUniqueStrings(trust.allowedDidWebHosts, 'trust.allowedDidWebHosts');
117
+ trust.allowedDidWebHosts.forEach((host, index) => assertDidWebHost(host, `trust.allowedDidWebHosts[${index}]`));
118
+ assertStringArray(trust.credentialIssuerCertificates, 'trust.credentialIssuerCertificates');
119
+ assertCredentialIssuerTrustAnchors(trust.credentialIssuerCertificates);
120
+ if (trust.developmentCertificateFingerprints) {
121
+ assertStringArray(trust.developmentCertificateFingerprints, 'trust.developmentCertificateFingerprints');
122
+ if (new Set(trust.developmentCertificateFingerprints).size !==
123
+ trust.developmentCertificateFingerprints.length) {
124
+ throw new Error('trust.developmentCertificateFingerprints must not contain duplicates');
125
+ }
126
+ if (trust.developmentCertificateFingerprints.some(fingerprint => !/^SHA256:[0-9a-f]{64}$/.test(fingerprint))) {
127
+ throw new Error('trust.developmentCertificateFingerprints must use SHA256 followed by 64 lowercase hexadecimal characters');
128
+ }
129
+ }
130
+ if (requiresAnchor &&
131
+ !hasNonEmptyString(trust.credentialIssuerCertificates) &&
132
+ !hasNonEmptyString(trust.developmentCertificateFingerprints)) {
133
+ throw new Error('verifier trust requires credentialIssuerCertificates or developmentCertificateFingerprints');
134
+ }
135
+ }
136
+ function assertSigningOptions(signing, field) {
137
+ const rawSigning = signing;
138
+ const hasConfigured = rawSigning.configured !== undefined;
139
+ const hasDevelopment = rawSigning.development !== undefined;
140
+ if (hasConfigured === hasDevelopment) {
141
+ throw new Error(`${field} must configure exactly one signing mode`);
142
+ }
143
+ if (hasConfigured) {
144
+ const configured = rawSigning.configured;
145
+ assertNonEmptyStringArray(configured.certificateChain, `${field}.configured.certificateChain`);
146
+ if (!configured.privateJwk || typeof configured.privateJwk !== 'object') {
147
+ throw new Error(`${field}.configured.privateJwk is required`);
148
+ }
149
+ return;
150
+ }
151
+ const development = rawSigning.development;
152
+ if (development.enabled !== true) {
153
+ throw new Error(`${field}.development.enabled must be true`);
154
+ }
155
+ assertNonEmptyString(development.commonName, `${field}.development.commonName`);
156
+ }
157
+ function assertHttpsUrl(value, field) {
158
+ const url = parseUrl(value, field);
159
+ if (process.env.NODE_ENV !== 'test' && url.protocol !== 'https:') {
160
+ throw new Error(`${field} must use HTTPS outside test mode`);
161
+ }
162
+ if (process.env.NODE_ENV === 'test' && url.protocol !== 'https:' && url.protocol !== 'http:') {
163
+ throw new Error(`${field} must use HTTP(S)`);
164
+ }
165
+ }
166
+ function assertHttpUrl(value, field) {
167
+ const url = parseUrl(value, field);
168
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') {
169
+ throw new Error(`${field} must use HTTP(S)`);
170
+ }
171
+ }
172
+ function parseUrl(value, field) {
173
+ let url;
174
+ try {
175
+ url = new URL(value);
176
+ }
177
+ catch (_a) {
178
+ throw new Error(`${field} must be a valid URL`);
179
+ }
180
+ if (url.username || url.password) {
181
+ throw new Error(`${field} must not include credentials`);
182
+ }
183
+ return url;
184
+ }
185
+ function assertCredentialIssuerTrustAnchors(encodedCertificates) {
186
+ const fingerprints = new Set();
187
+ encodedCertificates.forEach((encodedCertificate, index) => {
188
+ var _a;
189
+ let certificate;
190
+ try {
191
+ certificate = core_1.X509Certificate.fromEncodedCertificate(encodedCertificate);
192
+ }
193
+ catch (_b) {
194
+ throw new Error(`trust.credentialIssuerCertificates[${index}] must be a valid X.509 certificate`);
195
+ }
196
+ (0, CertificateService_1.assertCertificateChainUsable)([certificate]);
197
+ if (!certificate.isCertificateAuthority || !((_a = certificate.keyUsage) === null || _a === void 0 ? void 0 : _a.includes(core_1.X509KeyUsage.KeyCertSign))) {
198
+ throw new Error(`trust.credentialIssuerCertificates[${index}] must be a CA trust anchor with keyCertSign usage`);
199
+ }
200
+ if (certificate.subject !== certificate.issuer) {
201
+ throw new Error(`trust.credentialIssuerCertificates[${index}] must be a self-issued root trust anchor`);
202
+ }
203
+ const fingerprint = (0, CertificateTrust_1.certificateFingerprint)(certificate);
204
+ if (fingerprints.has(fingerprint)) {
205
+ throw new Error('trust.credentialIssuerCertificates contains a duplicate credential issuer certificate');
206
+ }
207
+ fingerprints.add(fingerprint);
208
+ });
209
+ }
210
+ function assertDidWebHost(value, field) {
211
+ try {
212
+ const url = new URL(`https://${value}`);
213
+ if (url.username ||
214
+ url.password ||
215
+ !url.hostname ||
216
+ url.pathname !== '/' ||
217
+ url.search ||
218
+ url.hash ||
219
+ url.host.toLowerCase() !== value) {
220
+ throw new Error();
221
+ }
222
+ }
223
+ catch (_a) {
224
+ throw new Error(`${field} must be an exact lowercase host with an optional port`);
225
+ }
226
+ }
227
+ function assertUniqueNonEmptyIds(items, label) {
228
+ const ids = new Set();
229
+ for (const item of items) {
230
+ assertNonEmptyString(item.id, `${label} ID`);
231
+ if (ids.has(item.id)) {
232
+ throw new Error(`duplicate ${label} ID '${item.id}'`);
233
+ }
234
+ ids.add(item.id);
235
+ }
236
+ }
237
+ function assertNonEmptyUniqueStrings(values, field) {
238
+ assertNonEmptyStringArray(values, field);
239
+ if (new Set(values).size !== values.length) {
240
+ throw new Error(`${field} must not contain duplicates`);
241
+ }
242
+ }
243
+ function assertNonEmptyStringArray(value, field) {
244
+ assertStringArray(value, field);
245
+ if (value.length === 0) {
246
+ throw new Error(`${field} must contain non-empty strings`);
247
+ }
248
+ }
249
+ function assertStringArray(value, field) {
250
+ if (!Array.isArray(value) || value.some(item => typeof item !== 'string' || !item.trim())) {
251
+ throw new Error(`${field} must contain non-empty strings`);
252
+ }
253
+ }
254
+ function assertSubset(values, allowedValues, field) {
255
+ if (!Array.isArray(values) || values.some(value => !allowedValues.includes(value))) {
256
+ throw new Error(`${field} must be a subset of configured claims`);
257
+ }
258
+ }
259
+ function assertNonEmptyString(value, field) {
260
+ if (typeof value !== 'string' || !value.trim()) {
261
+ throw new Error(`${field} must be a non-empty string`);
262
+ }
263
+ }
264
+ function hasNonEmptyString(value) {
265
+ return Array.isArray(value) && value.some(item => typeof item === 'string' && item.trim());
266
+ }
267
+ function isRecord(value) {
268
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
269
+ }
270
+ function isEmptyClaim(value) {
271
+ if (value === null || value === undefined)
272
+ return true;
273
+ if (typeof value === 'string')
274
+ return !value.trim();
275
+ if (Array.isArray(value))
276
+ return value.length === 0;
277
+ return typeof value === 'object' && Object.keys(value).length === 0;
278
+ }
279
+ //#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,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACnD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAA;IACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAA;AACrE,CAAC"}
@@ -0,0 +1,12 @@
1
+ export { findCredentialConfiguration, findVerifierPolicy, parseOfferClaims, validateOpenId4VcOptions, } from './config';
2
+ export { OpenId4VcPlugin } from './nestjs/OpenId4VcPlugin';
3
+ export { IssuerController } from './nestjs/IssuerController';
4
+ export { VerifierController } from './nestjs/VerifierController';
5
+ export { CreateOpenId4VcOfferDto, CreateOpenId4VcVerificationRequestDto } from './nestjs/dto';
6
+ export { setupOpenId4Vc } from './sdk/setupOpenId4Vc';
7
+ export { IssuerService, OpenId4VcIssuerRequestError, OpenId4VcOfferNotFoundError, } from './services/IssuerService';
8
+ export type { OpenId4VcIssuerAgent, OpenId4VcOfferResult, OpenId4VcOfferState, } from './services/IssuerService';
9
+ export { OpenId4VcVerifierRequestError, UnknownVerificationSessionError, VerifierService, } from './services/VerifierService';
10
+ export type { OpenId4VcVerificationRequest, OpenId4VcVerificationResult, OpenId4VcVerifiedCredentialResult, OpenId4VcVerifierAgent, } from './services/VerifierService';
11
+ export type { OpenId4VcAgentModules, OpenId4VcIssuerRequestMapper, OpenId4VcSdkPlugin, } from './sdk/setupOpenId4Vc';
12
+ export type { OpenId4VcConfiguredSigningMaterial, OpenId4VcCredentialConfiguration, OpenId4VcPluginOptions, OpenId4VcSigningOptions, OpenId4VcVerifierPolicy, } from './types';
package/build/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerifierService = exports.UnknownVerificationSessionError = exports.OpenId4VcVerifierRequestError = exports.OpenId4VcOfferNotFoundError = exports.OpenId4VcIssuerRequestError = exports.IssuerService = exports.setupOpenId4Vc = exports.CreateOpenId4VcVerificationRequestDto = exports.CreateOpenId4VcOfferDto = exports.VerifierController = exports.IssuerController = exports.OpenId4VcPlugin = exports.validateOpenId4VcOptions = exports.parseOfferClaims = exports.findVerifierPolicy = exports.findCredentialConfiguration = void 0;
4
+ var config_1 = require("./config");
5
+ Object.defineProperty(exports, "findCredentialConfiguration", { enumerable: true, get: function () { return config_1.findCredentialConfiguration; } });
6
+ Object.defineProperty(exports, "findVerifierPolicy", { enumerable: true, get: function () { return config_1.findVerifierPolicy; } });
7
+ Object.defineProperty(exports, "parseOfferClaims", { enumerable: true, get: function () { return config_1.parseOfferClaims; } });
8
+ Object.defineProperty(exports, "validateOpenId4VcOptions", { enumerable: true, get: function () { return config_1.validateOpenId4VcOptions; } });
9
+ var OpenId4VcPlugin_1 = require("./nestjs/OpenId4VcPlugin");
10
+ Object.defineProperty(exports, "OpenId4VcPlugin", { enumerable: true, get: function () { return OpenId4VcPlugin_1.OpenId4VcPlugin; } });
11
+ var IssuerController_1 = require("./nestjs/IssuerController");
12
+ Object.defineProperty(exports, "IssuerController", { enumerable: true, get: function () { return IssuerController_1.IssuerController; } });
13
+ var VerifierController_1 = require("./nestjs/VerifierController");
14
+ Object.defineProperty(exports, "VerifierController", { enumerable: true, get: function () { return VerifierController_1.VerifierController; } });
15
+ var dto_1 = require("./nestjs/dto");
16
+ Object.defineProperty(exports, "CreateOpenId4VcOfferDto", { enumerable: true, get: function () { return dto_1.CreateOpenId4VcOfferDto; } });
17
+ Object.defineProperty(exports, "CreateOpenId4VcVerificationRequestDto", { enumerable: true, get: function () { return dto_1.CreateOpenId4VcVerificationRequestDto; } });
18
+ var setupOpenId4Vc_1 = require("./sdk/setupOpenId4Vc");
19
+ Object.defineProperty(exports, "setupOpenId4Vc", { enumerable: true, get: function () { return setupOpenId4Vc_1.setupOpenId4Vc; } });
20
+ var IssuerService_1 = require("./services/IssuerService");
21
+ Object.defineProperty(exports, "IssuerService", { enumerable: true, get: function () { return IssuerService_1.IssuerService; } });
22
+ Object.defineProperty(exports, "OpenId4VcIssuerRequestError", { enumerable: true, get: function () { return IssuerService_1.OpenId4VcIssuerRequestError; } });
23
+ Object.defineProperty(exports, "OpenId4VcOfferNotFoundError", { enumerable: true, get: function () { return IssuerService_1.OpenId4VcOfferNotFoundError; } });
24
+ var VerifierService_1 = require("./services/VerifierService");
25
+ Object.defineProperty(exports, "OpenId4VcVerifierRequestError", { enumerable: true, get: function () { return VerifierService_1.OpenId4VcVerifierRequestError; } });
26
+ Object.defineProperty(exports, "UnknownVerificationSessionError", { enumerable: true, get: function () { return VerifierService_1.UnknownVerificationSessionError; } });
27
+ Object.defineProperty(exports, "VerifierService", { enumerable: true, get: function () { return VerifierService_1.VerifierService; } });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAKiB;AAJf,qHAAA,2BAA2B,OAAA;AAC3B,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,kHAAA,wBAAwB,OAAA;AAE1B,4DAA0D;AAAjD,kHAAA,eAAe,OAAA;AACxB,8DAA4D;AAAnD,oHAAA,gBAAgB,OAAA;AACzB,kEAAgE;AAAvD,wHAAA,kBAAkB,OAAA;AAC3B,oCAA6F;AAApF,8GAAA,uBAAuB,OAAA;AAAE,4HAAA,qCAAqC,OAAA;AACvE,uDAAqD;AAA5C,gHAAA,cAAc,OAAA;AACvB,0DAIiC;AAH/B,8GAAA,aAAa,OAAA;AACb,4HAAA,2BAA2B,OAAA;AAC3B,4HAAA,2BAA2B,OAAA;AAO7B,8DAImC;AAHjC,gIAAA,6BAA6B,OAAA;AAC7B,kIAAA,+BAA+B,OAAA;AAC/B,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,8 @@
1
+ import { IssuerService } from '../services/IssuerService';
2
+ import { CreateOpenId4VcOfferDto } from './dto';
3
+ export declare class IssuerController {
4
+ private readonly issuerService;
5
+ constructor(issuerService: IssuerService);
6
+ createOffer(dto: CreateOpenId4VcOfferDto): Promise<import("../services/IssuerService").OpenId4VcOfferResult>;
7
+ getOfferState(id: string): Promise<import("../services/IssuerService").OpenId4VcOfferState>;
8
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.IssuerController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const IssuerService_1 = require("../services/IssuerService");
18
+ const dto_1 = require("./dto");
19
+ let IssuerController = class IssuerController {
20
+ constructor(issuerService) {
21
+ this.issuerService = issuerService;
22
+ }
23
+ async createOffer(dto) {
24
+ try {
25
+ return await this.issuerService.createOffer(dto.credentialConfigurationId, dto.claims);
26
+ }
27
+ catch (error) {
28
+ if (error instanceof IssuerService_1.OpenId4VcIssuerRequestError) {
29
+ throw new common_1.BadRequestException(error.message);
30
+ }
31
+ throw error;
32
+ }
33
+ }
34
+ async getOfferState(id) {
35
+ try {
36
+ return await this.issuerService.getOfferState(id);
37
+ }
38
+ catch (error) {
39
+ if (error instanceof IssuerService_1.OpenId4VcOfferNotFoundError) {
40
+ throw new common_1.NotFoundException(error.message);
41
+ }
42
+ throw error;
43
+ }
44
+ }
45
+ };
46
+ exports.IssuerController = IssuerController;
47
+ __decorate([
48
+ (0, common_1.Post)(),
49
+ __param(0, (0, common_1.Body)()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [dto_1.CreateOpenId4VcOfferDto]),
52
+ __metadata("design:returntype", Promise)
53
+ ], IssuerController.prototype, "createOffer", null);
54
+ __decorate([
55
+ (0, common_1.Get)(':id'),
56
+ __param(0, (0, common_1.Param)('id')),
57
+ __metadata("design:type", Function),
58
+ __metadata("design:paramtypes", [String]),
59
+ __metadata("design:returntype", Promise)
60
+ ], IssuerController.prototype, "getOfferState", null);
61
+ exports.IssuerController = IssuerController = __decorate([
62
+ (0, common_1.Controller)({ path: 'oid4vc/offers', version: '1' }),
63
+ __param(0, (0, common_1.Inject)(IssuerService_1.IssuerService)),
64
+ __metadata("design:paramtypes", [IssuerService_1.IssuerService])
65
+ ], IssuerController);
66
+ //# sourceMappingURL=IssuerController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IssuerController.js","sourceRoot":"","sources":["../../src/nestjs/IssuerController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASuB;AAEvB,6DAIkC;AAElC,+BAA+C;AAGxC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAA2D,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAG9E,AAAN,KAAK,CAAC,WAAW,CAAS,GAA4B;QAC3D,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QACxF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,2CAA2B,EAAE,CAAC;gBACjD,MAAM,IAAI,4BAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC9C,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAGY,AAAN,KAAK,CAAC,aAAa,CAAc,EAAU;QAChD,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,2CAA2B,EAAE,CAAC;gBACjD,MAAM,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC5C,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,4CAAgB;AAId;IADZ,IAAA,aAAI,GAAE;IACmB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,6BAAuB;;mDAS5D;AAGY;IADZ,IAAA,YAAG,EAAC,KAAK,CAAC;IACiB,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;qDAStC;2BAzBU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAE9B,WAAA,IAAA,eAAM,EAAC,6BAAa,CAAC,CAAA;qCAAiC,6BAAa;GAD5E,gBAAgB,CA0B5B"}
@@ -0,0 +1,3 @@
1
+ import type { OpenId4VcPluginOptions } from '../types';
2
+ import type { VsAgentNestPlugin } from '@verana-labs/vs-agent-sdk';
3
+ export declare function OpenId4VcPlugin(options: OpenId4VcPluginOptions): VsAgentNestPlugin;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenId4VcPlugin = OpenId4VcPlugin;
4
+ const config_1 = require("../config");
5
+ const setupOpenId4Vc_1 = require("../sdk/setupOpenId4Vc");
6
+ const IssuerService_1 = require("../services/IssuerService");
7
+ const VerifierService_1 = require("../services/VerifierService");
8
+ const IssuerController_1 = require("./IssuerController");
9
+ const VerifierController_1 = require("./VerifierController");
10
+ function OpenId4VcPlugin(options) {
11
+ (0, config_1.validateOpenId4VcOptions)(options);
12
+ let issuerService;
13
+ let verifierService;
14
+ const getIssuerService = (agent) => {
15
+ if (!issuerService) {
16
+ if (!agent)
17
+ throw new Error('OpenID4VC issuer service is not initialized');
18
+ issuerService = new IssuerService_1.IssuerService(agent, options);
19
+ }
20
+ return issuerService;
21
+ };
22
+ const getVerifierService = (agent) => (verifierService !== null && verifierService !== void 0 ? verifierService : (verifierService = new VerifierService_1.VerifierService(agent, options)));
23
+ const sdkPlugin = (0, setupOpenId4Vc_1.setupOpenId4Vc)(options, () => getIssuerService());
24
+ return {
25
+ name: 'openid4vc',
26
+ credoPlugin: sdkPlugin,
27
+ publicMiddleware: sdkPlugin.publicMiddleware,
28
+ controllers: [
29
+ ...(options.issuer ? [IssuerController_1.IssuerController] : []),
30
+ ...(options.verifier ? [VerifierController_1.VerifierController] : []),
31
+ ],
32
+ providers: [
33
+ ...(options.issuer
34
+ ? [
35
+ {
36
+ provide: IssuerService_1.IssuerService,
37
+ useFactory: (agent) => getIssuerService(agent),
38
+ inject: ['VSAGENT'],
39
+ },
40
+ ]
41
+ : []),
42
+ ...(options.verifier
43
+ ? [
44
+ {
45
+ provide: VerifierService_1.VerifierService,
46
+ useFactory: (agent) => getVerifierService(agent),
47
+ inject: ['VSAGENT'],
48
+ },
49
+ ]
50
+ : []),
51
+ ],
52
+ initialize: async (agent) => {
53
+ const lifecycleAgent = agent;
54
+ if (options.issuer)
55
+ await getIssuerService(lifecycleAgent).ensureInitialized();
56
+ if (options.verifier)
57
+ await getVerifierService(lifecycleAgent).ensureInitialized();
58
+ },
59
+ };
60
+ }
61
+ //# sourceMappingURL=OpenId4VcPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcPlugin.js","sourceRoot":"","sources":["../../src/nestjs/OpenId4VcPlugin.ts"],"names":[],"mappings":";;AAkBA,0CAoDC;AAlED,sCAAoD;AACpD,0DAAsD;AACtD,6DAAoF;AACpF,iEAA0F;AAE1F,yDAAqD;AACrD,6DAAyD;AAQzD,SAAgB,eAAe,CAAC,OAA+B;IAC7D,IAAA,iCAAwB,EAAC,OAAO,CAAC,CAAA;IAEjC,IAAI,aAAwC,CAAA;IAC5C,IAAI,eAA4C,CAAA;IAEhD,MAAM,gBAAgB,GAAG,CAAC,KAA+B,EAAiB,EAAE;QAC1E,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;YAC1E,aAAa,GAAG,IAAI,6BAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACnD,CAAC;QACD,OAAO,aAAa,CAAA;IACtB,CAAC,CAAA;IACD,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAmB,EAAE,CAC7E,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,IAAf,eAAe,GAAK,IAAI,iCAAe,CAAC,KAAK,EAAE,OAAO,CAAC,EAAC,CAAA;IAE3D,MAAM,SAAS,GAAG,IAAA,+BAAc,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAEnE,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,SAAS;QACtB,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;QAC5C,WAAW,EAAE;YACX,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,uCAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAClD;QACD,SAAS,EAAE;YACT,GAAG,CAAC,OAAO,CAAC,MAAM;gBAChB,CAAC,CAAC;oBACE;wBACE,OAAO,EAAE,6BAAa;wBACtB,UAAU,EAAE,CAAC,KAA8B,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;wBACvE,MAAM,EAAE,CAAC,SAAS,CAAC;qBACpB;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,CAAC,QAAQ;gBAClB,CAAC,CAAC;oBACE;wBACE,OAAO,EAAE,iCAAe;wBACxB,UAAU,EAAE,CAAC,KAA8B,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;wBACzE,MAAM,EAAE,CAAC,SAAS,CAAC;qBACpB;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QACD,UAAU,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE;YACnC,MAAM,cAAc,GAAG,KAA2C,CAAA;YAClE,IAAI,OAAO,CAAC,MAAM;gBAAE,MAAM,gBAAgB,CAAC,cAAc,CAAC,CAAC,iBAAiB,EAAE,CAAA;YAC9E,IAAI,OAAO,CAAC,QAAQ;gBAAE,MAAM,kBAAkB,CAAC,cAAc,CAAC,CAAC,iBAAiB,EAAE,CAAA;QACpF,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { VerifierService } from '../services/VerifierService';
2
+ import { CreateOpenId4VcVerificationRequestDto } from './dto';
3
+ export declare class VerifierController {
4
+ private readonly verifierService;
5
+ constructor(verifierService: VerifierService);
6
+ createRequest(dto: CreateOpenId4VcVerificationRequestDto): Promise<import("../services/VerifierService").OpenId4VcVerificationRequest>;
7
+ getResult(id: string): Promise<import("../services/VerifierService").OpenId4VcVerificationResult>;
8
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.VerifierController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const VerifierService_1 = require("../services/VerifierService");
18
+ const dto_1 = require("./dto");
19
+ let VerifierController = class VerifierController {
20
+ constructor(verifierService) {
21
+ this.verifierService = verifierService;
22
+ }
23
+ async createRequest(dto) {
24
+ try {
25
+ return await this.verifierService.createRequest(dto.policyId);
26
+ }
27
+ catch (error) {
28
+ if (error instanceof VerifierService_1.OpenId4VcVerifierRequestError) {
29
+ throw new common_1.BadRequestException(error.message);
30
+ }
31
+ throw error;
32
+ }
33
+ }
34
+ async getResult(id) {
35
+ try {
36
+ return await this.verifierService.getResult(id);
37
+ }
38
+ catch (error) {
39
+ if (error instanceof VerifierService_1.UnknownVerificationSessionError) {
40
+ throw new common_1.NotFoundException(error.message);
41
+ }
42
+ throw error;
43
+ }
44
+ }
45
+ };
46
+ exports.VerifierController = VerifierController;
47
+ __decorate([
48
+ (0, common_1.Post)('requests'),
49
+ __param(0, (0, common_1.Body)()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [dto_1.CreateOpenId4VcVerificationRequestDto]),
52
+ __metadata("design:returntype", Promise)
53
+ ], VerifierController.prototype, "createRequest", null);
54
+ __decorate([
55
+ (0, common_1.Get)('sessions/:id'),
56
+ __param(0, (0, common_1.Param)('id')),
57
+ __metadata("design:type", Function),
58
+ __metadata("design:paramtypes", [String]),
59
+ __metadata("design:returntype", Promise)
60
+ ], VerifierController.prototype, "getResult", null);
61
+ exports.VerifierController = VerifierController = __decorate([
62
+ (0, common_1.Controller)({ path: 'oid4vc/verifier', version: '1' }),
63
+ __param(0, (0, common_1.Inject)(VerifierService_1.VerifierService)),
64
+ __metadata("design:paramtypes", [VerifierService_1.VerifierService])
65
+ ], VerifierController);
66
+ //# sourceMappingURL=VerifierController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerifierController.js","sourceRoot":"","sources":["../../src/nestjs/VerifierController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASuB;AAEvB,iEAIoC;AAEpC,+BAA6D;AAGtD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YAA6D,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAGpF,AAAN,KAAK,CAAC,aAAa,CAAS,GAA0C;QAC3E,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,+CAA6B,EAAE,CAAC;gBACnD,MAAM,IAAI,4BAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC9C,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAGY,AAAN,KAAK,CAAC,SAAS,CAAc,EAAU;QAC5C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,iDAA+B,EAAE,CAAC;gBACrD,MAAM,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC5C,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,gDAAkB;AAIhB;IADZ,IAAA,aAAI,EAAC,UAAU,CAAC;IACW,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,2CAAqC;;uDAS5E;AAGY;IADZ,IAAA,YAAG,EAAC,cAAc,CAAC;IACI,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;mDASlC;6BAzBU,kBAAkB;IAD9B,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAEhC,WAAA,IAAA,eAAM,EAAC,iCAAe,CAAC,CAAA;qCAAmC,iCAAe;GADlF,kBAAkB,CA0B9B"}
@@ -0,0 +1,7 @@
1
+ export declare class CreateOpenId4VcOfferDto {
2
+ credentialConfigurationId: string;
3
+ claims: Record<string, unknown>;
4
+ }
5
+ export declare class CreateOpenId4VcVerificationRequestDto {
6
+ policyId: string;
7
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreateOpenId4VcVerificationRequestDto = exports.CreateOpenId4VcOfferDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class CreateOpenId4VcOfferDto {
15
+ }
16
+ exports.CreateOpenId4VcOfferDto = CreateOpenId4VcOfferDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ (0, class_validator_1.IsNotEmpty)(),
20
+ __metadata("design:type", String)
21
+ ], CreateOpenId4VcOfferDto.prototype, "credentialConfigurationId", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsObject)(),
24
+ __metadata("design:type", Object)
25
+ ], CreateOpenId4VcOfferDto.prototype, "claims", void 0);
26
+ class CreateOpenId4VcVerificationRequestDto {
27
+ }
28
+ exports.CreateOpenId4VcVerificationRequestDto = CreateOpenId4VcVerificationRequestDto;
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ __metadata("design:type", String)
33
+ ], CreateOpenId4VcVerificationRequestDto.prototype, "policyId", void 0);
34
+ //# sourceMappingURL=dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.js","sourceRoot":"","sources":["../../src/nestjs/dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAgE;AAEhE,MAAa,uBAAuB;CAOnC;AAPD,0DAOC;AAJC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0EACqB;AAGlC;IADC,IAAA,0BAAQ,GAAE;;uDACqB;AAGlC,MAAa,qCAAqC;CAIjD;AAJD,sFAIC;AADC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uEACI"}