@cheqd/studio 3.16.0-develop.11 → 3.16.0-develop.12

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/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/credential.d.ts +1 -1
  5. package/dist/controllers/api/credential.js +1 -1
  6. package/dist/controllers/api/received-credential.d.ts +342 -0
  7. package/dist/controllers/api/received-credential.d.ts.map +1 -0
  8. package/dist/controllers/api/received-credential.js +610 -0
  9. package/dist/controllers/api/received-credential.js.map +1 -0
  10. package/dist/database/entities/issued-credential.entity.d.ts +18 -2
  11. package/dist/database/entities/issued-credential.entity.d.ts.map +1 -1
  12. package/dist/database/entities/issued-credential.entity.js +29 -0
  13. package/dist/database/entities/issued-credential.entity.js.map +1 -1
  14. package/dist/database/migrations/1766408271347-studio-migrations.d.ts +7 -0
  15. package/dist/database/migrations/1766408271347-studio-migrations.d.ts.map +1 -0
  16. package/dist/database/migrations/1766408271347-studio-migrations.js +16 -0
  17. package/dist/database/migrations/1766408271347-studio-migrations.js.map +1 -0
  18. package/dist/database/types/types.d.ts.map +1 -1
  19. package/dist/database/types/types.js +2 -0
  20. package/dist/database/types/types.js.map +1 -1
  21. package/dist/middleware/auth/routes/api/credential-auth.d.ts.map +1 -1
  22. package/dist/middleware/auth/routes/api/credential-auth.js +12 -0
  23. package/dist/middleware/auth/routes/api/credential-auth.js.map +1 -1
  24. package/dist/services/api/credentials.d.ts.map +1 -1
  25. package/dist/services/api/credentials.js +38 -6
  26. package/dist/services/api/credentials.js.map +1 -1
  27. package/dist/services/api/received-credentials.d.ts +122 -0
  28. package/dist/services/api/received-credentials.d.ts.map +1 -0
  29. package/dist/services/api/received-credentials.js +439 -0
  30. package/dist/services/api/received-credentials.js.map +1 -0
  31. package/dist/services/identity/abstract.d.ts +4 -0
  32. package/dist/services/identity/abstract.d.ts.map +1 -1
  33. package/dist/services/identity/abstract.js +12 -0
  34. package/dist/services/identity/abstract.js.map +1 -1
  35. package/dist/services/identity/index.d.ts +22 -0
  36. package/dist/services/identity/index.d.ts.map +1 -1
  37. package/dist/services/identity/index.js.map +1 -1
  38. package/dist/services/identity/providers/studio/agent.d.ts +15 -0
  39. package/dist/services/identity/providers/studio/agent.d.ts.map +1 -1
  40. package/dist/services/identity/providers/studio/agent.js +51 -4
  41. package/dist/services/identity/providers/studio/agent.js.map +1 -1
  42. package/dist/services/identity/providers/studio/local.d.ts +4 -0
  43. package/dist/services/identity/providers/studio/local.d.ts.map +1 -1
  44. package/dist/services/identity/providers/studio/local.js +12 -0
  45. package/dist/services/identity/providers/studio/local.js.map +1 -1
  46. package/dist/services/identity/providers/studio/postgres.d.ts +7 -0
  47. package/dist/services/identity/providers/studio/postgres.d.ts.map +1 -1
  48. package/dist/services/identity/providers/studio/postgres.js +19 -0
  49. package/dist/services/identity/providers/studio/postgres.js.map +1 -1
  50. package/dist/static/swagger-api.json +479 -1
  51. package/package.json +1 -1
@@ -0,0 +1,610 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { StatusCodes } from 'http-status-codes';
8
+ import { check, param, query } from '../validator/index.js';
9
+ import { validate } from '../validator/decorator.js';
10
+ import { ReceivedCredentials } from '../../services/api/received-credentials.js';
11
+ export class ReceivedCredentialController {
12
+ static listOffersValidator = [
13
+ query('holderDid').optional().isDID().withMessage('Invalid holderDid format').bail(),
14
+ query('category')
15
+ .optional()
16
+ .isIn(['credential', 'accreditation'])
17
+ .withMessage('category must be either "credential" or "accreditation"')
18
+ .bail(),
19
+ query('page').optional().isInt({ min: 1 }).withMessage('page must be a positive integer').toInt().bail(),
20
+ query('limit')
21
+ .optional()
22
+ .isInt({ min: 1, max: 100 })
23
+ .withMessage('limit must be between 1 and 100')
24
+ .toInt()
25
+ .bail(),
26
+ ];
27
+ static getOfferValidator = [
28
+ param('credentialId')
29
+ .exists()
30
+ .withMessage('credentialId is required')
31
+ .bail()
32
+ .isUUID()
33
+ .withMessage('Invalid credentialId format')
34
+ .bail(),
35
+ query('holderDid')
36
+ .exists()
37
+ .withMessage('holderDid is required')
38
+ .bail()
39
+ .isDID()
40
+ .withMessage('Invalid holderDid format')
41
+ .bail(),
42
+ ];
43
+ static acceptOfferValidator = [
44
+ param('credentialId')
45
+ .exists()
46
+ .withMessage('credentialId is required')
47
+ .bail()
48
+ .isUUID()
49
+ .withMessage('Invalid credentialId format')
50
+ .bail(),
51
+ check('holderDid')
52
+ .exists()
53
+ .withMessage('holderDid is required')
54
+ .bail()
55
+ .isDID()
56
+ .withMessage('Invalid holderDid format')
57
+ .bail(),
58
+ check('createPresentation')
59
+ .optional()
60
+ .isBoolean()
61
+ .withMessage('createPresentation must be a boolean')
62
+ .toBoolean()
63
+ .bail(),
64
+ check('presentationDomain').optional().isString().withMessage('presentationDomain must be a string').bail(),
65
+ ];
66
+ static rejectOfferValidator = [
67
+ param('credentialId')
68
+ .exists()
69
+ .withMessage('credentialId is required')
70
+ .bail()
71
+ .isUUID()
72
+ .withMessage('Invalid credentialId format')
73
+ .bail(),
74
+ check('holderDid')
75
+ .exists()
76
+ .withMessage('holderDid is required')
77
+ .bail()
78
+ .isDID()
79
+ .withMessage('Invalid holderDid format')
80
+ .bail(),
81
+ ];
82
+ static importValidator = [
83
+ check('credential')
84
+ .exists()
85
+ .withMessage('credential is required')
86
+ .bail()
87
+ .custom((value) => {
88
+ // Check if it's a valid object or string
89
+ if (typeof value === 'string') {
90
+ return true; // JWT string
91
+ }
92
+ if (typeof value === 'object' && value !== null) {
93
+ return true; // JSON object
94
+ }
95
+ return false;
96
+ })
97
+ .withMessage('credential must be a valid JSON object or JWT string')
98
+ .bail(),
99
+ check('holderDid')
100
+ .exists()
101
+ .withMessage('holderDid is required')
102
+ .bail()
103
+ .isDID()
104
+ .withMessage('Invalid holderDid format')
105
+ .bail(),
106
+ ];
107
+ static listReceivedValidator = [
108
+ query('holderDid').optional().isDID().withMessage('Invalid holderDid format').bail(),
109
+ query('category')
110
+ .optional()
111
+ .isIn(['credential', 'accreditation'])
112
+ .withMessage('category must be either "credential" or "accreditation"')
113
+ .bail(),
114
+ ];
115
+ static getReceivedValidator = [
116
+ check('credentialHash')
117
+ .exists()
118
+ .withMessage('credentialHash is required')
119
+ .bail()
120
+ .isString()
121
+ .withMessage('credentialHash must be a string')
122
+ .bail(),
123
+ ];
124
+ /**
125
+ * @openapi
126
+ *
127
+ * /credentials/offers:
128
+ * get:
129
+ * tags: [ Credential Offers ]
130
+ * summary: List pending credential offers
131
+ * description: Retrieves a list of pending credential offers. If holderDid is not provided, returns all offers for all DIDs owned by the customer.
132
+ * parameters:
133
+ * - in: query
134
+ * name: holderDid
135
+ * required: false
136
+ * schema:
137
+ * type: string
138
+ * description: Optional DID of the credential holder. If not provided, returns offers for all customer DIDs.
139
+ * - in: query
140
+ * name: category
141
+ * required: false
142
+ * schema:
143
+ * type: string
144
+ * enum: [credential, accreditation]
145
+ * description: Optional category to filter by credential type
146
+ * - in: query
147
+ * name: page
148
+ * schema:
149
+ * type: integer
150
+ * minimum: 1
151
+ * default: 1
152
+ * description: Page number for pagination
153
+ * - in: query
154
+ * name: limit
155
+ * schema:
156
+ * type: integer
157
+ * minimum: 1
158
+ * maximum: 100
159
+ * default: 10
160
+ * description: Number of results per page
161
+ * responses:
162
+ * 200:
163
+ * description: List of pending credential offers
164
+ * content:
165
+ * application/json:
166
+ * schema:
167
+ * type: object
168
+ * properties:
169
+ * total:
170
+ * type: integer
171
+ * offers:
172
+ * type: array
173
+ * items:
174
+ * $ref: '#/components/schemas/IssuedCredentialResponse'
175
+ * page:
176
+ * type: integer
177
+ * limit:
178
+ * type: integer
179
+ * 400:
180
+ * $ref: '#/components/schemas/InvalidRequest'
181
+ * 401:
182
+ * $ref: '#/components/schemas/UnauthorizedError'
183
+ * 500:
184
+ * $ref: '#/components/schemas/InternalError'
185
+ */
186
+ async listOffers(request, response) {
187
+ try {
188
+ const { holderDid, category, page, limit } = request.query;
189
+ const customer = response.locals.customer;
190
+ const result = await ReceivedCredentials.instance.listPendingOffers({
191
+ holderDid: holderDid,
192
+ category: category,
193
+ page: page ? Number(page) : undefined,
194
+ limit: limit ? Number(limit) : undefined,
195
+ }, customer);
196
+ return response.status(StatusCodes.OK).json(result);
197
+ }
198
+ catch (error) {
199
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
200
+ error: `${error}`,
201
+ });
202
+ }
203
+ }
204
+ /**
205
+ * @openapi
206
+ *
207
+ * /credentials/offers/{credentialId}:
208
+ * get:
209
+ * tags: [ Credential Offers ]
210
+ * summary: Get credential offer details
211
+ * description: Retrieves detailed information about a specific credential offer
212
+ * parameters:
213
+ * - in: path
214
+ * name: credentialId
215
+ * required: true
216
+ * schema:
217
+ * type: string
218
+ * format: uuid
219
+ * description: ID of the credential offer
220
+ * - in: query
221
+ * name: holderDid
222
+ * required: true
223
+ * schema:
224
+ * type: string
225
+ * description: DID of the credential holder
226
+ * responses:
227
+ * 200:
228
+ * description: Credential offer details
229
+ * content:
230
+ * application/json:
231
+ * schema:
232
+ * $ref: '#/components/schemas/IssuedCredentialResponse'
233
+ * 400:
234
+ * $ref: '#/components/schemas/InvalidRequest'
235
+ * 401:
236
+ * $ref: '#/components/schemas/UnauthorizedError'
237
+ * 404:
238
+ * description: Credential offer not found
239
+ * 500:
240
+ * $ref: '#/components/schemas/InternalError'
241
+ */
242
+ async getOfferDetails(request, response) {
243
+ try {
244
+ const { credentialId } = request.params;
245
+ const { holderDid } = request.query;
246
+ const customer = response.locals.customer;
247
+ const offer = await ReceivedCredentials.instance.getOfferDetails(credentialId, holderDid, customer);
248
+ return response.status(StatusCodes.OK).json(offer);
249
+ }
250
+ catch (error) {
251
+ const errorMessage = `${error}`;
252
+ if (errorMessage.includes('not found') || errorMessage.includes('expired')) {
253
+ return response.status(StatusCodes.NOT_FOUND).json({
254
+ error: errorMessage,
255
+ });
256
+ }
257
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
258
+ error: errorMessage,
259
+ });
260
+ }
261
+ }
262
+ /**
263
+ * @openapi
264
+ *
265
+ * /credentials/offers/{credentialId}/accept:
266
+ * post:
267
+ * tags: [ Credential Offers ]
268
+ * summary: Accept a credential offer
269
+ * description: Accepts a pending credential offer. The credential is verified and status is updated to issued.
270
+ * parameters:
271
+ * - in: path
272
+ * name: credentialId
273
+ * required: true
274
+ * schema:
275
+ * type: string
276
+ * format: uuid
277
+ * description: ID of the credential offer to accept
278
+ * requestBody:
279
+ * required: true
280
+ * content:
281
+ * application/json:
282
+ * schema:
283
+ * type: object
284
+ * required:
285
+ * - holderDid
286
+ * properties:
287
+ * holderDid:
288
+ * type: string
289
+ * description: DID of the credential holder
290
+ * createPresentation:
291
+ * type: boolean
292
+ * default: false
293
+ * description: Whether to create a verifiable presentation
294
+ * presentationDomain:
295
+ * type: string
296
+ * description: Optional domain for the presentation
297
+ * responses:
298
+ * 200:
299
+ * description: Credential offer accepted successfully
300
+ * content:
301
+ * application/json:
302
+ * schema:
303
+ * type: object
304
+ * properties:
305
+ * success:
306
+ * type: boolean
307
+ * credential:
308
+ * type: object
309
+ * presentation:
310
+ * type: string
311
+ * description: JWT presentation (if createPresentation was true)
312
+ * 400:
313
+ * $ref: '#/components/schemas/InvalidRequest'
314
+ * 401:
315
+ * $ref: '#/components/schemas/UnauthorizedError'
316
+ * 404:
317
+ * description: Credential offer not found
318
+ * 500:
319
+ * $ref: '#/components/schemas/InternalError'
320
+ */
321
+ async acceptOffer(request, response) {
322
+ try {
323
+ const { credentialId } = request.params;
324
+ const { holderDid, createPresentation, presentationDomain } = request.body;
325
+ const customer = response.locals.customer;
326
+ const result = await ReceivedCredentials.instance.acceptOffer(credentialId, holderDid, customer, {
327
+ createPresentation,
328
+ presentationDomain,
329
+ });
330
+ return response.status(StatusCodes.OK).json(result);
331
+ }
332
+ catch (error) {
333
+ const errorMessage = `${error}`;
334
+ if (errorMessage.includes('not found') || errorMessage.includes('expired')) {
335
+ return response.status(StatusCodes.NOT_FOUND).json({
336
+ error: errorMessage,
337
+ });
338
+ }
339
+ if (errorMessage.includes('Invalid credential') || errorMessage.includes('does not match')) {
340
+ return response.status(StatusCodes.BAD_REQUEST).json({
341
+ error: errorMessage,
342
+ });
343
+ }
344
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
345
+ error: errorMessage,
346
+ });
347
+ }
348
+ }
349
+ /**
350
+ * @openapi
351
+ *
352
+ * /credentials/offers/{credentialId}/reject:
353
+ * post:
354
+ * tags: [ Credential Offers ]
355
+ * summary: Reject a credential offer
356
+ * description: Rejects a pending credential offer. The credential is deleted and status is updated to rejected.
357
+ * parameters:
358
+ * - in: path
359
+ * name: credentialId
360
+ * required: true
361
+ * schema:
362
+ * type: string
363
+ * format: uuid
364
+ * description: ID of the credential offer to reject
365
+ * requestBody:
366
+ * required: true
367
+ * content:
368
+ * application/json:
369
+ * schema:
370
+ * type: object
371
+ * required:
372
+ * - holderDid
373
+ * properties:
374
+ * holderDid:
375
+ * type: string
376
+ * description: DID of the credential holder
377
+ * responses:
378
+ * 200:
379
+ * description: Credential offer rejected successfully
380
+ * content:
381
+ * application/json:
382
+ * schema:
383
+ * type: object
384
+ * properties:
385
+ * success:
386
+ * type: boolean
387
+ * message:
388
+ * type: string
389
+ * 400:
390
+ * $ref: '#/components/schemas/InvalidRequest'
391
+ * 401:
392
+ * $ref: '#/components/schemas/UnauthorizedError'
393
+ * 404:
394
+ * description: Credential offer not found
395
+ * 500:
396
+ * $ref: '#/components/schemas/InternalError'
397
+ */
398
+ async rejectOffer(request, response) {
399
+ try {
400
+ const { credentialId } = request.params;
401
+ const { holderDid } = request.body;
402
+ const customer = response.locals.customer;
403
+ const result = await ReceivedCredentials.instance.rejectOffer(credentialId, holderDid, customer);
404
+ return response.status(StatusCodes.OK).json(result);
405
+ }
406
+ catch (error) {
407
+ const errorMessage = `${error}`;
408
+ if (errorMessage.includes('not found') || errorMessage.includes('expired')) {
409
+ return response.status(StatusCodes.NOT_FOUND).json({
410
+ error: errorMessage,
411
+ });
412
+ }
413
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
414
+ error: errorMessage,
415
+ });
416
+ }
417
+ }
418
+ /**
419
+ * @openapi
420
+ *
421
+ * /credentials/import:
422
+ * post:
423
+ * tags: [ Verifiable Credentials ]
424
+ * summary: Import an externally issued credential
425
+ * description: Imports a credential issued by a third party (not in Studio) and stores it in the holder's dataStore
426
+ * requestBody:
427
+ * required: true
428
+ * content:
429
+ * application/json:
430
+ * schema:
431
+ * type: object
432
+ * required:
433
+ * - credential
434
+ * - holderDid
435
+ * properties:
436
+ * credential:
437
+ * oneOf:
438
+ * - type: object
439
+ * description: Verifiable credential as JSON object
440
+ * - type: string
441
+ * description: Verifiable credential as JWT string
442
+ * holderDid:
443
+ * type: string
444
+ * description: DID of the credential holder
445
+ * responses:
446
+ * 200:
447
+ * description: Credential imported successfully
448
+ * content:
449
+ * application/json:
450
+ * schema:
451
+ * type: object
452
+ * properties:
453
+ * success:
454
+ * type: boolean
455
+ * credentialHash:
456
+ * type: string
457
+ * description: Hash of the stored credential
458
+ * credential:
459
+ * type: object
460
+ * description: The imported credential
461
+ * 400:
462
+ * $ref: '#/components/schemas/InvalidRequest'
463
+ * 401:
464
+ * $ref: '#/components/schemas/UnauthorizedError'
465
+ * 500:
466
+ * $ref: '#/components/schemas/InternalError'
467
+ */
468
+ async importCredential(request, response) {
469
+ try {
470
+ const { credential, holderDid } = request.body;
471
+ const customer = response.locals.customer;
472
+ const result = await ReceivedCredentials.instance.importCredential(credential, customer, holderDid);
473
+ return response.status(StatusCodes.OK).json(result);
474
+ }
475
+ catch (error) {
476
+ const errorMessage = `${error}`;
477
+ if (errorMessage.includes('Invalid credential') ||
478
+ errorMessage.includes('does not match') ||
479
+ errorMessage.includes('does not exist') ||
480
+ errorMessage.includes('does not have a valid')) {
481
+ return response.status(StatusCodes.BAD_REQUEST).json({
482
+ error: errorMessage,
483
+ });
484
+ }
485
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
486
+ error: errorMessage,
487
+ });
488
+ }
489
+ }
490
+ /**
491
+ * @openapi
492
+ *
493
+ * /credentials/received:
494
+ * get:
495
+ * tags: [ Verifiable Credentials ]
496
+ * summary: List received credentials
497
+ * description: Retrieves all credentials stored in the holder's dataStore (accepted offers + imported credentials)
498
+ * parameters:
499
+ * - in: query
500
+ * name: holderDid
501
+ * schema:
502
+ * type: string
503
+ * description: Optional DID to filter credentials by subject
504
+ * - in: query
505
+ * name: category
506
+ * required: false
507
+ * schema:
508
+ * type: string
509
+ * enum: [credential, accreditation]
510
+ * description: Optional category to filter by credential type. Note that imported credentials without IssuedCredentialEntity will be excluded when filtering by category.
511
+ * responses:
512
+ * 200:
513
+ * description: List of received credentials
514
+ * content:
515
+ * application/json:
516
+ * schema:
517
+ * type: array
518
+ * items:
519
+ * type: object
520
+ * description: Verifiable Credential
521
+ * 401:
522
+ * $ref: '#/components/schemas/UnauthorizedError'
523
+ * 500:
524
+ * $ref: '#/components/schemas/InternalError'
525
+ */
526
+ async listReceivedCredentials(request, response) {
527
+ try {
528
+ const { holderDid, category } = request.query;
529
+ const customer = response.locals.customer;
530
+ const credentials = await ReceivedCredentials.instance.listReceivedCredentials(customer, holderDid, category);
531
+ return response.status(StatusCodes.OK).json(credentials);
532
+ }
533
+ catch (error) {
534
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
535
+ error: `${error}`,
536
+ });
537
+ }
538
+ }
539
+ /**
540
+ * @openapi
541
+ *
542
+ * /credentials/received/{credentialHash}:
543
+ * get:
544
+ * tags: [ Verifiable Credentials ]
545
+ * summary: Get a specific received credential
546
+ * description: Retrieves a specific credential from the holder's dataStore by its hash
547
+ * parameters:
548
+ * - in: path
549
+ * name: credentialHash
550
+ * required: true
551
+ * schema:
552
+ * type: string
553
+ * description: Hash of the credential
554
+ * responses:
555
+ * 200:
556
+ * description: Received credential
557
+ * content:
558
+ * application/json:
559
+ * schema:
560
+ * type: object
561
+ * description: Verifiable Credential
562
+ * 401:
563
+ * $ref: '#/components/schemas/UnauthorizedError'
564
+ * 404:
565
+ * description: Credential not found
566
+ * 500:
567
+ * $ref: '#/components/schemas/InternalError'
568
+ */
569
+ async getReceivedCredential(request, response) {
570
+ try {
571
+ const { credentialHash } = request.params;
572
+ const customer = response.locals.customer;
573
+ const credential = await ReceivedCredentials.instance.getReceivedCredential(credentialHash, customer);
574
+ return response.status(StatusCodes.OK).json(credential);
575
+ }
576
+ catch (error) {
577
+ const errorMessage = `${error}`;
578
+ if (errorMessage.includes('not found')) {
579
+ return response.status(StatusCodes.NOT_FOUND).json({
580
+ error: errorMessage,
581
+ });
582
+ }
583
+ return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
584
+ error: errorMessage,
585
+ });
586
+ }
587
+ }
588
+ }
589
+ __decorate([
590
+ validate
591
+ ], ReceivedCredentialController.prototype, "listOffers", null);
592
+ __decorate([
593
+ validate
594
+ ], ReceivedCredentialController.prototype, "getOfferDetails", null);
595
+ __decorate([
596
+ validate
597
+ ], ReceivedCredentialController.prototype, "acceptOffer", null);
598
+ __decorate([
599
+ validate
600
+ ], ReceivedCredentialController.prototype, "rejectOffer", null);
601
+ __decorate([
602
+ validate
603
+ ], ReceivedCredentialController.prototype, "importCredential", null);
604
+ __decorate([
605
+ validate
606
+ ], ReceivedCredentialController.prototype, "listReceivedCredentials", null);
607
+ __decorate([
608
+ validate
609
+ ], ReceivedCredentialController.prototype, "getReceivedCredential", null);
610
+ //# sourceMappingURL=received-credential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"received-credential.js","sourceRoot":"","sources":["../../../src/controllers/api/received-credential.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,MAAM,OAAO,4BAA4B;IACjC,MAAM,CAAC,mBAAmB,GAAG;QACnC,KAAK,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,IAAI,EAAE;QACpF,KAAK,CAAC,UAAU,CAAC;aACf,QAAQ,EAAE;aACV,IAAI,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;aACrC,WAAW,CAAC,yDAAyD,CAAC;aACtE,IAAI,EAAE;QACR,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE;QACxG,KAAK,CAAC,OAAO,CAAC;aACZ,QAAQ,EAAE;aACV,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;aAC3B,WAAW,CAAC,iCAAiC,CAAC;aAC9C,KAAK,EAAE;aACP,IAAI,EAAE;KACR,CAAC;IAEK,MAAM,CAAC,iBAAiB,GAAG;QACjC,KAAK,CAAC,cAAc,CAAC;aACnB,MAAM,EAAE;aACR,WAAW,CAAC,0BAA0B,CAAC;aACvC,IAAI,EAAE;aACN,MAAM,EAAE;aACR,WAAW,CAAC,6B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AI,CAAC;YACJ,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;YAE1C,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAEtG,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,GAAG,KAAK,EAAE,CAAC;YAChC,IAAI,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACxC,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;oBAClD,KAAK,EAAE,YAAY;iBACnB,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC;gBAC9D,KAAK,EAAE,YAAY;aACnB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;;AAjbY;IADZ,QAAQ;8DAsBR;AAyCY;IADZ,QAAQ;mEAyBR;AA8DY;IADZ,QAAQ;+DA6BR;AAoDY;IADZ,QAAQ;+DAqBR;AAqDY;IADZ,QAAQ;oEAyBR;AAuCY;IADZ,QAAQ;2EAkBR;AAiCY;IADZ,QAAQ;yEAoBR"}
@@ -1,3 +1,4 @@
1
+ import { Credential } from '@veramo/data-store';
1
2
  import { CustomerEntity } from './customer.entity.js';
2
3
  import { CredentialProviderEntity } from './credential-provider.entity.js';
3
4
  import { StatusRegistryEntity } from './status-registry.entity.js';
@@ -15,7 +16,7 @@ export declare class IssuedCredentialEntity {
15
16
  format: 'jwt' | 'jsonld' | 'sd-jwt-vc' | 'anoncreds';
16
17
  category: 'credential' | 'accreditation';
17
18
  type: string[];
18
- status: 'issued' | 'suspended' | 'revoked' | 'unknown';
19
+ status: 'issued' | 'suspended' | 'revoked' | 'unknown' | 'offered' | 'rejected';
19
20
  statusUpdatedAt?: Date;
20
21
  metadata?: Record<string, any>;
21
22
  credentialStatus?: Record<string, any>;
@@ -24,19 +25,31 @@ export declare class IssuedCredentialEntity {
24
25
  lastError?: string;
25
26
  issuedAt: Date;
26
27
  expiresAt?: Date;
28
+ subjectAcceptedAt?: Date;
29
+ offerExpiresAt?: Date;
27
30
  createdAt?: Date;
28
31
  updatedAt?: Date;
29
32
  deprecated?: boolean;
30
33
  customer?: CustomerEntity;
31
34
  provider?: CredentialProviderEntity;
32
35
  statusRegistry?: StatusRegistryEntity;
36
+ /**
37
+ * Hash of the credential stored in Veramo's data store
38
+ * This is the foreign key that references the 'hash' column in Veramo's credential table
39
+ */
40
+ veramoHash?: string;
41
+ /**
42
+ * Reference to Veramo's credential table
43
+ * This links to the credential stored in Veramo's data store
44
+ */
45
+ veramoCredential?: Credential;
33
46
  addId(): void;
34
47
  constructor(providerId: string, format: 'jwt' | 'jsonld' | 'sd-jwt-vc' | 'anoncreds', category: 'credential' | 'accreditation', type: string[], issuedAt: Date, customer: CustomerEntity, options?: {
35
48
  issuedCredentialId?: string;
36
49
  providerCredentialId?: string;
37
50
  issuerId?: string;
38
51
  subjectId?: string;
39
- status?: 'issued' | 'suspended' | 'revoked';
52
+ status?: 'issued' | 'suspended' | 'revoked' | 'unknown' | 'offered' | 'rejected';
40
53
  statusUpdatedAt?: Date;
41
54
  metadata?: Record<string, any>;
42
55
  credentialStatus?: Record<string, any>;
@@ -45,6 +58,9 @@ export declare class IssuedCredentialEntity {
45
58
  retryCount?: number;
46
59
  lastError?: string;
47
60
  expiresAt?: Date;
61
+ subjectAcceptedAt?: Date;
62
+ offerExpiresAt?: Date;
63
+ veramoCredential?: Credential;
48
64
  deprecated?: boolean;
49
65
  });
50
66
  }