@sphereon/ssi-sdk.credential-store 0.33.1-next.2 → 0.33.1-next.68

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