@cheqd/studio 3.13.1-develop.1 → 3.14.0-develop.2

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 (73) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +4 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/controllers/api/account.d.ts +2 -2
  5. package/dist/controllers/api/account.js +2 -2
  6. package/dist/controllers/api/accreditation.d.ts.map +1 -1
  7. package/dist/controllers/api/accreditation.js +1 -0
  8. package/dist/controllers/api/accreditation.js.map +1 -1
  9. package/dist/controllers/api/credential.d.ts +166 -16
  10. package/dist/controllers/api/credential.d.ts.map +1 -1
  11. package/dist/controllers/api/credential.js +221 -97
  12. package/dist/controllers/api/credential.js.map +1 -1
  13. package/dist/controllers/validator/credential-status.d.ts +1 -1
  14. package/dist/controllers/validator/credential-status.d.ts.map +1 -1
  15. package/dist/controllers/validator/validator.d.ts +2 -1
  16. package/dist/controllers/validator/validator.d.ts.map +1 -1
  17. package/dist/database/entities/issued-credential.entity.d.ts +42 -0
  18. package/dist/database/entities/issued-credential.entity.d.ts.map +1 -0
  19. package/dist/database/entities/issued-credential.entity.js +131 -0
  20. package/dist/database/entities/issued-credential.entity.js.map +1 -0
  21. package/dist/database/migrations/1760533089289-studio-migrations.d.ts +7 -0
  22. package/dist/database/migrations/1760533089289-studio-migrations.d.ts.map +1 -0
  23. package/dist/database/migrations/1760533089289-studio-migrations.js +35 -0
  24. package/dist/database/migrations/1760533089289-studio-migrations.js.map +1 -0
  25. package/dist/database/migrations/1760533089389-MigrateStudioCredentials.d.ts +20 -0
  26. package/dist/database/migrations/1760533089389-MigrateStudioCredentials.d.ts.map +1 -0
  27. package/dist/database/migrations/1760533089389-MigrateStudioCredentials.js +202 -0
  28. package/dist/database/migrations/1760533089389-MigrateStudioCredentials.js.map +1 -0
  29. package/dist/database/migrations/1760533089589-MigrateDockCredentials.d.ts +24 -0
  30. package/dist/database/migrations/1760533089589-MigrateDockCredentials.d.ts.map +1 -0
  31. package/dist/database/migrations/1760533089589-MigrateDockCredentials.js +205 -0
  32. package/dist/database/migrations/1760533089589-MigrateDockCredentials.js.map +1 -0
  33. package/dist/database/types/types.d.ts.map +1 -1
  34. package/dist/database/types/types.js +11 -0
  35. package/dist/database/types/types.js.map +1 -1
  36. package/dist/middleware/auth/routes/api/credential-auth.d.ts.map +1 -1
  37. package/dist/middleware/auth/routes/api/credential-auth.js +7 -0
  38. package/dist/middleware/auth/routes/api/credential-auth.js.map +1 -1
  39. package/dist/services/api/credentials.d.ts +40 -1
  40. package/dist/services/api/credentials.d.ts.map +1 -1
  41. package/dist/services/api/credentials.js +371 -7
  42. package/dist/services/api/credentials.js.map +1 -1
  43. package/dist/services/connectors/resource.d.ts +6 -1
  44. package/dist/services/connectors/resource.d.ts.map +1 -1
  45. package/dist/services/connectors/resource.js +7 -0
  46. package/dist/services/connectors/resource.js.map +1 -1
  47. package/dist/services/identity/abstract.d.ts +3 -1
  48. package/dist/services/identity/abstract.d.ts.map +1 -1
  49. package/dist/services/identity/abstract.js +6 -0
  50. package/dist/services/identity/abstract.js.map +1 -1
  51. package/dist/services/identity/index.d.ts +3 -1
  52. package/dist/services/identity/index.d.ts.map +1 -1
  53. package/dist/services/identity/index.js.map +1 -1
  54. package/dist/services/identity/providers/dock/identity.d.ts +1 -0
  55. package/dist/services/identity/providers/dock/identity.d.ts.map +1 -1
  56. package/dist/services/identity/providers/dock/identity.js +51 -15
  57. package/dist/services/identity/providers/dock/identity.js.map +1 -1
  58. package/dist/services/identity/providers/studio/postgres.d.ts +1 -0
  59. package/dist/services/identity/providers/studio/postgres.d.ts.map +1 -1
  60. package/dist/services/identity/providers/studio/postgres.js +38 -2
  61. package/dist/services/identity/providers/studio/postgres.js.map +1 -1
  62. package/dist/static/swagger-api.json +457 -47
  63. package/dist/types/credential-status.d.ts +7 -0
  64. package/dist/types/credential-status.d.ts.map +1 -1
  65. package/dist/types/credential.d.ts +57 -1
  66. package/dist/types/credential.d.ts.map +1 -1
  67. package/dist/types/swagger-api-types.d.ts +143 -20
  68. package/dist/types/swagger-api-types.d.ts.map +1 -1
  69. package/dist/types/swagger-api-types.js +143 -20
  70. package/dist/types/swagger-api-types.js.map +1 -1
  71. package/dist/types/validation.d.ts +0 -6
  72. package/dist/types/validation.d.ts.map +1 -1
  73. package/package.json +2 -2
@@ -12,6 +12,13 @@ export class CredentialAuthRuleProvider extends AuthRuleProvider {
12
12
  this.registerRule('/credential/suspend', 'POST', 'suspend:credential:mainnet');
13
13
  this.registerRule('/credential/reinstate', 'POST', 'reinstate:credential:testnet');
14
14
  this.registerRule('/credential/reinstate', 'POST', 'reinstate:credential:mainnet');
15
+ // Issued Credentials Tracking API
16
+ this.registerRule('/credentials/issued', 'GET', 'list:credential:testnet', { skipNamespace: true });
17
+ this.registerRule('/credentials/issued', 'GET', 'list:credential:mainnet', { skipNamespace: true });
18
+ this.registerRule('/credentials/issued/(.*)', 'GET', 'list:credential:testnet', { skipNamespace: true });
19
+ this.registerRule('/credentials/issued/(.*)', 'GET', 'list:credential:mainnet', { skipNamespace: true });
20
+ this.registerRule('/credentials/issued/(.*)', 'PUT', 'update:credential:testnet', { skipNamespace: true });
21
+ this.registerRule('/credentials/issued/(.*)', 'PUT', 'update:credential:mainnet', { skipNamespace: true });
15
22
  // Unauthorized routes
16
23
  this.registerRule('/credential/verify', 'POST', '', { allowUnauthorized: true, skipNamespace: true });
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"credential-auth.js","sourceRoot":"","sources":["../../../../../src/middleware/auth/routes/api/credential-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IAC/D;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,MAAM,EAAE,0BAA0B,CAAC,CAAC;QAC3E,IAAI,CAA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IAAI,CAAC,YAAY,CAAC,0BAA0B,EAAE,KAAK,EAAE,2BAA2B,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3G,IAAI,CAAC,YAAY,CAAC,0BAA0B,EAAE,KAAK,EAAE,2BAA2B,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3G,sBAAsB;QACtB,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACvG,CAAC;CACD"}
@@ -1,8 +1,47 @@
1
1
  import type { VerifiableCredential } from '@veramo/core';
2
- import { type CredentialRequest } from '../../types/credential.js';
2
+ import { GetIssuedCredentialOptions, IssuedCredentialCreateOptions, IssuedCredentialResponse, ListCredentialRequestOptions, type CredentialRequest } from '../../types/credential.js';
3
3
  import type { CustomerEntity } from '../../database/entities/customer.entity.js';
4
+ import { IssuedCredentialEntity } from '../../database/entities/issued-credential.entity.js';
5
+ import { Repository } from 'typeorm';
4
6
  export declare class Credentials {
5
7
  static instance: Credentials;
8
+ repository: Repository<IssuedCredentialEntity>;
9
+ constructor();
6
10
  issue_credential(request: CredentialRequest, customer: CustomerEntity): Promise<VerifiableCredential>;
11
+ /**
12
+ * List issued credentials with pagination and filtering
13
+ */
14
+ list(customer: CustomerEntity, options?: ListCredentialRequestOptions): Promise<{
15
+ credentials: IssuedCredentialResponse[];
16
+ total: number;
17
+ }>;
18
+ /**
19
+ * Get a single issued credential by ID with optional credential payload
20
+ */
21
+ get(id: string, customer: CustomerEntity, options?: GetIssuedCredentialOptions): Promise<IssuedCredentialResponse | null>;
22
+ /**
23
+ * Create a new issued credential record
24
+ */
25
+ create(customer: CustomerEntity, options: IssuedCredentialCreateOptions): Promise<IssuedCredentialEntity>;
26
+ /**
27
+ * Update credential status
28
+ */
29
+ updateStatus(issuedCredentialId: string, status: 'issued' | 'suspended' | 'revoked', customer: CustomerEntity): Promise<boolean>;
30
+ /**
31
+ * Update credential metadata
32
+ */
33
+ update(issuedCredentialId: string, updateData: Partial<Pick<IssuedCredentialEntity, 'providerCredentialId' | 'status' | 'metadata'>>, customer: CustomerEntity): Promise<IssuedCredentialResponse | null>;
34
+ /**
35
+ * Convert entity to API response format
36
+ */
37
+ private toResponse;
38
+ /**
39
+ * Sync credential status from provider API
40
+ */
41
+ private syncStatusFromProvider;
42
+ /**
43
+ * Fetch full credential from provider
44
+ */
45
+ private fetchCredentialFromProvider;
7
46
  }
8
47
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/services/api/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAIzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAQjF,qBAAa,WAAW;IACvB,OAAc,QAAQ,cAAqB;IAErC,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAmG3G"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/services/api/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAEN,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAIjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EAAqC,UAAU,EAAE,MAAM,SAAS,CAAC;AASxE,qBAAa,WAAW;IACvB,OAAc,QAAQ,cAAqB;IACpC,UAAU,EAAE,UAAU,CAAC,sBAAsB,CAAC,CAAC;;IAMhD,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAwK3G;;OAEG;IACG,IAAI,CACT,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,4BAAiC,GACxC,OAAO,CAAC;QAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IA0BtE;;OAEG;IACG,GAAG,CACR,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,0BAA+B,GACtC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAiE3C;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAqB/G;;OAEG;IACG,YAAY,CACjB,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,EAC1C,QAAQ,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,CAAC;IAenB;;OAEG;IACG,MAAM,CACX,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC,CAAC,EACjG,QAAQ,EAAE,cAAc,GACtB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;IA+C3C;;OAEG;IACH,OAAO,CAAC,UAAU;IAqClB;;OAEG;YACW,sBAAsB;IAiEpC;;OAEG;YACW,2BAA2B;CAoCzC"}
@@ -1,17 +1,25 @@
1
1
  import { VC_CONTEXT, VC_TYPE } from '../../types/constants.js';
2
- import { CredentialConnectors } from '../../types/credential.js';
2
+ import { CredentialConnectors, } from '../../types/credential.js';
3
3
  import { IdentityServiceStrategySetup } from '../identity/index.js';
4
4
  import { v4 } from 'uuid';
5
5
  import * as dotenv from 'dotenv';
6
6
  import { VeridaDIDValidator } from '../../controllers/validator/did.js';
7
7
  import { ResourceConnector } from '../connectors/resource.js';
8
8
  import { DockIdentityService } from '../identity/providers/index.js';
9
+ import { IssuedCredentialEntity } from '../../database/entities/issued-credential.entity.js';
10
+ import { LessThanOrEqual } from 'typeorm';
11
+ import { Connection } from '../../database/connection/connection.js';
12
+ import { validate as uuidValidate } from 'uuid';
9
13
  dotenv.config();
10
14
  const { ENABLE_VERIDA_CONNECTOR } = process.env;
11
15
  export class Credentials {
12
16
  static instance = new Credentials();
17
+ repository;
18
+ constructor() {
19
+ this.repository = Connection.instance.dbConnection.getRepository(IssuedCredentialEntity);
20
+ }
13
21
  async issue_credential(request, customer) {
14
- const { attributes, credentialName, credentialSummary, credentialSchema, issuerDid, subjectDid, type, expirationDate, credentialStatus, '@context': context, format, connector, credentialId, providerId, ...additionalData } = request;
22
+ const { attributes, credentialName, credentialSummary, credentialSchema, issuerDid, subjectDid, type, expirationDate, credentialStatus, '@context': context, format, connector, credentialId, providerId, category, ...additionalData } = request;
15
23
  const credential = {
16
24
  '@context': [...(context || []), ...VC_CONTEXT],
17
25
  type: [...new Set([...(type || []), VC_TYPE])],
@@ -30,7 +38,7 @@ export class Credentials {
30
38
  const statusOptions = credentialStatus || null;
31
39
  // Handle credential issuance and connector logic
32
40
  switch (providerId || connector) {
33
- case CredentialConnectors.Dock:
41
+ case CredentialConnectors.Dock: {
34
42
  const dock = new DockIdentityService();
35
43
  // validate issuerDid in provider
36
44
  const existingIssuer = await dock.getDid(issuerDid, customer).catch(() => undefined);
@@ -40,13 +48,39 @@ export class Credentials {
40
48
  // import into provider
41
49
  await dock.importDidV2(issuerDid, exportResult, process.env.PROVIDER_EXPORT_PASSWORD, customer);
42
50
  }
43
- return await dock.createCredential(credential, format, statusOptions, customer);
51
+ const dockCredential = await dock.createCredential(credential, format, statusOptions, customer);
52
+ const credentialType = Array.isArray(dockCredential.type)
53
+ ? dockCredential.type
54
+ : [dockCredential.type || 'VerifiableCredential'];
55
+ // Create IssuedCredentialEntity record
56
+ await this.create(customer, {
57
+ providerId: 'dock',
58
+ providerCredentialId: dockCredential.id,
59
+ issuerId: issuerDid,
60
+ subjectId: subjectDid,
61
+ format: (format || 'jwt'),
62
+ type: credentialType,
63
+ category: category,
64
+ status: 'issued',
65
+ issuedAt: dockCredential.issuanceDate ? new Date(dockCredential.issuanceDate) : new Date(),
66
+ expiresAt: dockCredential.expirationDate ? new Date(dockCredential.expirationDate) : undefined,
67
+ credentialStatus: dockCredential.credentialStatus,
68
+ metadata: {
69
+ schema: dockCredential.credentialSchema,
70
+ proof: dockCredential.proof,
71
+ termsOfUse: additionalData.termsOfUse,
72
+ contexts: [...(context || []), ...VC_CONTEXT],
73
+ },
74
+ });
75
+ return dockCredential;
76
+ }
44
77
  case CredentialConnectors.Resource:
45
78
  case CredentialConnectors.Studio:
46
79
  case CredentialConnectors.Verida:
47
- default:
80
+ default: {
48
81
  const verifiable_credential = await new IdentityServiceStrategySetup(customer.customerId).agent.createCredential(credential, format, statusOptions, customer);
49
82
  const isVeridaDid = new VeridaDIDValidator().validate(subjectDid);
83
+ let sendCredentialResponse;
50
84
  if (ENABLE_VERIDA_CONNECTOR === 'true' &&
51
85
  connector === CredentialConnectors.Verida &&
52
86
  isVeridaDid.valid &&
@@ -55,12 +89,342 @@ export class Credentials {
55
89
  throw new Error('Credential schema is required');
56
90
  // dynamic import to avoid circular dependency
57
91
  const { VeridaService } = await import('../connectors/verida.js');
58
- await VeridaService.instance.sendCredential(isVeridaDid.namespace, subjectDid, 'New Verifiable Credential', verifiable_credential, credentialName || v4(), credentialSchema, credentialSummary);
92
+ sendCredentialResponse = await VeridaService.instance.sendCredential(isVeridaDid.namespace, subjectDid, 'New Verifiable Credential', verifiable_credential, credentialName || v4(), credentialSchema, credentialSummary);
59
93
  }
60
94
  else if (connector && connector === CredentialConnectors.Resource) {
61
- await ResourceConnector.instance.sendCredential(customer, issuerDid, verifiable_credential, credentialName || v4(), type ? type[0] : 'VerifiableCredential', v4(), undefined, credentialId);
95
+ sendCredentialResponse = await ResourceConnector.instance.sendCredential(customer, issuerDid, verifiable_credential, credentialName || v4(), type ? type[0] : 'VerifiableCredential', v4(), undefined, credentialId);
96
+ }
97
+ // Create IssuedCredentialEntity record for Studio/Resource credentials
98
+ // Get resourceId from ResourceConnector response if available
99
+ let providerCredentialId;
100
+ if (sendCredentialResponse && sendCredentialResponse.resourceId) {
101
+ providerCredentialId = sendCredentialResponse.resourceId;
102
+ }
103
+ else {
104
+ providerCredentialId = verifiable_credential.id;
62
105
  }
106
+ const credentialType = Array.isArray(verifiable_credential.type)
107
+ ? verifiable_credential.type
108
+ : [verifiable_credential.type || 'VerifiableCredential'];
109
+ await this.create(customer, {
110
+ providerId: 'studio',
111
+ providerCredentialId,
112
+ issuerId: issuerDid,
113
+ subjectId: subjectDid,
114
+ format: (format || 'jsonld'),
115
+ type: credentialType,
116
+ category: category,
117
+ status: 'issued',
118
+ issuedAt: verifiable_credential.issuanceDate
119
+ ? new Date(verifiable_credential.issuanceDate)
120
+ : new Date(),
121
+ expiresAt: verifiable_credential.expirationDate
122
+ ? new Date(verifiable_credential.expirationDate)
123
+ : undefined,
124
+ credentialStatus: verifiable_credential.credentialStatus,
125
+ metadata: {
126
+ schema: verifiable_credential.credentialSchema,
127
+ proof: verifiable_credential.proof,
128
+ resourceType: sendCredentialResponse?.resourceType,
129
+ didUrl: sendCredentialResponse?.didUrl,
130
+ termsOfUse: additionalData.termsOfUse,
131
+ contexts: [...(context || []), ...VC_CONTEXT],
132
+ },
133
+ });
63
134
  return verifiable_credential;
135
+ }
136
+ }
137
+ }
138
+ /**
139
+ * List issued credentials with pagination and filtering
140
+ */
141
+ async list(customer, options = {}) {
142
+ const { page = 1, limit = 10, providerId, issuerId, subjectId, status, format, createdAt, category } = options;
143
+ const where = {
144
+ customer: { customerId: customer.customerId },
145
+ };
146
+ if (providerId)
147
+ where.providerId = providerId;
148
+ if (issuerId)
149
+ where.issuerId = issuerId;
150
+ if (subjectId)
151
+ where.subjectId = subjectId;
152
+ if (status)
153
+ where.status = status;
154
+ if (format)
155
+ where.format = format;
156
+ if (createdAt)
157
+ where.createdAt = LessThanOrEqual(new Date(createdAt));
158
+ if (category)
159
+ where.category = category;
160
+ const [entities, total] = await this.repository.findAndCount({
161
+ where,
162
+ order: { createdAt: 'DESC' },
163
+ skip: (page - 1) * limit,
164
+ take: limit,
165
+ });
166
+ const credentials = entities.map((entity) => this.toResponse(entity, { includeCredential: false }));
167
+ return { credentials, total };
168
+ }
169
+ /**
170
+ * Get a single issued credential by ID with optional credential payload
171
+ */
172
+ async get(id, customer, options = {}) {
173
+ const { includeCredential = false, syncStatus = false, providerId } = options;
174
+ // Try multiple lookup strategies
175
+ let entity = null;
176
+ // Strategy 1: Try as issuedCredentialId (UUID)
177
+ if (uuidValidate(id)) {
178
+ entity = await this.repository.findOne({
179
+ where: {
180
+ issuedCredentialId: id,
181
+ customer: { customerId: customer.customerId },
182
+ },
183
+ relations: ['customer'],
184
+ });
185
+ }
186
+ // Strategy 2: Try as providerCredentialId with provider hint
187
+ if (!entity && providerId) {
188
+ entity = await this.repository.findOne({
189
+ where: {
190
+ providerCredentialId: id,
191
+ providerId: providerId,
192
+ customer: { customerId: customer.customerId },
193
+ },
194
+ relations: ['customer'],
195
+ });
196
+ }
197
+ // Strategy 3: Search across all provider fields
198
+ if (!entity) {
199
+ entity = await this.repository.findOne({
200
+ where: {
201
+ providerCredentialId: id,
202
+ customer: { customerId: customer.customerId },
203
+ },
204
+ relations: ['customer'],
205
+ });
206
+ }
207
+ if (!entity) {
208
+ return null;
209
+ }
210
+ // Sync status from provider if requested
211
+ if (syncStatus) {
212
+ await this.syncStatusFromProvider(entity);
213
+ // Reload entity from database to get updated status
214
+ const updatedEntity = await this.repository.findOne({
215
+ where: {
216
+ issuedCredentialId: entity.issuedCredentialId,
217
+ },
218
+ relations: ['customer'],
219
+ });
220
+ if (updatedEntity) {
221
+ entity = updatedEntity;
222
+ }
223
+ }
224
+ // Optionally include full credential
225
+ let credential = null;
226
+ if (includeCredential) {
227
+ credential = await this.fetchCredentialFromProvider(entity);
228
+ }
229
+ return this.toResponse(entity, { includeCredential, credential: credential ?? undefined });
230
+ }
231
+ /**
232
+ * Create a new issued credential record
233
+ */
234
+ async create(customer, options) {
235
+ const entity = this.repository.create({
236
+ providerId: options.providerId,
237
+ providerCredentialId: options.providerCredentialId,
238
+ issuerId: options.issuerId,
239
+ subjectId: options.subjectId,
240
+ format: options.format,
241
+ category: options.category || 'credential',
242
+ type: options.type,
243
+ status: options.status || 'issued',
244
+ statusUpdatedAt: options.statusUpdatedAt,
245
+ issuedAt: options.issuedAt,
246
+ expiresAt: options.expiresAt,
247
+ credentialStatus: options.credentialStatus,
248
+ metadata: options.metadata,
249
+ customer: customer,
250
+ });
251
+ return await this.repository.save(entity);
252
+ }
253
+ /**
254
+ * Update credential status
255
+ */
256
+ async updateStatus(issuedCredentialId, status, customer) {
257
+ const result = await this.repository.update({
258
+ issuedCredentialId,
259
+ customer: { customerId: customer.customerId },
260
+ }, {
261
+ status,
262
+ statusUpdatedAt: new Date(),
263
+ });
264
+ return (result.affected ?? 0) > 0;
265
+ }
266
+ /**
267
+ * Update credential metadata
268
+ */
269
+ async update(issuedCredentialId, updateData, customer) {
270
+ // Ensure the credential belongs to this customer
271
+ const entity = await this.repository.findOne({
272
+ where: {
273
+ issuedCredentialId,
274
+ customer: { customerId: customer.customerId },
275
+ },
276
+ });
277
+ if (!entity) {
278
+ return null;
279
+ }
280
+ // Update the entity
281
+ const updatePayload = {
282
+ ...updateData,
283
+ updatedAt: new Date(),
284
+ };
285
+ // If status is being updated, also update statusUpdatedAt
286
+ if (updateData.status) {
287
+ updatePayload.statusUpdatedAt = new Date();
288
+ }
289
+ await this.repository.update({
290
+ issuedCredentialId,
291
+ customer: { customerId: customer.customerId },
292
+ }, updatePayload);
293
+ // Fetch and return the updated entity
294
+ const updatedEntity = await this.repository.findOne({
295
+ where: {
296
+ issuedCredentialId,
297
+ customer: { customerId: customer.customerId },
298
+ },
299
+ });
300
+ if (!updatedEntity) {
301
+ return null;
302
+ }
303
+ return this.toResponse(updatedEntity, {});
304
+ }
305
+ /**
306
+ * Convert entity to API response format
307
+ */
308
+ toResponse(entity, options) {
309
+ const response = {
310
+ issuedCredentialId: entity.issuedCredentialId,
311
+ providerId: entity.providerId,
312
+ providerCredentialId: entity.providerCredentialId,
313
+ issuerId: entity.issuerId,
314
+ subjectId: entity.subjectId,
315
+ format: entity.format,
316
+ category: entity.category,
317
+ type: entity.type,
318
+ status: entity.status,
319
+ statusUpdatedAt: entity.statusUpdatedAt?.toISOString(),
320
+ issuedAt: entity.issuedAt.toISOString(),
321
+ expiresAt: entity.expiresAt?.toISOString(),
322
+ credentialStatus: entity.credentialStatus,
323
+ createdAt: entity.createdAt?.toISOString(),
324
+ updatedAt: entity.updatedAt?.toISOString(),
325
+ };
326
+ // Add provider metadata (excluding internal migration info)
327
+ if (entity.metadata) {
328
+ const { migratedFrom, ...providerMetadata } = entity.metadata;
329
+ if (Object.keys(providerMetadata).length > 0) {
330
+ response.providerMetadata = providerMetadata;
331
+ }
332
+ }
333
+ // Include credential if requested
334
+ if (options.includeCredential && options.credential) {
335
+ response.credential = options.credential;
336
+ }
337
+ return response;
338
+ }
339
+ /**
340
+ * Sync credential status from provider API
341
+ */
342
+ async syncStatusFromProvider(entity) {
343
+ try {
344
+ const customer = entity.customer;
345
+ if (!customer) {
346
+ console.error('Customer not found for credential', entity.issuedCredentialId);
347
+ return;
348
+ }
349
+ const credentialId = entity.providerCredentialId;
350
+ if (!credentialId) {
351
+ console.error('Provider credential ID not found', entity.issuedCredentialId);
352
+ return;
353
+ }
354
+ let newStatus = null;
355
+ switch (entity.providerId) {
356
+ case 'dock': {
357
+ // For Dock, fetch credential and check credentialStatus
358
+ const credential = await this.fetchCredentialFromProvider(entity);
359
+ if (credential) {
360
+ // TODO: Implement full status list resolution when revocationRegistry is used
361
+ newStatus = credential.revoked ? 'revoked' : 'issued';
362
+ }
363
+ break;
364
+ }
365
+ case 'studio': {
366
+ // For Studio, use checkStatusList function when credentialStatus field exists in database
367
+ if (entity.credentialStatus) {
368
+ const status = entity.credentialStatus;
369
+ const studioService = new IdentityServiceStrategySetup(customer.customerId);
370
+ // TODO: Implement checkBitstringStatusList as part of credential Status check
371
+ const currentStatus = await studioService.agent.checkBitstringStatusList(status, customer);
372
+ newStatus = currentStatus.revoked
373
+ ? 'revoked'
374
+ : currentStatus.suspended
375
+ ? 'suspended'
376
+ : 'issued';
377
+ }
378
+ break;
379
+ }
380
+ default:
381
+ console.log(`Status sync not supported for provider: ${entity.providerId}`);
382
+ return;
383
+ }
384
+ // Update the entity status if it changed
385
+ if (newStatus && newStatus !== entity.status) {
386
+ console.log(`Updating credential ${entity.issuedCredentialId} status from ${entity.status} to ${newStatus}`);
387
+ await this.updateStatus(entity.issuedCredentialId, newStatus, customer);
388
+ }
389
+ }
390
+ catch (error) {
391
+ console.error(`Failed to sync status from provider ${entity.providerId}:`, error instanceof Error ? error.message : error);
392
+ }
393
+ }
394
+ /**
395
+ * Fetch full credential from provider
396
+ */
397
+ async fetchCredentialFromProvider(entity) {
398
+ try {
399
+ const customer = entity.customer;
400
+ if (!customer) {
401
+ console.error('Customer not found for credential', entity.issuedCredentialId);
402
+ return null;
403
+ }
404
+ // Use providerCredentialId to fetch from the appropriate provider
405
+ const credentialId = entity.providerCredentialId;
406
+ if (!credentialId) {
407
+ console.error('Provider credential ID not found', entity.issuedCredentialId);
408
+ return null;
409
+ }
410
+ console.log(`Fetching credential from provider ${entity.providerId} with ID ${credentialId}`);
411
+ switch (entity.providerId) {
412
+ case 'dock': {
413
+ const dockService = new DockIdentityService();
414
+ return await dockService.getCredential(credentialId, customer);
415
+ }
416
+ case 'studio': {
417
+ const studioService = new IdentityServiceStrategySetup(customer.customerId);
418
+ return await studioService.agent.getCredential(credentialId, customer);
419
+ }
420
+ default:
421
+ console.log(`Credential fetch not supported for provider: ${entity.providerId}`);
422
+ return null;
423
+ }
424
+ }
425
+ catch (error) {
426
+ console.error(`Failed to fetch credential from provider ${entity.providerId}:`, error instanceof Error ? error.message : error);
427
+ return null;
64
428
  }
65
429
  }
66
430
  }
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/services/api/credentials.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEhD,MAAM,OAAO,WAAW;IAChB,MAAM,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;IAE3C,KAAK,CAAC,gBAAgB,CAAC,OAA0B,EAAE,QAAwB;QAC1E,MAAM,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,UAAU,EAAE,OAAO,EACnB,MAAM,EACN,SAAS,EACT,YAAY,EACZ,UAAU,EACV,GAAG,cAAc,EACjB,GAAG,OAAO,CAAC;QAEZ,MAAM,UAAU,GAAsB;YACr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AW,GAAG,IAAI,mBAAmB,EAAE,CAAC;oBAC9C,OAAO,MAAM,WAAW,CAAC,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;gBAChE,CAAC;gBACD,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACf,MAAM,aAAa,GAAG,IAAI,4BAA4B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;oBAC5E,OAAO,MAAM,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;gBACxE,CAAC;gBACD;oBACC,OAAO,CAAC,GAAG,CAAC,gDAAgD,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;oBACjF,OAAO,IAAI,CAAC;YACd,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CACZ,4CAA4C,MAAM,CAAC,UAAU,GAAG,EAChE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC"}
@@ -17,6 +17,11 @@ export declare class ResourceConnector {
17
17
  * @param credentialName The name of the credential. For instance, will be displayed in the Verida Wallet UI.
18
18
  * @param credentialSummary A summary of the credential. For instance, will be displayed in the Verida Wallet UI.
19
19
  */
20
- sendCredential(customer: CustomerEntity, did: string, credential: VerifiableCredential, credentialName: string, resourceType: string, resourceVersion: string, alsoKnownAs?: AlternativeUri[], credentialId?: string): Promise<void>;
20
+ sendCredential(customer: CustomerEntity, did: string, credential: VerifiableCredential, credentialName: string, resourceType: string, resourceVersion: string, alsoKnownAs?: AlternativeUri[], credentialId?: string): Promise<{
21
+ success: any;
22
+ resourceId: string | undefined;
23
+ resourceType: string | undefined;
24
+ didUrl: string;
25
+ }>;
21
26
  }
22
27
  //# sourceMappingURL=resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/services/connectors/resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,mCAAmC,CAAC;AAElG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAQjF;;;;GAIG;AACH,qBAAa,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,oBAA2B;IAE1C;;;;;;;;OAQG;IACG,cAAc,CACnB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,oBAAoB,EAChC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,cAAc,EAAE,EAC9B,YAAY,CAAC,EAAE,MAAM;CA4CtB"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/services/connectors/resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,mCAAmC,CAAC;AAElG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAQjF;;;;GAIG;AACH,qBAAa,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,oBAA2B;IAE1C;;;;;;;;OAQG;IACG,cAAc,CACnB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,oBAAoB,EAChC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,cAAc,EAAE,EAC9B,YAAY,CAAC,EAAE,MAAM;;;;;;CAkDtB"}
@@ -36,6 +36,7 @@ export class ResourceConnector {
36
36
  alsoKnownAs,
37
37
  };
38
38
  const isPublished = await identityServiceStrategySetup.agent.createResource(did.split(':')[2], resourcePayload, customer);
39
+ const didUrl = `${did}/resources/${resourcePayload.id}`;
39
40
  if (isPublished) {
40
41
  const url = new URL(`${process.env.RESOLVER_URL || DefaultResolverUrl}${did}?` +
41
42
  `resourceId=${resourcePayload.id}&resourceMetadata=true`);
@@ -54,6 +55,12 @@ export class ResourceConnector {
54
55
  // track resource creation
55
56
  eventTracker.emit('track', trackResourceInfo);
56
57
  }
58
+ return {
59
+ success: isPublished,
60
+ resourceId: resourcePayload.id,
61
+ resourceType: resourcePayload.resourceType,
62
+ didUrl: didUrl,
63
+ };
57
64
  }
58
65
  }
59
66
  //# sourceMappingURL=resource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/services/connectors/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,2BAA2B,CAAC;AAC/F,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAE1C;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CACnB,QAAwB,EACxB,GAAW,EACX,UAAgC,EAChC,cAAsB,EACtB,YAAoB,EACpB,eAAuB,EACvB,WAA8B,EAC9B,YAAqB;QAErB,sCAAsC;QACtC,MAAM,4BAA4B,GAAG,IAAI,4BAA4B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;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AAC,CAAC,CAAC,EACjB,eAAe,EACf,QAAQ,CACR,CAAC;QACF,MAAM,MAAM,GAAG,GAAG,GAAG,cAAc,eAAe,CAAC,EAAE,EAAE,CAAC;QACxD,IAAI,WAAW,EAAE,CAAC;YACjB,MAAM,GAAG,GAAG,IAAI,GAAG,CAClB,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,kBAAkB,GAAG,GAAG,GAAG;gBACzD,cAAc,eAAe,CAAC,EAAE,wBAAwB,CACzD,CAAC;YACF,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAmC,CAAC;YAC7F,MAAM,QAAQ,GAAG,gBAAgB,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAE5E,0BAA0B;YAC1B,MAAM,iBAAiB,GAAG;gBACzB,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;gBAC5C,IAAI,EAAE,iBAAiB,CAAC,eAAe;gBACvC,QAAQ,EAAE,QAAQ;gBAClB,IAAI,EAAE;oBACL,GAAG;oBACH,QAAQ,EAAE,QAAQ;iBACO;aACP,CAAC;YAErB,0BAA0B;YAC1B,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO;YACN,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,eAAe,CAAC,EAAE;YAC9B,YAAY,EAAE,eAAe,CAAC,YAAY;YAC1C,MAAM,EAAE,MAAM;SACd,CAAC;IACH,CAAC"}
@@ -2,7 +2,7 @@ import type { CredentialPayload, DIDDocument, DIDResolutionResult, IIdentifier,
2
2
  import type { ResourcePayload, BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateStatusList2021Result, RevocationResult, StatusCheckResult, SuspensionResult, UnsuspensionResult, TransactionResult, CreateStatusListResult, BulkBitstringUpdateResult, BitstringUpdateResult } from '@cheqd/did-provider-cheqd';
3
3
  import type { VeramoAgent } from '../../types/shared';
4
4
  import type { VerificationOptions } from '../../types/shared';
5
- import type { CreateEncryptedBitstringOptions, CreateUnencryptedBitstringOptions, FeePaymentOptions, StatusListType } from '../../types/credential-status';
5
+ import type { CheqdCredentialStatus, CreateEncryptedBitstringOptions, CreateUnencryptedBitstringOptions, FeePaymentOptions, StatusListType } from '../../types/credential-status';
6
6
  import type { CredentialRequest, ListCredentialRequestOptions, ListCredentialResponse } from '../../types/credential';
7
7
  import type { CheckStatusListOptions } from '../../types/credential-status';
8
8
  import type { StatusOptions } from '../../types/credential-status';
@@ -38,11 +38,13 @@ export declare abstract class AbstractIdentityService implements IIdentityServic
38
38
  updateUnencryptedStatusList(did: string, listType: string, statusOptions: UpdateUnencryptedStatusListOptions, customer: CustomerEntity): Promise<BulkRevocationResult | BulkSuspensionResult | BulkUnsuspensionResult | BulkBitstringUpdateResult>;
39
39
  updateEncryptedStatusList(did: string, listType: string, statusOptions: UpdateEncryptedStatusListOptions, customer: CustomerEntity): Promise<BulkRevocationResult | BulkSuspensionResult | BulkUnsuspensionResult | BulkBitstringUpdateResult>;
40
40
  checkStatusList2021(did: string, statusOptions: CheckStatusListOptions, customer: CustomerEntity): Promise<StatusCheckResult>;
41
+ checkBitstringStatusList(statusOptions: CheqdCredentialStatus, customer: CustomerEntity): Promise<StatusCheckResult>;
41
42
  searchStatusList(did: string, statusListName: string, listType: StatusListType, statusPurpose: 'revocation' | 'suspension', customer?: CustomerEntity): Promise<any>;
42
43
  remunerateStatusList2021(feePaymentOptions: FeePaymentOptions, customer?: CustomerEntity): Promise<TransactionResult>;
43
44
  broadcastStatusList2021(did: string, resourceOptions: ResourcePayload, statusOptions: BroadcastStatusListOptions, customer: CustomerEntity): Promise<boolean>;
44
45
  broadcastBitstringStatusList(did: string, resourceOptions: ResourcePayload, customer: CustomerEntity): Promise<boolean>;
45
46
  listCredentials(options: ListCredentialRequestOptions, customer: CustomerEntity): Promise<ListCredentialResponse>;
47
+ getCredential(credentialId: string, customer: CustomerEntity): Promise<VerifiableCredential | null>;
46
48
  revokeCredentials(credential: W3CVerifiableCredential | W3CVerifiableCredential[], listType: string, publish: boolean, customer: CustomerEntity, symmetricKey: string): Promise<RevocationResult | BulkRevocationResult | BitstringUpdateResult | BulkBitstringUpdateResult>;
47
49
  suspendCredentials(credential: W3CVerifiableCredential | W3CVerifiableCredential[], listType: string, publish: boolean, customer: CustomerEntity, symmetricKey: string): Promise<SuspensionResult | BulkSuspensionResult | BitstringUpdateResult | BulkBitstringUpdateResult>;
48
50
  reinstateCredentials(credential: W3CVerifiableCredential | W3CVerifiableCredential[], listType: string, publish: boolean, customer: CustomerEntity, symmetricKey: string): Promise<UnsuspensionResult | BulkUnsuspensionResult | BitstringUpdateResult | BulkBitstringUpdateResult>;