@sphereon/ssi-sdk.credential-store 0.33.1-next.3 → 0.33.1-next.73

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.
package/dist/index.cjs ADDED
@@ -0,0 +1,2056 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // plugin.schema.json
25
+ var require_plugin_schema = __commonJS({
26
+ "plugin.schema.json"(exports, module2) {
27
+ module2.exports = {
28
+ ICredentialStore: {
29
+ components: {
30
+ schemas: {
31
+ AddCredentialArgs: {
32
+ type: "object",
33
+ properties: {
34
+ credential: {
35
+ $ref: "#/components/schemas/AddDigitalCredential"
36
+ },
37
+ opts: {
38
+ type: "object",
39
+ properties: {
40
+ maxTimeSkewInMS: {
41
+ type: "number"
42
+ },
43
+ hasher: {
44
+ $ref: "#/components/schemas/HasherSync"
45
+ }
46
+ },
47
+ additionalProperties: false
48
+ }
49
+ },
50
+ required: ["credential"],
51
+ additionalProperties: false
52
+ },
53
+ AddDigitalCredential: {
54
+ $ref: '#/components/schemas/Omit<NonPersistedDigitalCredential,("id"|"documentType"|"documentFormat"|"uniformDocument"|"hash"|"createdAt"|"lastUpdatedAt"|"validFrom"|"validUntil")>'
55
+ },
56
+ 'Omit<NonPersistedDigitalCredential,("id"|"documentType"|"documentFormat"|"uniformDocument"|"hash"|"createdAt"|"lastUpdatedAt"|"validFrom"|"validUntil")>': {
57
+ $ref: '#/components/schemas/Pick<NonPersistedDigitalCredential,Exclude<("parentId"|"documentType"|"documentFormat"|"credentialRole"|"rawDocument"|"uniformDocument"|"credentialId"|"hash"|"kmsKeyRef"|"identifierMethod"|"issuerCorrelationType"|"subjectCorrelationType"|"rpCorrelationType"|"isIssuerSigned"|"issuerCorrelationId"|"subjectCorrelationId"|"rpCorrelationId"|"verifiedState"|"tenantId"|"createdAt"|"presentedAt"|"lastUpdatedAt"|"validUntil"|"validFrom"|"verifiedAt"|"revokedAt"|"regulationType"),("id"|"documentType"|"documentFormat"|"uniformDocument"|"hash"|"createdAt"|"lastUpdatedAt"|"validFrom"|"validUntil")>>'
58
+ },
59
+ 'Pick<NonPersistedDigitalCredential,Exclude<("parentId"|"documentType"|"documentFormat"|"credentialRole"|"rawDocument"|"uniformDocument"|"credentialId"|"hash"|"kmsKeyRef"|"identifierMethod"|"issuerCorrelationType"|"subjectCorrelationType"|"rpCorrelationType"|"isIssuerSigned"|"issuerCorrelationId"|"subjectCorrelationId"|"rpCorrelationId"|"verifiedState"|"tenantId"|"createdAt"|"presentedAt"|"lastUpdatedAt"|"validUntil"|"validFrom"|"verifiedAt"|"revokedAt"|"regulationType"),("id"|"documentType"|"documentFormat"|"uniformDocument"|"hash"|"createdAt"|"lastUpdatedAt"|"validFrom"|"validUntil")>>': {
60
+ type: "object",
61
+ properties: {
62
+ parentId: {
63
+ type: "string"
64
+ },
65
+ credentialRole: {
66
+ $ref: "#/components/schemas/CredentialRole"
67
+ },
68
+ rawDocument: {
69
+ type: "string"
70
+ },
71
+ credentialId: {
72
+ type: "string"
73
+ },
74
+ kmsKeyRef: {
75
+ type: "string"
76
+ },
77
+ identifierMethod: {
78
+ type: "string"
79
+ },
80
+ issuerCorrelationType: {
81
+ $ref: "#/components/schemas/CredentialCorrelationType"
82
+ },
83
+ subjectCorrelationType: {
84
+ $ref: "#/components/schemas/CredentialCorrelationType"
85
+ },
86
+ rpCorrelationType: {
87
+ $ref: "#/components/schemas/CredentialCorrelationType"
88
+ },
89
+ isIssuerSigned: {
90
+ type: "boolean"
91
+ },
92
+ issuerCorrelationId: {
93
+ type: "string"
94
+ },
95
+ subjectCorrelationId: {
96
+ type: "string"
97
+ },
98
+ rpCorrelationId: {
99
+ type: "string"
100
+ },
101
+ verifiedState: {
102
+ $ref: "#/components/schemas/CredentialStateType"
103
+ },
104
+ tenantId: {
105
+ type: "string"
106
+ },
107
+ presentedAt: {
108
+ type: "string",
109
+ format: "date-time"
110
+ },
111
+ verifiedAt: {
112
+ type: "string",
113
+ format: "date-time"
114
+ },
115
+ revokedAt: {
116
+ type: "string",
117
+ format: "date-time"
118
+ },
119
+ regulationType: {
120
+ $ref: "#/components/schemas/RegulationType"
121
+ }
122
+ },
123
+ required: ["credentialRole", "rawDocument", "issuerCorrelationType", "issuerCorrelationId"],
124
+ additionalProperties: false
125
+ },
126
+ CredentialRole: {
127
+ type: "string",
128
+ enum: ["ISSUER", "VERIFIER", "HOLDER", "FEDERATION_TRUST_ANCHOR"]
129
+ },
130
+ CredentialCorrelationType: {
131
+ type: "string",
132
+ enum: ["DID", "X509_SAN", "KID", "URL"]
133
+ },
134
+ CredentialStateType: {
135
+ type: "string",
136
+ enum: ["REVOKED", "VERIFIED", "EXPIRED"]
137
+ },
138
+ RegulationType: {
139
+ type: "string",
140
+ enum: ["PID", "QEAA", "EAA", "NON_REGULATED"]
141
+ },
142
+ HasherSync: {
143
+ $comment: "(data: string | ArrayBuffer, alg: string) => Uint8Array",
144
+ type: "object",
145
+ properties: {
146
+ namedArgs: {
147
+ type: "object",
148
+ properties: {
149
+ data: {
150
+ anyOf: [
151
+ {
152
+ type: "string"
153
+ },
154
+ {
155
+ $ref: "#/components/schemas/ArrayBuffer"
156
+ }
157
+ ]
158
+ },
159
+ alg: {
160
+ type: "string"
161
+ }
162
+ },
163
+ required: ["data", "alg"],
164
+ additionalProperties: false
165
+ }
166
+ }
167
+ },
168
+ ArrayBuffer: {
169
+ type: "object",
170
+ properties: {
171
+ byteLength: {
172
+ type: "number"
173
+ }
174
+ },
175
+ required: ["byteLength"],
176
+ additionalProperties: false
177
+ },
178
+ DigitalCredential: {
179
+ type: "object",
180
+ properties: {
181
+ id: {
182
+ type: "string"
183
+ },
184
+ parentId: {
185
+ type: "string"
186
+ },
187
+ documentType: {
188
+ $ref: "#/components/schemas/DocumentType"
189
+ },
190
+ documentFormat: {
191
+ $ref: "#/components/schemas/CredentialDocumentFormat"
192
+ },
193
+ credentialRole: {
194
+ $ref: "#/components/schemas/CredentialRole"
195
+ },
196
+ regulationType: {
197
+ $ref: "#/components/schemas/RegulationType"
198
+ },
199
+ rawDocument: {
200
+ type: "string"
201
+ },
202
+ uniformDocument: {
203
+ type: "string"
204
+ },
205
+ credentialId: {
206
+ type: "string"
207
+ },
208
+ hash: {
209
+ type: "string"
210
+ },
211
+ kmsKeyRef: {
212
+ type: "string"
213
+ },
214
+ identifierMethod: {
215
+ type: "string"
216
+ },
217
+ issuerCorrelationType: {
218
+ $ref: "#/components/schemas/CredentialCorrelationType"
219
+ },
220
+ subjectCorrelationType: {
221
+ $ref: "#/components/schemas/CredentialCorrelationType"
222
+ },
223
+ rpCorrelationType: {
224
+ $ref: "#/components/schemas/CredentialCorrelationType"
225
+ },
226
+ isIssuerSigned: {
227
+ type: "boolean"
228
+ },
229
+ issuerCorrelationId: {
230
+ type: "string"
231
+ },
232
+ subjectCorrelationId: {
233
+ type: "string"
234
+ },
235
+ rpCorrelationId: {
236
+ type: "string"
237
+ },
238
+ verifiedState: {
239
+ $ref: "#/components/schemas/CredentialStateType"
240
+ },
241
+ tenantId: {
242
+ type: "string"
243
+ },
244
+ createdAt: {
245
+ type: "string",
246
+ format: "date-time"
247
+ },
248
+ presentedAt: {
249
+ type: "string",
250
+ format: "date-time"
251
+ },
252
+ lastUpdatedAt: {
253
+ type: "string",
254
+ format: "date-time"
255
+ },
256
+ validUntil: {
257
+ type: "string",
258
+ format: "date-time"
259
+ },
260
+ validFrom: {
261
+ type: "string",
262
+ format: "date-time"
263
+ },
264
+ verifiedAt: {
265
+ type: "string",
266
+ format: "date-time"
267
+ },
268
+ revokedAt: {
269
+ type: "string",
270
+ format: "date-time"
271
+ }
272
+ },
273
+ required: [
274
+ "id",
275
+ "documentType",
276
+ "documentFormat",
277
+ "credentialRole",
278
+ "regulationType",
279
+ "rawDocument",
280
+ "uniformDocument",
281
+ "hash",
282
+ "issuerCorrelationType",
283
+ "issuerCorrelationId",
284
+ "createdAt",
285
+ "lastUpdatedAt"
286
+ ],
287
+ additionalProperties: false,
288
+ description: "DigitalCredential"
289
+ },
290
+ DocumentType: {
291
+ type: "string",
292
+ enum: ["VC", "VP", "P", "C"]
293
+ },
294
+ CredentialDocumentFormat: {
295
+ type: "string",
296
+ enum: ["JSON_LD", "JWT", "SD_JWT", "MSO_MDOC"]
297
+ },
298
+ DeleteCredentialArgs: {
299
+ anyOf: [
300
+ {
301
+ type: "object",
302
+ properties: {
303
+ id: {
304
+ type: "string"
305
+ }
306
+ },
307
+ required: ["id"],
308
+ additionalProperties: false
309
+ },
310
+ {
311
+ type: "object",
312
+ properties: {
313
+ hash: {
314
+ type: "string"
315
+ }
316
+ },
317
+ required: ["hash"],
318
+ additionalProperties: false
319
+ }
320
+ ]
321
+ },
322
+ DeleteCredentialsArgs: {
323
+ $ref: "#/components/schemas/GetCredentialsArgs"
324
+ },
325
+ GetCredentialsArgs: {
326
+ type: "object",
327
+ properties: {
328
+ filter: {
329
+ $ref: "#/components/schemas/FindDigitalCredentialArgs"
330
+ }
331
+ },
332
+ required: ["filter"],
333
+ additionalProperties: false
334
+ },
335
+ FindDigitalCredentialArgs: {
336
+ type: "array",
337
+ items: {
338
+ $ref: "#/components/schemas/Partial<DigitalCredential>"
339
+ }
340
+ },
341
+ "Partial<DigitalCredential>": {
342
+ type: "object",
343
+ properties: {
344
+ id: {
345
+ type: "string"
346
+ },
347
+ parentId: {
348
+ type: "string"
349
+ },
350
+ documentType: {
351
+ $ref: "#/components/schemas/DocumentType"
352
+ },
353
+ documentFormat: {
354
+ $ref: "#/components/schemas/CredentialDocumentFormat"
355
+ },
356
+ credentialRole: {
357
+ $ref: "#/components/schemas/CredentialRole"
358
+ },
359
+ regulationType: {
360
+ $ref: "#/components/schemas/RegulationType"
361
+ },
362
+ rawDocument: {
363
+ type: "string"
364
+ },
365
+ uniformDocument: {
366
+ type: "string"
367
+ },
368
+ credentialId: {
369
+ type: "string"
370
+ },
371
+ hash: {
372
+ type: "string"
373
+ },
374
+ kmsKeyRef: {
375
+ type: "string"
376
+ },
377
+ identifierMethod: {
378
+ type: "string"
379
+ },
380
+ issuerCorrelationType: {
381
+ $ref: "#/components/schemas/CredentialCorrelationType"
382
+ },
383
+ subjectCorrelationType: {
384
+ $ref: "#/components/schemas/CredentialCorrelationType"
385
+ },
386
+ rpCorrelationType: {
387
+ $ref: "#/components/schemas/CredentialCorrelationType"
388
+ },
389
+ isIssuerSigned: {
390
+ type: "boolean"
391
+ },
392
+ issuerCorrelationId: {
393
+ type: "string"
394
+ },
395
+ subjectCorrelationId: {
396
+ type: "string"
397
+ },
398
+ rpCorrelationId: {
399
+ type: "string"
400
+ },
401
+ verifiedState: {
402
+ $ref: "#/components/schemas/CredentialStateType"
403
+ },
404
+ tenantId: {
405
+ type: "string"
406
+ },
407
+ createdAt: {
408
+ type: "string",
409
+ format: "date-time"
410
+ },
411
+ presentedAt: {
412
+ type: "string",
413
+ format: "date-time"
414
+ },
415
+ lastUpdatedAt: {
416
+ type: "string",
417
+ format: "date-time"
418
+ },
419
+ validUntil: {
420
+ type: "string",
421
+ format: "date-time"
422
+ },
423
+ validFrom: {
424
+ type: "string",
425
+ format: "date-time"
426
+ },
427
+ verifiedAt: {
428
+ type: "string",
429
+ format: "date-time"
430
+ },
431
+ revokedAt: {
432
+ type: "string",
433
+ format: "date-time"
434
+ }
435
+ },
436
+ additionalProperties: false
437
+ },
438
+ GetCredentialArgs: {
439
+ type: "object",
440
+ properties: {
441
+ id: {
442
+ type: "string"
443
+ }
444
+ },
445
+ required: ["id"],
446
+ additionalProperties: false
447
+ },
448
+ GetCredentialsByClaimsArgs: {
449
+ type: "object",
450
+ properties: {
451
+ filter: {
452
+ $ref: "#/components/schemas/FindClaimsArgs"
453
+ },
454
+ credentialRole: {
455
+ $ref: "#/components/schemas/CredentialRole"
456
+ },
457
+ tenantId: {
458
+ type: "string"
459
+ }
460
+ },
461
+ required: ["filter"],
462
+ additionalProperties: false
463
+ },
464
+ FindClaimsArgs: {
465
+ $ref: "#/components/schemas/FindArgs-TClaimsColumns"
466
+ },
467
+ "FindArgs-TClaimsColumns": {
468
+ type: "object",
469
+ properties: {
470
+ where: {
471
+ type: "array",
472
+ items: {
473
+ $ref: "#/components/schemas/Where-TClaimsColumns"
474
+ },
475
+ description: "Imposes constraints on the values of the given columns. WHERE clauses are combined using AND."
476
+ },
477
+ order: {
478
+ type: "array",
479
+ items: {
480
+ $ref: "#/components/schemas/Order-TClaimsColumns"
481
+ },
482
+ description: "Sorts the results according to the given array of column priorities."
483
+ },
484
+ skip: {
485
+ type: "number",
486
+ description: "Ignores the first number of entries in a {@link IDataStoreORM } query result."
487
+ },
488
+ take: {
489
+ type: "number",
490
+ description: "Returns at most this number of results from a {@link IDataStoreORM } query."
491
+ }
492
+ },
493
+ additionalProperties: false
494
+ },
495
+ "Where-TClaimsColumns": {
496
+ type: "object",
497
+ properties: {
498
+ column: {
499
+ $ref: "#/components/schemas/TClaimsColumns"
500
+ },
501
+ value: {
502
+ type: "array",
503
+ items: {
504
+ type: "string"
505
+ }
506
+ },
507
+ not: {
508
+ type: "boolean"
509
+ },
510
+ op: {
511
+ type: "string",
512
+ enum: ["LessThan", "LessThanOrEqual", "MoreThan", "MoreThanOrEqual", "Equal", "Like", "Between", "In", "Any", "IsNull"]
513
+ }
514
+ },
515
+ required: ["column"],
516
+ additionalProperties: false,
517
+ description: "Represents a WHERE predicate for a {@link FindArgs } query. In situations where multiple WHERE predicates are present, they are combined with AND."
518
+ },
519
+ TClaimsColumns: {
520
+ type: "string",
521
+ enum: ["context", "credentialType", "type", "value", "isObj", "id", "issuer", "subject", "expirationDate", "issuanceDate"]
522
+ },
523
+ "Order-TClaimsColumns": {
524
+ type: "object",
525
+ properties: {
526
+ column: {
527
+ $ref: "#/components/schemas/TClaimsColumns"
528
+ },
529
+ direction: {
530
+ type: "string",
531
+ enum: ["ASC", "DESC"]
532
+ }
533
+ },
534
+ required: ["column", "direction"],
535
+ additionalProperties: false,
536
+ description: "Represents the sort order of results from a {@link FindArgs } query."
537
+ },
538
+ UniqueDigitalCredential: {
539
+ type: "object",
540
+ properties: {
541
+ hash: {
542
+ type: "string"
543
+ },
544
+ id: {
545
+ type: "string"
546
+ },
547
+ digitalCredential: {
548
+ $ref: "#/components/schemas/DigitalCredential"
549
+ },
550
+ originalVerifiableCredential: {
551
+ $ref: "#/components/schemas/OriginalVerifiableCredential"
552
+ },
553
+ originalVerifiablePresentation: {
554
+ $ref: "#/components/schemas/OriginalVerifiablePresentation"
555
+ },
556
+ originalCredential: {
557
+ $ref: "#/components/schemas/ICredential"
558
+ },
559
+ originalPresentation: {
560
+ $ref: "#/components/schemas/IPresentation"
561
+ },
562
+ uniformVerifiableCredential: {
563
+ $ref: "#/components/schemas/IVerifiableCredential"
564
+ },
565
+ uniformVerifiablePresentation: {
566
+ $ref: "#/components/schemas/IVerifiablePresentation"
567
+ }
568
+ },
569
+ required: ["hash", "digitalCredential"],
570
+ additionalProperties: false
571
+ },
572
+ OriginalVerifiableCredential: {
573
+ anyOf: [
574
+ {
575
+ $ref: "#/components/schemas/W3CVerifiableCredential"
576
+ },
577
+ {
578
+ $ref: "#/components/schemas/JwtDecodedVerifiableCredential"
579
+ },
580
+ {
581
+ $ref: "#/components/schemas/SdJwtDecodedVerifiableCredential"
582
+ },
583
+ {
584
+ $ref: "#/components/schemas/MdocOid4vpIssuerSigned"
585
+ },
586
+ {
587
+ $ref: "#/components/schemas/MdocDocument"
588
+ }
589
+ ]
590
+ },
591
+ W3CVerifiableCredential: {
592
+ anyOf: [
593
+ {
594
+ $ref: "#/components/schemas/IVerifiableCredential"
595
+ },
596
+ {
597
+ $ref: "#/components/schemas/CompactJWT"
598
+ }
599
+ ],
600
+ description: "Represents a signed Verifiable Credential (includes proof), in either JSON, compact JWT or compact SD-JWT VC format. See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model } See {@link https://www.w3.org/TR/vc-data-model/#proof-formats | proof formats }"
601
+ },
602
+ IVerifiableCredential: {
603
+ type: "object",
604
+ properties: {
605
+ proof: {
606
+ anyOf: [
607
+ {
608
+ $ref: "#/components/schemas/IProof"
609
+ },
610
+ {
611
+ type: "array",
612
+ items: {
613
+ $ref: "#/components/schemas/IProof"
614
+ }
615
+ }
616
+ ]
617
+ },
618
+ "@context": {
619
+ anyOf: [
620
+ {
621
+ $ref: "#/components/schemas/ICredentialContextType"
622
+ },
623
+ {
624
+ type: "array",
625
+ items: {
626
+ $ref: "#/components/schemas/ICredentialContextType"
627
+ }
628
+ }
629
+ ]
630
+ },
631
+ type: {
632
+ type: "array",
633
+ items: {
634
+ type: "string"
635
+ }
636
+ },
637
+ credentialSchema: {
638
+ anyOf: [
639
+ {
640
+ $ref: "#/components/schemas/ICredentialSchemaType"
641
+ },
642
+ {
643
+ type: "array",
644
+ items: {
645
+ $ref: "#/components/schemas/ICredentialSchemaType"
646
+ }
647
+ }
648
+ ]
649
+ },
650
+ issuer: {
651
+ anyOf: [
652
+ {
653
+ $ref: "#/components/schemas/IIssuerId"
654
+ },
655
+ {
656
+ $ref: "#/components/schemas/IIssuer"
657
+ }
658
+ ]
659
+ },
660
+ issuanceDate: {
661
+ type: "string"
662
+ },
663
+ credentialSubject: {
664
+ anyOf: [
665
+ {
666
+ type: "object",
667
+ properties: {
668
+ id: {
669
+ type: "string"
670
+ }
671
+ }
672
+ },
673
+ {
674
+ type: "array",
675
+ items: {
676
+ type: "object",
677
+ properties: {
678
+ id: {
679
+ type: "string"
680
+ }
681
+ }
682
+ }
683
+ }
684
+ ]
685
+ },
686
+ expirationDate: {
687
+ type: "string"
688
+ },
689
+ id: {
690
+ type: "string"
691
+ },
692
+ credentialStatus: {
693
+ $ref: "#/components/schemas/ICredentialStatus"
694
+ },
695
+ description: {
696
+ type: "string"
697
+ },
698
+ name: {
699
+ type: "string"
700
+ }
701
+ },
702
+ required: ["@context", "credentialSubject", "issuanceDate", "issuer", "proof", "type"]
703
+ },
704
+ IProof: {
705
+ type: "object",
706
+ properties: {
707
+ type: {
708
+ anyOf: [
709
+ {
710
+ $ref: "#/components/schemas/IProofType"
711
+ },
712
+ {
713
+ type: "string"
714
+ }
715
+ ]
716
+ },
717
+ created: {
718
+ type: "string"
719
+ },
720
+ proofPurpose: {
721
+ anyOf: [
722
+ {
723
+ $ref: "#/components/schemas/IProofPurpose"
724
+ },
725
+ {
726
+ type: "string"
727
+ }
728
+ ]
729
+ },
730
+ verificationMethod: {
731
+ type: "string"
732
+ },
733
+ challenge: {
734
+ type: "string"
735
+ },
736
+ domain: {
737
+ type: "string"
738
+ },
739
+ proofValue: {
740
+ type: "string"
741
+ },
742
+ jws: {
743
+ type: "string"
744
+ },
745
+ jwt: {
746
+ type: "string"
747
+ },
748
+ mso_mdoc: {
749
+ type: "string"
750
+ },
751
+ nonce: {
752
+ type: "string"
753
+ },
754
+ requiredRevealStatements: {
755
+ type: "array",
756
+ items: {
757
+ type: "string"
758
+ }
759
+ }
760
+ },
761
+ required: ["type", "created", "proofPurpose", "verificationMethod"]
762
+ },
763
+ IProofType: {
764
+ type: "string",
765
+ enum: [
766
+ "Ed25519Signature2018",
767
+ "Ed25519Signature2020",
768
+ "EcdsaSecp256k1Signature2019",
769
+ "EcdsaSecp256k1RecoverySignature2020",
770
+ "JsonWebSignature2020",
771
+ "RsaSignature2018",
772
+ "GpgSignature2020",
773
+ "JcsEd25519Signature2020",
774
+ "BbsBlsSignatureProof2020",
775
+ "BbsBlsBoundSignatureProof2020",
776
+ "JwtProof2020",
777
+ "SdJwtProof2024",
778
+ "MsoMdocProof2024"
779
+ ]
780
+ },
781
+ IProofPurpose: {
782
+ type: "string",
783
+ enum: [
784
+ "verificationMethod",
785
+ "assertionMethod",
786
+ "authentication",
787
+ "keyAgreement",
788
+ "contactAgreement",
789
+ "capabilityInvocation",
790
+ "capabilityDelegation"
791
+ ]
792
+ },
793
+ ICredentialContextType: {
794
+ anyOf: [
795
+ {
796
+ type: "object",
797
+ properties: {
798
+ name: {
799
+ type: "string"
800
+ },
801
+ did: {
802
+ type: "string"
803
+ }
804
+ }
805
+ },
806
+ {
807
+ type: "string"
808
+ }
809
+ ]
810
+ },
811
+ ICredentialSchemaType: {
812
+ anyOf: [
813
+ {
814
+ $ref: "#/components/schemas/ICredentialSchema"
815
+ },
816
+ {
817
+ type: "string"
818
+ }
819
+ ]
820
+ },
821
+ ICredentialSchema: {
822
+ type: "object",
823
+ properties: {
824
+ id: {
825
+ type: "string"
826
+ },
827
+ type: {
828
+ type: "string"
829
+ }
830
+ },
831
+ required: ["id"],
832
+ additionalProperties: false
833
+ },
834
+ IIssuerId: {
835
+ type: "string"
836
+ },
837
+ IIssuer: {
838
+ type: "object",
839
+ properties: {
840
+ id: {
841
+ type: "string"
842
+ }
843
+ },
844
+ required: ["id"]
845
+ },
846
+ ICredentialStatus: {
847
+ type: "object",
848
+ properties: {
849
+ id: {
850
+ type: "string"
851
+ },
852
+ type: {
853
+ type: "string"
854
+ }
855
+ },
856
+ required: ["id", "type"]
857
+ },
858
+ CompactJWT: {
859
+ type: "string",
860
+ description: "Represents a Json Web Token in compact form."
861
+ },
862
+ JwtDecodedVerifiableCredential: {
863
+ type: "object",
864
+ properties: {
865
+ vc: {
866
+ $ref: "#/components/schemas/IVerifiableCredential"
867
+ },
868
+ exp: {
869
+ type: "string"
870
+ },
871
+ iss: {
872
+ type: "string"
873
+ },
874
+ nbf: {
875
+ type: "string"
876
+ },
877
+ sub: {
878
+ type: "string"
879
+ },
880
+ jti: {
881
+ type: "string"
882
+ }
883
+ },
884
+ required: ["vc", "exp", "iss", "nbf", "sub", "jti"]
885
+ },
886
+ SdJwtDecodedVerifiableCredential: {
887
+ type: "object",
888
+ properties: {
889
+ compactSdJwtVc: {
890
+ type: "string",
891
+ description: "The compact sd jwt is the sd-jwt encoded as string. It is a normal JWT, with the disclosures and kb-jwt appended separated by ~"
892
+ },
893
+ disclosures: {
894
+ type: "array",
895
+ items: {
896
+ $ref: "#/components/schemas/SdJwtDisclosure"
897
+ },
898
+ description: "The disclosures included within the SD-JWT in both encoded and decoded format. The digests are also included, and allows the disclosures to be linked against the digests in the signed payload."
899
+ },
900
+ signedPayload: {
901
+ $ref: "#/components/schemas/SdJwtSignedVerifiableCredentialPayload",
902
+ description: "The signed payload is the payload of the sd-jwt that is actually signed, and that includes the `_sd` and `...` digests."
903
+ },
904
+ decodedPayload: {
905
+ $ref: "#/components/schemas/SdJwtDecodedVerifiableCredentialPayload",
906
+ description: "The decoded payload is the payload when all `_sd` and `...` digests have been replaced by the actual values from the disclosures. This format could also be seen as the 'pretty` version of the SD JWT payload.\n\nThis is useful for displaying the contents of the SD JWT VC to the user, or for example for querying the contents of the SD JWT VC using a PEX presentation definition path."
907
+ },
908
+ kbJwt: {
909
+ type: "object",
910
+ properties: {
911
+ header: {
912
+ $ref: "#/components/schemas/SdJwtVcKbJwtHeader"
913
+ },
914
+ payload: {
915
+ $ref: "#/components/schemas/SdJwtVcKbJwtPayload"
916
+ },
917
+ compact: {
918
+ $ref: "#/components/schemas/CompactJWT"
919
+ }
920
+ },
921
+ required: ["header", "payload"],
922
+ additionalProperties: false,
923
+ description: "Key binding JWT"
924
+ }
925
+ },
926
+ required: ["compactSdJwtVc", "disclosures", "signedPayload", "decodedPayload"],
927
+ additionalProperties: false,
928
+ description: "The decoded SD JWT Verifiable Credential. This representation includes multiple representations of the same SD-JWT, and allows to fully process an SD-JWT, as well as create a presentation SD-JWT (minus the KB-JWT) by removing certain disclosures from the compact SD-JWT.\n\nThis representation is useful as it doesn't require a hasher implementation to match the different digests in the signed SD-JWT payload, with the different disclosures."
929
+ },
930
+ SdJwtDisclosure: {
931
+ type: "object",
932
+ properties: {
933
+ encoded: {
934
+ type: "string"
935
+ },
936
+ decoded: {
937
+ $ref: "#/components/schemas/SdJwtDecodedDisclosure"
938
+ },
939
+ digest: {
940
+ type: "string"
941
+ }
942
+ },
943
+ required: ["encoded", "decoded", "digest"],
944
+ additionalProperties: false
945
+ },
946
+ SdJwtDecodedDisclosure: {
947
+ anyOf: [
948
+ {
949
+ type: "array",
950
+ minItems: 3,
951
+ items: [
952
+ {
953
+ type: "string"
954
+ },
955
+ {
956
+ type: "string"
957
+ },
958
+ {
959
+ $ref: "#/components/schemas/JsonValue"
960
+ }
961
+ ],
962
+ maxItems: 3
963
+ },
964
+ {
965
+ type: "array",
966
+ minItems: 2,
967
+ items: [
968
+ {
969
+ type: "string"
970
+ },
971
+ {
972
+ $ref: "#/components/schemas/JsonValue"
973
+ }
974
+ ],
975
+ maxItems: 2
976
+ }
977
+ ]
978
+ },
979
+ JsonValue: {
980
+ anyOf: [
981
+ {
982
+ type: "string"
983
+ },
984
+ {
985
+ type: "number"
986
+ },
987
+ {
988
+ type: "boolean"
989
+ },
990
+ {
991
+ type: "object",
992
+ additionalProperties: {
993
+ anyOf: [
994
+ {
995
+ $ref: "#/components/schemas/JsonValue"
996
+ },
997
+ {
998
+ not: {}
999
+ }
1000
+ ]
1001
+ }
1002
+ },
1003
+ {
1004
+ type: "array",
1005
+ items: {
1006
+ $ref: "#/components/schemas/JsonValue"
1007
+ }
1008
+ }
1009
+ ]
1010
+ },
1011
+ SdJwtSignedVerifiableCredentialPayload: {
1012
+ type: "object",
1013
+ properties: {
1014
+ vct: {
1015
+ type: "string"
1016
+ },
1017
+ iss: {
1018
+ type: "string"
1019
+ },
1020
+ iat: {
1021
+ type: "number"
1022
+ },
1023
+ nbf: {
1024
+ type: "number"
1025
+ },
1026
+ exp: {
1027
+ type: "number"
1028
+ },
1029
+ cnf: {
1030
+ type: "object",
1031
+ properties: {
1032
+ jwk: {},
1033
+ kid: {
1034
+ type: "string"
1035
+ }
1036
+ },
1037
+ additionalProperties: false
1038
+ },
1039
+ status: {
1040
+ type: "object",
1041
+ properties: {
1042
+ idx: {
1043
+ type: "number"
1044
+ },
1045
+ uri: {
1046
+ type: "string"
1047
+ }
1048
+ },
1049
+ required: ["idx", "uri"],
1050
+ additionalProperties: false
1051
+ },
1052
+ sub: {
1053
+ type: "string"
1054
+ },
1055
+ _sd: {
1056
+ type: "array",
1057
+ items: {
1058
+ type: "string"
1059
+ }
1060
+ },
1061
+ _sd_alg: {
1062
+ type: "string"
1063
+ }
1064
+ },
1065
+ additionalProperties: {
1066
+ anyOf: [
1067
+ {
1068
+ $ref: "#/components/schemas/SdJwtJsonValue"
1069
+ },
1070
+ {
1071
+ not: {}
1072
+ },
1073
+ {
1074
+ $ref: "#/components/schemas/JsonValue"
1075
+ },
1076
+ {
1077
+ not: {}
1078
+ }
1079
+ ]
1080
+ },
1081
+ required: ["iat", "iss", "vct"],
1082
+ description: "The signed payload of an SD-JWT. Includes fields such as `_sd`, `...` and `_sd_alg`"
1083
+ },
1084
+ SdJwtJsonValue: {
1085
+ anyOf: [
1086
+ {
1087
+ type: "string"
1088
+ },
1089
+ {
1090
+ type: "number"
1091
+ },
1092
+ {
1093
+ type: "boolean"
1094
+ },
1095
+ {
1096
+ type: "object",
1097
+ properties: {
1098
+ _sd: {
1099
+ type: "array",
1100
+ items: {
1101
+ type: "string"
1102
+ }
1103
+ }
1104
+ },
1105
+ additionalProperties: {
1106
+ anyOf: [
1107
+ {
1108
+ $ref: "#/components/schemas/SdJwtJsonValue"
1109
+ },
1110
+ {
1111
+ not: {}
1112
+ }
1113
+ ]
1114
+ }
1115
+ },
1116
+ {
1117
+ type: "array",
1118
+ items: {
1119
+ anyOf: [
1120
+ {
1121
+ $ref: "#/components/schemas/SdJwtJsonValue"
1122
+ },
1123
+ {
1124
+ type: "object",
1125
+ properties: {
1126
+ "...": {
1127
+ type: "string"
1128
+ }
1129
+ },
1130
+ required: ["..."],
1131
+ additionalProperties: false
1132
+ }
1133
+ ]
1134
+ }
1135
+ }
1136
+ ]
1137
+ },
1138
+ SdJwtDecodedVerifiableCredentialPayload: {
1139
+ type: "object",
1140
+ properties: {
1141
+ vct: {
1142
+ type: "string"
1143
+ },
1144
+ iss: {
1145
+ type: "string"
1146
+ },
1147
+ iat: {
1148
+ type: "number"
1149
+ },
1150
+ nbf: {
1151
+ type: "number"
1152
+ },
1153
+ exp: {
1154
+ type: "number"
1155
+ },
1156
+ cnf: {
1157
+ type: "object",
1158
+ properties: {
1159
+ jwk: {},
1160
+ kid: {
1161
+ type: "string"
1162
+ }
1163
+ },
1164
+ additionalProperties: false
1165
+ },
1166
+ status: {
1167
+ type: "object",
1168
+ properties: {
1169
+ idx: {
1170
+ type: "number"
1171
+ },
1172
+ uri: {
1173
+ type: "string"
1174
+ }
1175
+ },
1176
+ required: ["idx", "uri"],
1177
+ additionalProperties: false
1178
+ },
1179
+ sub: {
1180
+ type: "string"
1181
+ }
1182
+ },
1183
+ required: ["vct", "iss", "iat"],
1184
+ additionalProperties: {
1185
+ anyOf: [
1186
+ {
1187
+ $ref: "#/components/schemas/JsonValue"
1188
+ },
1189
+ {
1190
+ not: {}
1191
+ }
1192
+ ]
1193
+ },
1194
+ description: "Decoded 'pretty' SD JWT Verifiable Credential. This representation has all the `_sd` properties removed, and includes the disclosures directly within the payload."
1195
+ },
1196
+ SdJwtVcKbJwtHeader: {
1197
+ type: "object",
1198
+ properties: {
1199
+ typ: {
1200
+ type: "string",
1201
+ const: "kb+jwt"
1202
+ },
1203
+ alg: {
1204
+ type: "string"
1205
+ }
1206
+ },
1207
+ required: ["typ", "alg"]
1208
+ },
1209
+ SdJwtVcKbJwtPayload: {
1210
+ type: "object",
1211
+ properties: {
1212
+ iat: {
1213
+ type: "number"
1214
+ },
1215
+ aud: {
1216
+ type: "string"
1217
+ },
1218
+ nonce: {
1219
+ type: "string"
1220
+ },
1221
+ sd_hash: {
1222
+ type: "string"
1223
+ }
1224
+ },
1225
+ required: ["iat", "aud", "nonce", "sd_hash"],
1226
+ additionalProperties: {}
1227
+ },
1228
+ MdocOid4vpIssuerSigned: {
1229
+ type: "string",
1230
+ description: "Represents a selective disclosure JWT vc in compact form."
1231
+ },
1232
+ MdocDocument: {
1233
+ $ref: "#/components/schemas/com.sphereon.mdoc.data.device.DocumentCbor"
1234
+ },
1235
+ "com.sphereon.mdoc.data.device.DocumentCbor": {
1236
+ type: "object",
1237
+ additionalProperties: false,
1238
+ properties: {}
1239
+ },
1240
+ OriginalVerifiablePresentation: {
1241
+ anyOf: [
1242
+ {
1243
+ $ref: "#/components/schemas/W3CVerifiablePresentation"
1244
+ },
1245
+ {
1246
+ $ref: "#/components/schemas/JwtDecodedVerifiablePresentation"
1247
+ },
1248
+ {
1249
+ $ref: "#/components/schemas/SdJwtDecodedVerifiableCredential"
1250
+ },
1251
+ {
1252
+ $ref: "#/components/schemas/MdocOid4vpMdocVpToken"
1253
+ },
1254
+ {
1255
+ $ref: "#/components/schemas/MdocDeviceResponse"
1256
+ }
1257
+ ]
1258
+ },
1259
+ W3CVerifiablePresentation: {
1260
+ anyOf: [
1261
+ {
1262
+ $ref: "#/components/schemas/IVerifiablePresentation"
1263
+ },
1264
+ {
1265
+ $ref: "#/components/schemas/CompactJWT"
1266
+ }
1267
+ ],
1268
+ description: "Represents a signed Verifiable Presentation (includes proof), in either JSON or compact JWT format. See {@link https://www.w3.org/TR/vc-data-model/#presentations | VC data model } See {@link https://www.w3.org/TR/vc-data-model/#proof-formats | proof formats }"
1269
+ },
1270
+ IVerifiablePresentation: {
1271
+ type: "object",
1272
+ properties: {
1273
+ proof: {
1274
+ anyOf: [
1275
+ {
1276
+ $ref: "#/components/schemas/IProof"
1277
+ },
1278
+ {
1279
+ type: "array",
1280
+ items: {
1281
+ $ref: "#/components/schemas/IProof"
1282
+ }
1283
+ }
1284
+ ]
1285
+ },
1286
+ id: {
1287
+ type: "string"
1288
+ },
1289
+ "@context": {
1290
+ anyOf: [
1291
+ {
1292
+ $ref: "#/components/schemas/ICredentialContextType"
1293
+ },
1294
+ {
1295
+ type: "array",
1296
+ items: {
1297
+ $ref: "#/components/schemas/ICredentialContextType"
1298
+ }
1299
+ }
1300
+ ]
1301
+ },
1302
+ type: {
1303
+ anyOf: [
1304
+ {
1305
+ type: "string"
1306
+ },
1307
+ {
1308
+ type: "array",
1309
+ items: {
1310
+ type: "string"
1311
+ }
1312
+ }
1313
+ ]
1314
+ },
1315
+ verifiableCredential: {
1316
+ type: "array",
1317
+ items: {
1318
+ $ref: "#/components/schemas/W3CVerifiableCredential"
1319
+ }
1320
+ },
1321
+ presentation_submission: {
1322
+ $ref: "#/components/schemas/PresentationSubmission"
1323
+ },
1324
+ holder: {
1325
+ type: "string"
1326
+ },
1327
+ verifier: {
1328
+ type: "string"
1329
+ }
1330
+ },
1331
+ required: ["@context", "proof"]
1332
+ },
1333
+ PresentationSubmission: {
1334
+ type: "object",
1335
+ properties: {
1336
+ id: {
1337
+ type: "string",
1338
+ description: "A UUID or some other unique ID to identify this Presentation Submission"
1339
+ },
1340
+ definition_id: {
1341
+ type: "string",
1342
+ description: "A UUID or some other unique ID to identify this Presentation Definition"
1343
+ },
1344
+ descriptor_map: {
1345
+ type: "array",
1346
+ items: {
1347
+ $ref: "#/components/schemas/Descriptor"
1348
+ },
1349
+ description: "List of descriptors of how the claims are being mapped to presentation definition"
1350
+ }
1351
+ },
1352
+ required: ["id", "definition_id", "descriptor_map"],
1353
+ additionalProperties: false,
1354
+ description: "It expresses how the inputs are presented as proofs to a Verifier."
1355
+ },
1356
+ Descriptor: {
1357
+ type: "object",
1358
+ properties: {
1359
+ id: {
1360
+ type: "string",
1361
+ description: "ID to identify the descriptor from Presentation Definition Input Descriptor it coresponds to."
1362
+ },
1363
+ path: {
1364
+ type: "string",
1365
+ description: "The path where the verifiable credential is located in the presentation submission json"
1366
+ },
1367
+ path_nested: {
1368
+ $ref: "#/components/schemas/Descriptor"
1369
+ },
1370
+ format: {
1371
+ type: "string",
1372
+ description: "The Proof or JWT algorith that the proof is in"
1373
+ }
1374
+ },
1375
+ required: ["id", "path", "format"],
1376
+ additionalProperties: false,
1377
+ description: "descriptor map laying out the structure of the presentation submission."
1378
+ },
1379
+ JwtDecodedVerifiablePresentation: {
1380
+ type: "object",
1381
+ properties: {
1382
+ vp: {
1383
+ $ref: "#/components/schemas/IVerifiablePresentation"
1384
+ },
1385
+ exp: {
1386
+ type: "string"
1387
+ },
1388
+ iss: {
1389
+ type: "string"
1390
+ },
1391
+ nbf: {
1392
+ type: "string"
1393
+ },
1394
+ sub: {
1395
+ type: "string"
1396
+ },
1397
+ jti: {
1398
+ type: "string"
1399
+ },
1400
+ aud: {
1401
+ type: "string"
1402
+ },
1403
+ iat: {
1404
+ type: "string"
1405
+ }
1406
+ },
1407
+ required: ["vp", "exp", "iss", "nbf", "sub", "jti", "aud", "iat"]
1408
+ },
1409
+ MdocOid4vpMdocVpToken: {
1410
+ type: "string"
1411
+ },
1412
+ MdocDeviceResponse: {
1413
+ $ref: "#/components/schemas/com.sphereon.mdoc.data.device.DeviceResponseCbor"
1414
+ },
1415
+ "com.sphereon.mdoc.data.device.DeviceResponseCbor": {
1416
+ type: "object",
1417
+ additionalProperties: false,
1418
+ properties: {}
1419
+ },
1420
+ ICredential: {
1421
+ type: "object",
1422
+ properties: {
1423
+ "@context": {
1424
+ anyOf: [
1425
+ {
1426
+ $ref: "#/components/schemas/ICredentialContextType"
1427
+ },
1428
+ {
1429
+ type: "array",
1430
+ items: {
1431
+ $ref: "#/components/schemas/ICredentialContextType"
1432
+ }
1433
+ }
1434
+ ]
1435
+ },
1436
+ type: {
1437
+ type: "array",
1438
+ items: {
1439
+ type: "string"
1440
+ }
1441
+ },
1442
+ credentialSchema: {
1443
+ anyOf: [
1444
+ {
1445
+ $ref: "#/components/schemas/ICredentialSchemaType"
1446
+ },
1447
+ {
1448
+ type: "array",
1449
+ items: {
1450
+ $ref: "#/components/schemas/ICredentialSchemaType"
1451
+ }
1452
+ }
1453
+ ]
1454
+ },
1455
+ issuer: {
1456
+ anyOf: [
1457
+ {
1458
+ $ref: "#/components/schemas/IIssuerId"
1459
+ },
1460
+ {
1461
+ $ref: "#/components/schemas/IIssuer"
1462
+ }
1463
+ ]
1464
+ },
1465
+ issuanceDate: {
1466
+ type: "string"
1467
+ },
1468
+ credentialSubject: {
1469
+ anyOf: [
1470
+ {
1471
+ type: "object",
1472
+ properties: {
1473
+ id: {
1474
+ type: "string"
1475
+ }
1476
+ }
1477
+ },
1478
+ {
1479
+ type: "array",
1480
+ items: {
1481
+ type: "object",
1482
+ properties: {
1483
+ id: {
1484
+ type: "string"
1485
+ }
1486
+ }
1487
+ }
1488
+ }
1489
+ ]
1490
+ },
1491
+ expirationDate: {
1492
+ type: "string"
1493
+ },
1494
+ id: {
1495
+ type: "string"
1496
+ },
1497
+ credentialStatus: {
1498
+ $ref: "#/components/schemas/ICredentialStatus"
1499
+ },
1500
+ description: {
1501
+ type: "string"
1502
+ },
1503
+ name: {
1504
+ type: "string"
1505
+ }
1506
+ },
1507
+ required: ["@context", "type", "issuer", "issuanceDate", "credentialSubject"]
1508
+ },
1509
+ IPresentation: {
1510
+ type: "object",
1511
+ properties: {
1512
+ id: {
1513
+ type: "string"
1514
+ },
1515
+ "@context": {
1516
+ anyOf: [
1517
+ {
1518
+ $ref: "#/components/schemas/ICredentialContextType"
1519
+ },
1520
+ {
1521
+ type: "array",
1522
+ items: {
1523
+ $ref: "#/components/schemas/ICredentialContextType"
1524
+ }
1525
+ }
1526
+ ]
1527
+ },
1528
+ type: {
1529
+ anyOf: [
1530
+ {
1531
+ type: "string"
1532
+ },
1533
+ {
1534
+ type: "array",
1535
+ items: {
1536
+ type: "string"
1537
+ }
1538
+ }
1539
+ ]
1540
+ },
1541
+ verifiableCredential: {
1542
+ type: "array",
1543
+ items: {
1544
+ $ref: "#/components/schemas/W3CVerifiableCredential"
1545
+ }
1546
+ },
1547
+ presentation_submission: {
1548
+ $ref: "#/components/schemas/PresentationSubmission"
1549
+ },
1550
+ holder: {
1551
+ type: "string"
1552
+ },
1553
+ verifier: {
1554
+ type: "string"
1555
+ }
1556
+ },
1557
+ required: ["@context"]
1558
+ },
1559
+ GetCredentialsByIdOrHashArgs: {
1560
+ type: "object",
1561
+ properties: {
1562
+ credentialRole: {
1563
+ $ref: "#/components/schemas/CredentialRole"
1564
+ },
1565
+ idOrHash: {
1566
+ type: "string"
1567
+ }
1568
+ },
1569
+ required: ["credentialRole", "idOrHash"],
1570
+ additionalProperties: false
1571
+ },
1572
+ OptionalUniqueDigitalCredential: {
1573
+ anyOf: [
1574
+ {
1575
+ $ref: "#/components/schemas/UniqueDigitalCredential"
1576
+ },
1577
+ {
1578
+ not: {}
1579
+ }
1580
+ ]
1581
+ },
1582
+ UpdateCredentialStateArgs: {
1583
+ anyOf: [
1584
+ {
1585
+ type: "object",
1586
+ additionalProperties: false,
1587
+ properties: {
1588
+ verifiedState: {
1589
+ $ref: "#/components/schemas/CredentialStateType"
1590
+ },
1591
+ verifiedAt: {
1592
+ type: "string",
1593
+ format: "date-time"
1594
+ },
1595
+ revokedAt: {
1596
+ type: "string",
1597
+ format: "date-time"
1598
+ },
1599
+ id: {
1600
+ type: "string"
1601
+ }
1602
+ },
1603
+ required: ["id", "verifiedState"]
1604
+ },
1605
+ {
1606
+ type: "object",
1607
+ additionalProperties: false,
1608
+ properties: {
1609
+ verifiedState: {
1610
+ $ref: "#/components/schemas/CredentialStateType"
1611
+ },
1612
+ verifiedAt: {
1613
+ type: "string",
1614
+ format: "date-time"
1615
+ },
1616
+ revokedAt: {
1617
+ type: "string",
1618
+ format: "date-time"
1619
+ },
1620
+ hash: {
1621
+ type: "string"
1622
+ }
1623
+ },
1624
+ required: ["hash", "verifiedState"]
1625
+ }
1626
+ ]
1627
+ }
1628
+ },
1629
+ methods: {
1630
+ crsAddCredential: {
1631
+ description: "Add a new credential.",
1632
+ arguments: {
1633
+ $ref: "#/components/schemas/AddCredentialArgs"
1634
+ },
1635
+ returnType: {
1636
+ $ref: "#/components/schemas/DigitalCredential"
1637
+ }
1638
+ },
1639
+ crsDeleteCredential: {
1640
+ description: "Delete a single credentials by primary key",
1641
+ arguments: {
1642
+ $ref: "#/components/schemas/DeleteCredentialArgs"
1643
+ },
1644
+ returnType: {
1645
+ type: "boolean"
1646
+ }
1647
+ },
1648
+ crsDeleteCredentials: {
1649
+ description: "Delete multiple credentials records using filters",
1650
+ arguments: {
1651
+ $ref: "#/components/schemas/DeleteCredentialsArgs"
1652
+ },
1653
+ returnType: {
1654
+ type: "number"
1655
+ }
1656
+ },
1657
+ crsGetCredential: {
1658
+ description: "Get a single credentials by primary key",
1659
+ arguments: {
1660
+ $ref: "#/components/schemas/GetCredentialArgs"
1661
+ },
1662
+ returnType: {
1663
+ $ref: "#/components/schemas/DigitalCredential"
1664
+ }
1665
+ },
1666
+ crsGetCredentials: {
1667
+ description: "Find one or more credentials using filters",
1668
+ arguments: {
1669
+ $ref: "#/components/schemas/GetCredentialsArgs"
1670
+ },
1671
+ returnType: {
1672
+ type: "array",
1673
+ items: {
1674
+ $ref: "#/components/schemas/DigitalCredential"
1675
+ }
1676
+ }
1677
+ },
1678
+ crsGetCredentialsByClaims: {
1679
+ description: "Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.",
1680
+ arguments: {
1681
+ $ref: "#/components/schemas/GetCredentialsByClaimsArgs"
1682
+ },
1683
+ returnType: {
1684
+ type: "array",
1685
+ items: {
1686
+ $ref: "#/components/schemas/UniqueDigitalCredential"
1687
+ }
1688
+ }
1689
+ },
1690
+ crsGetCredentialsByClaimsCount: {
1691
+ description: "Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.",
1692
+ arguments: {
1693
+ $ref: "#/components/schemas/GetCredentialsByClaimsArgs"
1694
+ },
1695
+ returnType: {
1696
+ type: "number"
1697
+ }
1698
+ },
1699
+ crsGetUniqueCredentialByIdOrHash: {
1700
+ description: "Find one credential by id or hash",
1701
+ arguments: {
1702
+ $ref: "#/components/schemas/GetCredentialsByIdOrHashArgs"
1703
+ },
1704
+ returnType: {
1705
+ $ref: "#/components/schemas/OptionalUniqueDigitalCredential"
1706
+ }
1707
+ },
1708
+ crsGetUniqueCredentials: {
1709
+ description: "Find one or more credentials using filters",
1710
+ arguments: {
1711
+ $ref: "#/components/schemas/GetCredentialsArgs"
1712
+ },
1713
+ returnType: {
1714
+ type: "array",
1715
+ items: {
1716
+ $ref: "#/components/schemas/UniqueDigitalCredential"
1717
+ }
1718
+ }
1719
+ },
1720
+ crsUpdateCredentialState: {
1721
+ description: "Update credential the state of an existing credential.",
1722
+ arguments: {
1723
+ $ref: "#/components/schemas/UpdateCredentialStateArgs"
1724
+ },
1725
+ returnType: {
1726
+ $ref: "#/components/schemas/DigitalCredential"
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ }
1732
+ };
1733
+ }
1734
+ });
1735
+
1736
+ // src/index.ts
1737
+ var index_exports = {};
1738
+ __export(index_exports, {
1739
+ CredentialCorrelationType: () => import_ssi_sdk5.CredentialCorrelationType,
1740
+ CredentialDocumentFormat: () => import_ssi_sdk5.CredentialDocumentFormat,
1741
+ CredentialRole: () => import_ssi_sdk5.CredentialRole,
1742
+ CredentialStateType: () => import_ssi_sdk5.CredentialStateType,
1743
+ CredentialStore: () => CredentialStore,
1744
+ DocumentType: () => import_ssi_sdk5.DocumentType,
1745
+ contextHasCredentialStore: () => contextHasCredentialStore,
1746
+ credentialIdOrHashFilter: () => credentialIdOrHashFilter,
1747
+ credentialStoreMethods: () => credentialStoreMethods,
1748
+ logger: () => logger,
1749
+ mergeFilter: () => mergeFilter,
1750
+ schema: () => schema,
1751
+ verifiableCredentialForRoleFilter: () => verifiableCredentialForRoleFilter
1752
+ });
1753
+ module.exports = __toCommonJS(index_exports);
1754
+ var import_ssi_types = require("@sphereon/ssi-types");
1755
+
1756
+ // src/agent/CredentialStore.ts
1757
+ var import_ssi_sdk2 = require("@sphereon/ssi-sdk.data-store");
1758
+ var import_ssi_sdk3 = require("@sphereon/ssi-sdk.core");
1759
+
1760
+ // src/utils/filters.ts
1761
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store");
1762
+ var import_uuid = require("uuid");
1763
+ var credentialIdOrHashFilter = /* @__PURE__ */ __name((credentialRole, idOrHash) => {
1764
+ const filter = [
1765
+ {
1766
+ hash: idOrHash,
1767
+ credentialRole
1768
+ },
1769
+ {
1770
+ credentialId: idOrHash,
1771
+ credentialRole
1772
+ }
1773
+ ];
1774
+ if ((0, import_uuid.validate)(idOrHash)) {
1775
+ filter.push({
1776
+ id: idOrHash,
1777
+ credentialRole
1778
+ });
1779
+ }
1780
+ return filter;
1781
+ }, "credentialIdOrHashFilter");
1782
+ var verifiableCredentialForRoleFilter = /* @__PURE__ */ __name((credentialRole, withFilter) => {
1783
+ const filter = [
1784
+ {
1785
+ documentType: import_ssi_sdk.DocumentType.VC,
1786
+ credentialRole
1787
+ }
1788
+ ];
1789
+ if (withFilter !== void 0) {
1790
+ return mergeFilter(withFilter, filter);
1791
+ }
1792
+ return filter;
1793
+ }, "verifiableCredentialForRoleFilter");
1794
+ var mergeFilter = /* @__PURE__ */ __name((filter1, filter2) => {
1795
+ const mergedFilter = [];
1796
+ const mergedMap = /* @__PURE__ */ new Map();
1797
+ filter1.forEach((obj, index) => {
1798
+ mergedMap.set(index, {
1799
+ ...obj
1800
+ });
1801
+ });
1802
+ filter2.forEach((obj, index) => {
1803
+ if (mergedMap.has(index)) {
1804
+ mergedMap.set(index, {
1805
+ ...mergedMap.get(index),
1806
+ ...obj
1807
+ });
1808
+ } else {
1809
+ mergedMap.set(index, {
1810
+ ...obj
1811
+ });
1812
+ }
1813
+ });
1814
+ mergedMap.forEach((value) => {
1815
+ mergedFilter.push(value);
1816
+ });
1817
+ return mergedFilter;
1818
+ }, "mergeFilter");
1819
+
1820
+ // src/agent/CredentialStore.ts
1821
+ var credentialStoreMethods = [
1822
+ "crsAddCredential",
1823
+ "crsUpdateCredentialState",
1824
+ "crsGetCredential",
1825
+ "crsGetCredentials",
1826
+ "crsDeleteCredential",
1827
+ "crsDeleteCredentials",
1828
+ "crsGetUniqueCredentials",
1829
+ "crsGetUniqueCredentialByIdOrHash",
1830
+ "crsGetCredentialsByClaims",
1831
+ "crsGetCredentialsByClaimsCount"
1832
+ ];
1833
+ var CredentialStore = class {
1834
+ static {
1835
+ __name(this, "CredentialStore");
1836
+ }
1837
+ schema = schema.ICredentialStore;
1838
+ methods = {
1839
+ crsAddCredential: this.crsAddCredential.bind(this),
1840
+ crsUpdateCredentialState: this.crsUpdateCredentialState.bind(this),
1841
+ crsGetCredential: this.crsGetCredential.bind(this),
1842
+ crsGetCredentials: this.crsGetCredentials.bind(this),
1843
+ crsGetUniqueCredentialByIdOrHash: this.crsGetUniqueCredentialByIdOrHash.bind(this),
1844
+ crsGetUniqueCredentials: this.crsGetUniqueCredentials.bind(this),
1845
+ crsDeleteCredential: this.crsDeleteCredential.bind(this),
1846
+ crsDeleteCredentials: this.crsDeleteCredentials.bind(this),
1847
+ crsGetCredentialsByClaims: this.crsGetCredentialsByClaims.bind(this),
1848
+ crsGetCredentialsByClaimsCount: this.crsGetCredentialsByClaimsCount.bind(this)
1849
+ };
1850
+ store;
1851
+ constructor(options) {
1852
+ this.store = options.store;
1853
+ }
1854
+ /** {@inheritDoc ICredentialStore.crsAddCredential} */
1855
+ async crsAddCredential(args) {
1856
+ return await this.store.addCredential({
1857
+ ...args.credential,
1858
+ opts: {
1859
+ ...args.opts,
1860
+ hasher: args.opts?.hasher ?? import_ssi_sdk3.shaHasher
1861
+ }
1862
+ });
1863
+ }
1864
+ /** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
1865
+ async crsUpdateCredentialState(args) {
1866
+ return await this.store.updateCredentialState(args);
1867
+ }
1868
+ /** {@inheritDoc ICredentialStore.crsGetCredential} */
1869
+ async crsGetCredential(args) {
1870
+ const { id } = args;
1871
+ return this.store.getCredential({
1872
+ id
1873
+ });
1874
+ }
1875
+ /** {@inheritDoc ICredentialStore.crsGetCredentials} */
1876
+ async crsGetCredentials(args) {
1877
+ const { filter } = args;
1878
+ const credentials = await this.store.getCredentials({
1879
+ filter
1880
+ });
1881
+ return credentials.data;
1882
+ }
1883
+ /** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
1884
+ async crsGetUniqueCredentialByIdOrHash(args) {
1885
+ const credentials = await this.crsGetCredentials({
1886
+ filter: credentialIdOrHashFilter(args.credentialRole, args.idOrHash)
1887
+ });
1888
+ if (credentials.length === 0) {
1889
+ return void 0;
1890
+ } else if (credentials.length > 1) {
1891
+ logger.warning("Duplicate credentials detected in crsGetUniqueCredentialByIdOrHash", args);
1892
+ }
1893
+ return this.toUniqueCredentials(credentials)[0];
1894
+ }
1895
+ /** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
1896
+ async crsGetUniqueCredentials(args) {
1897
+ const credentials = await this.crsGetCredentials(args);
1898
+ return this.toUniqueCredentials(credentials);
1899
+ }
1900
+ /** {@inheritDoc ICredentialStore.crsDeleteCredential} */
1901
+ async crsDeleteCredential(args) {
1902
+ return this.store.removeCredential(args);
1903
+ }
1904
+ /** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
1905
+ async crsDeleteCredentials(args) {
1906
+ const credentials = await this.crsGetCredentials(args);
1907
+ let count = 0;
1908
+ for (const credential of credentials) {
1909
+ const result = await this.store.removeCredential({
1910
+ id: credential.id
1911
+ });
1912
+ if (result) {
1913
+ count++;
1914
+ }
1915
+ }
1916
+ return count;
1917
+ }
1918
+ /**
1919
+ * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
1920
+ * @param args
1921
+ */
1922
+ async crsGetCredentialsByClaims(args) {
1923
+ const digitalCredentials = await this.crsGetUniqueCredentials({
1924
+ filter: [
1925
+ // TODO SDK-25 Implement param for documentType & support VP filtering below
1926
+ {
1927
+ documentType: import_ssi_sdk2.DocumentType.VC,
1928
+ credentialRole: args.credentialRole,
1929
+ tenantId: args.tenantId
1930
+ },
1931
+ {
1932
+ documentType: import_ssi_sdk2.DocumentType.C,
1933
+ credentialRole: args.credentialRole,
1934
+ tenantId: args.tenantId
1935
+ }
1936
+ ]
1937
+ });
1938
+ return digitalCredentials.filter((uniqueVC) => {
1939
+ if (!uniqueVC.uniformVerifiableCredential) {
1940
+ return false;
1941
+ }
1942
+ const credential = uniqueVC.uniformVerifiableCredential;
1943
+ return args.filter.where?.every((whereClause) => {
1944
+ const value = this.getValueFromCredential(credential, whereClause.column);
1945
+ if (value === void 0) {
1946
+ return whereClause.op === "IsNull";
1947
+ }
1948
+ switch (whereClause.op) {
1949
+ case "In":
1950
+ return whereClause.value?.includes(value);
1951
+ case "Like":
1952
+ return typeof value === "string" && value.includes(whereClause.value?.[0] || "");
1953
+ case "Between":
1954
+ return value >= (whereClause.value?.[0] || "") && value <= (whereClause.value?.[1] || "");
1955
+ case "LessThan":
1956
+ return value < (whereClause.value?.[0] || "");
1957
+ case "LessThanOrEqual":
1958
+ return value <= (whereClause.value?.[0] || "");
1959
+ case "MoreThan":
1960
+ return value > (whereClause.value?.[0] || "");
1961
+ case "MoreThanOrEqual":
1962
+ return value >= (whereClause.value?.[0] || "");
1963
+ case "Any":
1964
+ return Array.isArray(value) && value.some((v) => whereClause.value?.includes(v));
1965
+ case "IsNull":
1966
+ return value === null || value === void 0;
1967
+ case "Equal":
1968
+ default:
1969
+ return value === whereClause.value?.[0];
1970
+ }
1971
+ }) ?? true;
1972
+ });
1973
+ }
1974
+ getValueFromCredential(credential, column) {
1975
+ switch (column) {
1976
+ case "context":
1977
+ return credential["@context"];
1978
+ case "credentialType":
1979
+ return credential.type;
1980
+ case "type":
1981
+ return Array.isArray(credential.credentialSubject) ? credential.credentialSubject[0]?.type : credential.credentialSubject?.type;
1982
+ case "value":
1983
+ return JSON.stringify(credential.credentialSubject);
1984
+ case "isObj":
1985
+ return typeof credential.credentialSubject === "object";
1986
+ case "id":
1987
+ return credential.id;
1988
+ case "issuer":
1989
+ return typeof credential.issuer === "string" ? credential.issuer : credential.issuer.id;
1990
+ case "subject":
1991
+ return Array.isArray(credential.credentialSubject) ? credential.credentialSubject[0]?.id : credential.credentialSubject?.id;
1992
+ case "expirationDate":
1993
+ return credential.expirationDate;
1994
+ case "issuanceDate":
1995
+ return credential.issuanceDate;
1996
+ default:
1997
+ return void 0;
1998
+ }
1999
+ }
2000
+ /**
2001
+ * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
2002
+ * @param args
2003
+ */
2004
+ async crsGetCredentialsByClaimsCount(args) {
2005
+ const credentialsByClaims = await this.crsGetCredentialsByClaims(args);
2006
+ return credentialsByClaims.length;
2007
+ }
2008
+ secureParse(original) {
2009
+ return (0, import_ssi_sdk2.parseRawDocument)(original);
2010
+ }
2011
+ toUniqueCredentials(credentials) {
2012
+ return Object.values(credentials.reduce((accumulator, credential) => {
2013
+ const uniqueCredential = {
2014
+ hash: credential.hash,
2015
+ digitalCredential: credential
2016
+ };
2017
+ switch (credential.documentType) {
2018
+ case import_ssi_sdk2.DocumentType.VC:
2019
+ uniqueCredential.originalVerifiableCredential = this.secureParse(credential.rawDocument);
2020
+ uniqueCredential.uniformVerifiableCredential = this.secureParse(credential.uniformDocument);
2021
+ uniqueCredential.id = uniqueCredential.uniformVerifiableCredential?.id;
2022
+ break;
2023
+ case import_ssi_sdk2.DocumentType.VP:
2024
+ uniqueCredential.originalVerifiablePresentation = this.secureParse(credential.rawDocument);
2025
+ uniqueCredential.uniformVerifiablePresentation = this.secureParse(credential.uniformDocument);
2026
+ uniqueCredential.id = uniqueCredential.uniformVerifiablePresentation?.id;
2027
+ break;
2028
+ case import_ssi_sdk2.DocumentType.P:
2029
+ uniqueCredential.originalPresentation = this.secureParse(credential.rawDocument);
2030
+ uniqueCredential.id = uniqueCredential.originalPresentation?.id;
2031
+ break;
2032
+ case import_ssi_sdk2.DocumentType.C:
2033
+ uniqueCredential.originalCredential = this.secureParse(credential.rawDocument);
2034
+ uniqueCredential.id = uniqueCredential.originalCredential?.id;
2035
+ break;
2036
+ }
2037
+ accumulator[credential.hash] = uniqueCredential;
2038
+ return accumulator;
2039
+ }, {}));
2040
+ }
2041
+ };
2042
+
2043
+ // src/index.ts
2044
+ var import_ssi_sdk5 = require("@sphereon/ssi-sdk.data-store");
2045
+
2046
+ // src/types/ICredentialStore.ts
2047
+ var import_ssi_sdk4 = require("@sphereon/ssi-sdk.agent-config");
2048
+ function contextHasCredentialStore(context) {
2049
+ return (0, import_ssi_sdk4.contextHasPlugin)(context, "crsGetCredential");
2050
+ }
2051
+ __name(contextHasCredentialStore, "contextHasCredentialStore");
2052
+
2053
+ // src/index.ts
2054
+ var schema = require_plugin_schema();
2055
+ var logger = import_ssi_types.Loggers.DEFAULT.get("sphereon:credential-store");
2056
+ //# sourceMappingURL=index.cjs.map