@sphereon/ssi-sdk.credential-store 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.3

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