@cheqd/studio 3.16.0-develop.8 → 3.16.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 (66) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +11 -0
  3. package/dist/app.js.map +1 -1
  4. package/dist/controllers/api/accreditation.d.ts +2 -10
  5. package/dist/controllers/api/accreditation.d.ts.map +1 -1
  6. package/dist/controllers/api/accreditation.js +110 -369
  7. package/dist/controllers/api/accreditation.js.map +1 -1
  8. package/dist/controllers/api/credential.d.ts +1 -1
  9. package/dist/controllers/api/credential.d.ts.map +1 -1
  10. package/dist/controllers/api/credential.js +2 -1
  11. package/dist/controllers/api/credential.js.map +1 -1
  12. package/dist/controllers/api/received-credential.d.ts +375 -0
  13. package/dist/controllers/api/received-credential.d.ts.map +1 -0
  14. package/dist/controllers/api/received-credential.js +650 -0
  15. package/dist/controllers/api/received-credential.js.map +1 -0
  16. package/dist/database/entities/issued-credential.entity.d.ts +18 -2
  17. package/dist/database/entities/issued-credential.entity.d.ts.map +1 -1
  18. package/dist/database/entities/issued-credential.entity.js +29 -0
  19. package/dist/database/entities/issued-credential.entity.js.map +1 -1
  20. package/dist/database/migrations/1766408271347-studio-migrations.d.ts +7 -0
  21. package/dist/database/migrations/1766408271347-studio-migrations.d.ts.map +1 -0
  22. package/dist/database/migrations/1766408271347-studio-migrations.js +16 -0
  23. package/dist/database/migrations/1766408271347-studio-migrations.js.map +1 -0
  24. package/dist/database/types/types.d.ts.map +1 -1
  25. package/dist/database/types/types.js +2 -0
  26. package/dist/database/types/types.js.map +1 -1
  27. package/dist/middleware/auth/routes/api/credential-auth.d.ts.map +1 -1
  28. package/dist/middleware/auth/routes/api/credential-auth.js +12 -0
  29. package/dist/middleware/auth/routes/api/credential-auth.js.map +1 -1
  30. package/dist/services/api/accreditation.d.ts +17 -2
  31. package/dist/services/api/accreditation.d.ts.map +1 -1
  32. package/dist/services/api/accreditation.js +400 -7
  33. package/dist/services/api/accreditation.js.map +1 -1
  34. package/dist/services/api/credentials.d.ts.map +1 -1
  35. package/dist/services/api/credentials.js +38 -6
  36. package/dist/services/api/credentials.js.map +1 -1
  37. package/dist/services/api/received-credentials.d.ts +129 -0
  38. package/dist/services/api/received-credentials.d.ts.map +1 -0
  39. package/dist/services/api/received-credentials.js +498 -0
  40. package/dist/services/api/received-credentials.js.map +1 -0
  41. package/dist/services/identity/abstract.d.ts +4 -0
  42. package/dist/services/identity/abstract.d.ts.map +1 -1
  43. package/dist/services/identity/abstract.js +12 -0
  44. package/dist/services/identity/abstract.js.map +1 -1
  45. package/dist/services/identity/index.d.ts +22 -0
  46. package/dist/services/identity/index.d.ts.map +1 -1
  47. package/dist/services/identity/index.js.map +1 -1
  48. package/dist/services/identity/providers/studio/agent.d.ts +15 -0
  49. package/dist/services/identity/providers/studio/agent.d.ts.map +1 -1
  50. package/dist/services/identity/providers/studio/agent.js +51 -9
  51. package/dist/services/identity/providers/studio/agent.js.map +1 -1
  52. package/dist/services/identity/providers/studio/local.d.ts +4 -0
  53. package/dist/services/identity/providers/studio/local.d.ts.map +1 -1
  54. package/dist/services/identity/providers/studio/local.js +12 -0
  55. package/dist/services/identity/providers/studio/local.js.map +1 -1
  56. package/dist/services/identity/providers/studio/postgres.d.ts +7 -0
  57. package/dist/services/identity/providers/studio/postgres.d.ts.map +1 -1
  58. package/dist/services/identity/providers/studio/postgres.js +19 -0
  59. package/dist/services/identity/providers/studio/postgres.js.map +1 -1
  60. package/dist/services/track/admin/account-submitter.d.ts.map +1 -1
  61. package/dist/services/track/admin/account-submitter.js +1 -3
  62. package/dist/services/track/admin/account-submitter.js.map +1 -1
  63. package/dist/static/swagger-api.json +526 -1
  64. package/dist/types/accreditation.d.ts +1 -1
  65. package/dist/types/accreditation.d.ts.map +1 -1
  66. package/package.json +4 -4
@@ -1,10 +1,252 @@
1
- import { DIDAccreditationTypes } from '../../types/accreditation.js';
1
+ import { AccreditationRequestType, DIDAccreditationTypes, DIDAccreditationPolicyTypes, } from '../../types/accreditation.js';
2
2
  import { isCredentialIssuerDidDeactivated } from '../helpers.js';
3
3
  import { IdentityServiceStrategySetup } from '../identity/index.js';
4
4
  import { StatusCodes } from 'http-status-codes';
5
5
  import { parseDidFromDidUrl } from '../../helpers/helpers.js';
6
+ import { v4 } from 'uuid';
7
+ import { CredentialCategory, CredentialConnectors } from '../../types/credential.js';
8
+ import { Credentials } from './credentials.js';
9
+ import NodeCache from 'node-cache';
10
+ import { StatusListType } from '../../types/credential-status.js';
11
+ const ACCREDITATION_RESOLVE_CACHE_TTL_MS = 30_000;
12
+ const ACCREDITATION_RESOLVE_CACHE_MAX_ENTRIES = 200;
13
+ const ACCREDITATION_RESOLVE_CONCURRENCY = 8;
14
+ function buildCacheKey(url, customerId) {
15
+ return `${customerId ?? 'anonymous'}::${url}`;
16
+ }
17
+ const accreditationResolveCache = new NodeCache({
18
+ stdTTL: ACCREDITATION_RESOLVE_CACHE_TTL_MS / 1000,
19
+ checkperiod: 0,
20
+ useClones: false,
21
+ deleteOnExpire: true,
22
+ maxKeys: ACCREDITATION_RESOLVE_CACHE_MAX_ENTRIES,
23
+ });
24
+ const inFlightAccreditations = new Map();
25
+ function getCachedAccreditation(key) {
26
+ return accreditationResolveCache.get(key) ?? null;
27
+ }
28
+ function setCachedAccreditation(key, value) {
29
+ accreditationResolveCache.set(key, value);
30
+ }
6
31
  export class AccreditationService {
7
32
  static instance = new AccreditationService();
33
+ async issue_accreditation(accreditationType, issuerDid, subjectDid, schemas, body, customer) {
34
+ // Get strategy e.g. postgres or local
35
+ const identityServiceStrategySetup = new IdentityServiceStrategySetup();
36
+ // Handles string input instead of an array
37
+ let { type, '@context': context, parentAccreditation, rootAuthorization, trustFramework, trustFrameworkId, attributes, accreditationName, format, credentialStatus, } = body;
38
+ if (typeof type === 'string') {
39
+ type = [type];
40
+ }
41
+ if (typeof context === 'string') {
42
+ context = [context];
43
+ }
44
+ try {
45
+ // Validate issuer and subject DIDs in parallel only for authorize
46
+ // For attest, accredit they are validated in verify_accreditation
47
+ const [issuerDidRes, subjectDidRes] = await Promise.all([
48
+ identityServiceStrategySetup.agent.resolveDid(issuerDid),
49
+ identityServiceStrategySetup.agent.resolveDid(subjectDid),
50
+ ]);
51
+ // Validate issuer DID
52
+ if (!issuerDidRes?.didDocument) {
53
+ return {
54
+ success: false,
55
+ status: StatusCodes.BAD_REQUEST,
56
+ error: `DID ${issuerDid} is not resolved because of error from resolver: ${issuerDidRes.didResolutionMetadata.error}.`,
57
+ };
58
+ }
59
+ if (issuerDidRes.didDocumentMetadata.deactivated) {
60
+ return {
61
+ success: false,
62
+ status: StatusCodes.BAD_REQUEST,
63
+ error: `${issuerDid} is deactivated`,
64
+ };
65
+ }
66
+ // Validate subject DID
67
+ if (!subjectDidRes?.didDocument) {
68
+ return {
69
+ success: false,
70
+ status: StatusCodes.BAD_REQUEST,
71
+ error: `DID ${subjectDid} is not resolved because of error from resolver: ${subjectDidRes.didResolutionMetadata.error}.`,
72
+ };
73
+ }
74
+ if (subjectDidRes.didDocumentMetadata.deactivated) {
75
+ return {
76
+ success: false,
77
+ status: StatusCodes.BAD_REQUEST,
78
+ error: `${subjectDid} is deactivated`,
79
+ };
80
+ }
81
+ const resourceId = v4();
82
+ const accreditedFor = schemas.map(({ url, types }) => ({
83
+ schemaId: url,
84
+ types: Array.isArray(types) ? types : [types],
85
+ }));
86
+ // construct credential request
87
+ const credentialRequest = {
88
+ subjectDid,
89
+ attributes: {
90
+ ...attributes,
91
+ accreditedFor,
92
+ id: subjectDid,
93
+ },
94
+ issuerDid,
95
+ format: format || 'jwt',
96
+ connector: CredentialConnectors.Resource,
97
+ credentialId: resourceId,
98
+ credentialName: accreditationName,
99
+ credentialStatus,
100
+ category: CredentialCategory.ACCREDITATION,
101
+ };
102
+ let resourceType;
103
+ switch (accreditationType) {
104
+ case AccreditationRequestType.authorize:
105
+ resourceType = DIDAccreditationTypes.VerifiableAuthorizationForTrustChain;
106
+ credentialRequest.type = [...(type || []), resourceType];
107
+ credentialRequest.termsOfUse = {
108
+ type: DIDAccreditationPolicyTypes.Authorize,
109
+ trustFramework,
110
+ trustFrameworkId,
111
+ };
112
+ break;
113
+ case AccreditationRequestType.accredit:
114
+ resourceType = DIDAccreditationTypes.VerifiableAccreditationToAccredit;
115
+ credentialRequest.type = [...(type || []), resourceType];
116
+ credentialRequest.termsOfUse = {
117
+ type: DIDAccreditationPolicyTypes.Accredit,
118
+ parentAccreditation,
119
+ rootAuthorization,
120
+ };
121
+ break;
122
+ case AccreditationRequestType.attest:
123
+ resourceType = DIDAccreditationTypes.VerifiableAccreditationToAttest;
124
+ credentialRequest.type = [...(type || []), resourceType];
125
+ credentialRequest.termsOfUse = {
126
+ type: DIDAccreditationPolicyTypes.Accredit,
127
+ parentAccreditation,
128
+ rootAuthorization,
129
+ };
130
+ break;
131
+ }
132
+ // validate parent and root accreditations
133
+ if (accreditationType === AccreditationRequestType.accredit ||
134
+ accreditationType === AccreditationRequestType.attest) {
135
+ const result = await this.verify_accreditation(issuerDid, parentAccreditation, accreditedFor, true, false, customer, rootAuthorization);
136
+ if (result.success === false) {
137
+ return {
138
+ success: false,
139
+ status: result.status,
140
+ error: `Invalid Request: Root Authorization or parent Accreditation is not valid: ${result.error}`,
141
+ };
142
+ }
143
+ }
144
+ // issue accreditation
145
+ const accreditation = await Credentials.instance.issue_credential(credentialRequest, customer);
146
+ return {
147
+ success: true,
148
+ status: StatusCodes.OK,
149
+ data: {
150
+ didUrls: [
151
+ `${issuerDid}/resources/${resourceId}`,
152
+ `${issuerDid}?resourceName=${encodeURIComponent(accreditationName)}&resourceType=${resourceType}`,
153
+ ],
154
+ accreditation,
155
+ },
156
+ };
157
+ }
158
+ catch (error) {
159
+ return {
160
+ success: false,
161
+ status: StatusCodes.INTERNAL_SERVER_ERROR,
162
+ error: `Internal error: ${error?.message || error}`,
163
+ };
164
+ }
165
+ }
166
+ async revoke_accreditation(didUrl, publish, symmetricKey, customer) {
167
+ const identityServiceStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
168
+ try {
169
+ const res = await identityServiceStrategySetup.agent.resolve(didUrl);
170
+ const resource = await res.json();
171
+ if (resource.dereferencingMetadata) {
172
+ return {
173
+ success: false,
174
+ status: StatusCodes.NOT_FOUND,
175
+ error: `DID URL ${didUrl} is not found`,
176
+ };
177
+ }
178
+ const accreditation = resource;
179
+ const result = await identityServiceStrategySetup.agent.revokeCredentials(accreditation, StatusListType.Bitstring, publish, customer, symmetricKey);
180
+ return {
181
+ success: true,
182
+ status: StatusCodes.OK,
183
+ data: result,
184
+ };
185
+ }
186
+ catch (error) {
187
+ return {
188
+ success: false,
189
+ status: StatusCodes.INTERNAL_SERVER_ERROR,
190
+ error: `Internal error: ${error?.message || error}`,
191
+ };
192
+ }
193
+ }
194
+ async suspend_accreditation(didUrl, publish, symmetricKey, customer) {
195
+ const identityServiceStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
196
+ try {
197
+ const res = await identityServiceStrategySetup.agent.resolve(didUrl);
198
+ const resource = await res.json();
199
+ if (resource.dereferencingMetadata) {
200
+ return {
201
+ success: false,
202
+ status: StatusCodes.NOT_FOUND,
203
+ error: `DID URL ${didUrl} is not found`,
204
+ };
205
+ }
206
+ const accreditation = resource;
207
+ const result = await identityServiceStrategySetup.agent.suspendCredentials(accreditation, StatusListType.Bitstring, publish, customer, symmetricKey);
208
+ return {
209
+ success: true,
210
+ status: StatusCodes.OK,
211
+ data: result,
212
+ };
213
+ }
214
+ catch (error) {
215
+ return {
216
+ success: false,
217
+ status: StatusCodes.INTERNAL_SERVER_ERROR,
218
+ error: `Internal error: ${error?.message || error}`,
219
+ };
220
+ }
221
+ }
222
+ async reinstate_accreditation(didUrl, publish, symmetricKey, customer) {
223
+ const identityServiceStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
224
+ try {
225
+ const res = await identityServiceStrategySetup.agent.resolve(didUrl);
226
+ const resource = await res.json();
227
+ if (resource.dereferencingMetadata) {
228
+ return {
229
+ success: false,
230
+ status: StatusCodes.NOT_FOUND,
231
+ error: `DID URL ${didUrl} is not found`,
232
+ };
233
+ }
234
+ const accreditation = resource;
235
+ const result = await identityServiceStrategySetup.agent.reinstateCredentials(accreditation, StatusListType.Bitstring, publish, customer, symmetricKey);
236
+ return {
237
+ success: true,
238
+ status: StatusCodes.OK,
239
+ data: result,
240
+ };
241
+ }
242
+ catch (error) {
243
+ return {
244
+ success: false,
245
+ status: StatusCodes.INTERNAL_SERVER_ERROR,
246
+ error: `Internal error: ${error?.message || error}`,
247
+ };
248
+ }
249
+ }
8
250
  async verify_accreditation(subjectDid, didUrl, accreditedFor = [], verifyStatus, allowDeactivatedDid, customer, rootAuthorization, policies) {
9
251
  // Get strategy e.g. postgres or local
10
252
  const identityServiceStrategySetup = new IdentityServiceStrategySetup();
@@ -14,8 +256,20 @@ export class AccreditationService {
14
256
  let accreditorDids = [];
15
257
  let deactivatedDidsCheckPromises = [];
16
258
  while (true) {
17
- const res = await identityServiceStrategySetup.agent.resolve(accreditationUrl);
18
- const result = await res.json();
259
+ const cacheKey = buildCacheKey(accreditationUrl, customer?.customerId);
260
+ const cached = getCachedAccreditation(cacheKey);
261
+ let result;
262
+ if (cached) {
263
+ result = cached;
264
+ }
265
+ else {
266
+ const res = await identityServiceStrategySetup.agent.resolve(accreditationUrl);
267
+ result = await res.json();
268
+ // Cache successful dereferenced results (skip caching not-found / dereferencing metadata)
269
+ if (!result?.dereferencingMetadata) {
270
+ setCachedAccreditation(cacheKey, result);
271
+ }
272
+ }
19
273
  if (result.dereferencingMetadata) {
20
274
  return {
21
275
  success: false,
@@ -27,7 +281,6 @@ export class AccreditationService {
27
281
  // Create credential object
28
282
  const accreditation = result;
29
283
  const accreditorDid = typeof accreditation.issuer === 'string' ? accreditation.issuer : accreditation.issuer.id;
30
- accreditorDids.push(accreditorDid);
31
284
  // Check if issuer DID is deactivated
32
285
  if (!allowDeactivatedDid) {
33
286
  deactivatedDidsCheckPromises.push(isCredentialIssuerDidDeactivated(accreditation));
@@ -41,9 +294,6 @@ export class AccreditationService {
41
294
  error: `Error on verifying accreditation ${accreditationUrl}: Expected accreditation to be linked to subject DID ${accreditedSubject}, but found it linked to DID ${accreditation.credentialSubject.id} instead.`,
42
295
  };
43
296
  }
44
- if (verifyStatus && !accreditation.credentialStatus) {
45
- verifyStatus = false;
46
- }
47
297
  // Check if the accreditor has permission for the schema provided
48
298
  if (!accreditedFor.every((schema) => accreditation.credentialSubject.accreditedFor.some((accredited) => schema.types.every((value) => (accredited.types || []).includes(value)) &&
49
299
  accredited.schemaId === schema.schemaId))) {
@@ -69,6 +319,14 @@ export class AccreditationService {
69
319
  error: `Error on verifying accreditation ${accreditationUrl}: ${verifyResult.error.message}`,
70
320
  };
71
321
  }
322
+ if (verifyStatus && verifyResult.valid === false) {
323
+ return {
324
+ success: false,
325
+ status: StatusCodes.OK,
326
+ data: initialVerifyResult,
327
+ error: `Error on verifying accreditation ${accreditationUrl}: ${accreditorDid} is ${verifyResult.message} in the trust chain`,
328
+ };
329
+ }
72
330
  if (!Array.isArray(accreditation.type)) {
73
331
  return {
74
332
  success: false,
@@ -151,5 +409,140 @@ export class AccreditationService {
151
409
  }
152
410
  }
153
411
  }
412
+ async list_accreditations(customer, accreditationType, network, did, page, limit) {
413
+ const identityServiceStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
414
+ let resourceType;
415
+ switch (accreditationType) {
416
+ case AccreditationRequestType.authorize:
417
+ resourceType = DIDAccreditationTypes.VerifiableAuthorizationForTrustChain;
418
+ break;
419
+ case AccreditationRequestType.accredit:
420
+ resourceType = DIDAccreditationTypes.VerifiableAccreditationToAccredit;
421
+ break;
422
+ case AccreditationRequestType.attest:
423
+ resourceType = DIDAccreditationTypes.VerifiableAccreditationToAttest;
424
+ break;
425
+ default:
426
+ return {
427
+ success: false,
428
+ status: StatusCodes.BAD_REQUEST,
429
+ error: `Invalid accreditationType: ${accreditationType}. Must be one of: authorize, accredit, attest.`,
430
+ };
431
+ }
432
+ try {
433
+ // Fetch resources of accreditation resourceType associated with the account
434
+ const { resources } = await identityServiceStrategySetup.agent.findLatestResourcesVersionsByType(resourceType, customer, network, did, page, limit);
435
+ // Build resource URLs for resolution
436
+ const resourceUrls = resources.map((item) => `${item.did}/resources/${item.resourceId}`);
437
+ // No resources to resolve, return early
438
+ if (resourceUrls.length === 0) {
439
+ return {
440
+ success: true,
441
+ status: StatusCodes.OK,
442
+ data: {
443
+ total: 0,
444
+ accreditations: [],
445
+ },
446
+ };
447
+ }
448
+ // 1. Fetch all tracking records from the issued credentials table
449
+ const { credentials: trackingRecords } = await Credentials.instance.list(customer, {
450
+ category: CredentialCategory.ACCREDITATION,
451
+ providerCredentialId: resources.map((item) => item.resourceId),
452
+ });
453
+ // 2. OPTIMIZATION: Create a Map for O(1) tracking record lookup by providerCredentialId
454
+ const trackingMap = new Map();
455
+ for (const record of trackingRecords) {
456
+ trackingMap.set(record.providerCredentialId, record);
457
+ }
458
+ const resolveAccreditationWithCache = async (url) => {
459
+ const cacheKey = buildCacheKey(url, customer?.customerId);
460
+ const cached = getCachedAccreditation(cacheKey);
461
+ if (cached) {
462
+ return cached;
463
+ }
464
+ const inFlight = inFlightAccreditations.get(cacheKey);
465
+ if (inFlight) {
466
+ return inFlight;
467
+ }
468
+ const resolverPromise = (async () => {
469
+ try {
470
+ const res = await identityServiceStrategySetup.agent.resolve(url, true);
471
+ const credential = await res.json();
472
+ // Skip if the credential doesn't have contentStream
473
+ if (!credential.contentStream) {
474
+ return null;
475
+ }
476
+ const resourceId = credential.contentMetadata.resourceId;
477
+ const trackingRecord = trackingMap.get(resourceId);
478
+ if (trackingRecord) {
479
+ const { issuedCredentialId, providerId, providerCredentialId, status, statusUpdatedAt } = trackingRecord;
480
+ // Merge tracking metadata with credential
481
+ const accreditation = {
482
+ ...credential.contentStream,
483
+ metadata: {
484
+ issuedCredentialId,
485
+ providerId,
486
+ providerCredentialId,
487
+ status,
488
+ statusUpdatedAt,
489
+ },
490
+ };
491
+ setCachedAccreditation(cacheKey, accreditation);
492
+ return accreditation;
493
+ }
494
+ else {
495
+ // No tracking record, return just the credential (legacy)
496
+ setCachedAccreditation(cacheKey, credential.contentStream);
497
+ return credential.contentStream;
498
+ }
499
+ }
500
+ catch (error) {
501
+ console.error(`Failed to process accreditation for URL: ${url}`, error);
502
+ return null;
503
+ }
504
+ finally {
505
+ inFlightAccreditations.delete(cacheKey);
506
+ }
507
+ })();
508
+ inFlightAccreditations.set(cacheKey, resolverPromise);
509
+ return resolverPromise;
510
+ };
511
+ // 3. Resolve resources and enhance with tracking metadata with bounded concurrency
512
+ const resolvedAccreditations = new Array(resourceUrls.length);
513
+ let currentIndex = 0;
514
+ const workers = Array.from({ length: Math.min(ACCREDITATION_RESOLVE_CONCURRENCY, resourceUrls.length) }, async () => {
515
+ // eslint-disable-next-line no-constant-condition
516
+ while (true) {
517
+ const index = currentIndex++;
518
+ if (index >= resourceUrls.length) {
519
+ break;
520
+ }
521
+ const accreditation = await resolveAccreditationWithCache(resourceUrls[index]);
522
+ if (accreditation) {
523
+ resolvedAccreditations[index] = accreditation;
524
+ }
525
+ }
526
+ });
527
+ // 4. Wait for all resolutions to complete and filter out any failed/skipped ones (null)
528
+ await Promise.all(workers);
529
+ const accreditations = resolvedAccreditations.filter(Boolean);
530
+ return {
531
+ success: true,
532
+ status: StatusCodes.OK,
533
+ data: {
534
+ total: accreditations.length,
535
+ accreditations: accreditations,
536
+ },
537
+ };
538
+ }
539
+ catch (error) {
540
+ return {
541
+ success: false,
542
+ status: StatusCodes.INTERNAL_SERVER_ERROR,
543
+ error: `Internal error: ${error?.message || error}`,
544
+ };
545
+ }
546
+ }
154
547
  }
155
548
  //# sourceMappingURL=accreditation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accreditation.js","sourceRoot":"","sources":["../../../src/services/api/accreditation.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,qBAAqB,EAA4B,MAAM,8BAA8B,CAAC;AACxH,OAAO,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iB,CAAC,KAAK,aAAa,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;oBACvG,OAAO;wBACN,MAAM,EAAE,WAAW,CAAC,EAAE;wBACtB,OAAO,EAAE,KAAK;wBACd,IAAI,EAAE;4BACL,GAAG,mBAAmB;4BACtB,cAAc;4BACd,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAAE;4BACrD,UAAU,EAAE,aAAa,CAAC,UAAU;yBACpC;wBACD,KAAK,EAAE,oCAAoC,gBAAgB,+DAA+D,iBAAiB,gCAAgC,aAAa,CAAC,iBAAiB,CAAC,EAAE,UAAU;qBACvN,CAAC;gBACH,CAAC;gBACD,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChC,OAAO;wBACN,MAAM,EAAE,WAAW,CAAC,EAAE;wBACtB,OAAO,EAAE,KAAK;wBACd,IAAI,EAAE,mBAAmB;wBACzB,KAAK,EAAE,oCAAoC,gBAAgB,UAAU,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,qCAAqC;qBACpI,CAAC;gBACH,CAAC;gBAED,OAAO;oBACN,MAAM,EAAE,WAAW,CAAC,EAAE;oBACtB,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE;wBACL,GAAG,mBAAmB;wBACtB,cAAc;wBACd,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAAE;wBACrD,UAAU,EAAE,aAAa,CAAC,UAAU;qBACpC;iBACD,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC"}
1
+ {"version":3,"file":"accreditation.js","sourceRoot":"","sources":["../../../src/services/api/accreditation.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,GAE3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,WAAW,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AM,EACzC,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC;IAoDZ,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQ3E"}
@@ -86,6 +86,8 @@ export class Credentials {
86
86
  let verifiableCredential;
87
87
  let providerCredentialId;
88
88
  let credentialMetadata = {};
89
+ let isSubjectInDatabase = false;
90
+ let veramoHash;
89
91
  switch (providerId || connector) {
90
92
  case CredentialConnectors.Dock: {
91
93
  const dock = new DockIdentityService();
@@ -112,7 +114,8 @@ export class Credentials {
112
114
  case CredentialConnectors.Studio:
113
115
  case CredentialConnectors.Verida:
114
116
  default: {
115
- const verifiable_credential = await new IdentityServiceStrategySetup(customer.customerId).agent.createCredential(credential, format, statusOptions, customer);
117
+ const studioService = new IdentityServiceStrategySetup(customer.customerId);
118
+ const verifiable_credential = await studioService.agent.createCredential(credential, format, statusOptions, customer);
116
119
  const isVeridaDid = new VeridaDIDValidator().validate(subjectDid);
117
120
  let sendCredentialResponse;
118
121
  if (ENABLE_VERIDA_CONNECTOR === 'true' &&
@@ -135,7 +138,16 @@ export class Credentials {
135
138
  else {
136
139
  providerCredentialId = verifiable_credential.id;
137
140
  }
138
- verifiableCredential = verifiable_credential;
141
+ // Check if subject DID exists in Veramo's identifier store
142
+ isSubjectInDatabase = await studioService.agent.didExists(subjectDid, customer);
143
+ // If subject DID is in database, store credential in Veramo's dataStore
144
+ if (isSubjectInDatabase) {
145
+ // Store credential in Veramo's dataStore and get the hash
146
+ veramoHash = await studioService.agent.saveCredential(verifiable_credential, customer);
147
+ // Calculate offer expiration (e.g., 30 days from now)
148
+ const offerExpiresAt = new Date();
149
+ offerExpiresAt.setDate(offerExpiresAt.getDate() + 30);
150
+ }
139
151
  credentialMetadata = {
140
152
  schema: verifiable_credential.credentialSchema,
141
153
  proof: verifiable_credential.proof,
@@ -144,6 +156,7 @@ export class Credentials {
144
156
  termsOfUse: additionalData.termsOfUse,
145
157
  contexts: [...(context || []), ...VC_CONTEXT],
146
158
  };
159
+ verifiableCredential = verifiable_credential;
147
160
  break;
148
161
  }
149
162
  }
@@ -151,13 +164,21 @@ export class Credentials {
151
164
  const credentialType = Array.isArray(verifiableCredential.type)
152
165
  ? verifiableCredential.type
153
166
  : [verifiableCredential.type || 'VerifiableCredential'];
167
+ // Determine status based on whether subject DID is in database
168
+ const currentStatus = isSubjectInDatabase ? 'offered' : 'issued';
169
+ // Calculate offer expiration if credential is offered
170
+ let offerExpiresAt;
171
+ if (isSubjectInDatabase) {
172
+ offerExpiresAt = new Date();
173
+ offerExpiresAt.setDate(offerExpiresAt.getDate() + 30); // 30 days from now
174
+ }
154
175
  await this.update(trackingRecord.issuedCredentialId, {
155
176
  providerCredentialId: providerCredentialId,
156
177
  metadata: credentialMetadata,
157
- status: 'issued',
178
+ status: currentStatus,
158
179
  }, customer);
159
- // Also update fields not covered by the update() method
160
- await this.repository.update({ issuedCredentialId: trackingRecord.issuedCredentialId }, {
180
+ // Build update payload for fields not covered by the update() method
181
+ const updatePayload = {
161
182
  type: credentialType,
162
183
  issuedAt: verifiableCredential.issuanceDate
163
184
  ? new Date(verifiableCredential.issuanceDate)
@@ -166,7 +187,18 @@ export class Credentials {
166
187
  ? new Date(verifiableCredential.expirationDate)
167
188
  : undefined,
168
189
  credentialStatus: verifiableCredential.credentialStatus,
169
- });
190
+ };
191
+ // Add offer-specific fields if credential is offered
192
+ if (isSubjectInDatabase && offerExpiresAt) {
193
+ updatePayload.offerExpiresAt = offerExpiresAt;
194
+ }
195
+ // Set veramoHash if credential was stored in Veramo
196
+ if (veramoHash) {
197
+ // We need to set the FK column directly since we have the hash
198
+ updatePayload.veramoHash = veramoHash;
199
+ }
200
+ // Also update fields not covered by the update() method
201
+ await this.repository.update({ issuedCredentialId: trackingRecord.issuedCredentialId }, updatePayload);
170
202
  return verifiableCredential;
171
203
  }
172
204
  catch (error) {