@sphereon/ssi-sdk.issuance-branding 0.33.0 → 0.33.1-feature.jose.vcdm.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1623 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+
34
+ // plugin.schema.json
35
+ var require_plugin_schema = __commonJS({
36
+ "plugin.schema.json"(exports, module2) {
37
+ module2.exports = {
38
+ IIssuanceBranding: {
39
+ components: {
40
+ schemas: {
41
+ IAddCredentialBrandingArgs: {
42
+ type: "object",
43
+ properties: {
44
+ issuerCorrelationId: {
45
+ type: "string"
46
+ },
47
+ vcHash: {
48
+ type: "string"
49
+ },
50
+ localeBranding: {
51
+ type: "array",
52
+ items: {
53
+ $ref: "#/components/schemas/IBasicCredentialLocaleBranding"
54
+ }
55
+ }
56
+ },
57
+ required: [
58
+ "issuerCorrelationId",
59
+ "vcHash",
60
+ "localeBranding"
61
+ ],
62
+ additionalProperties: false
63
+ },
64
+ IBasicCredentialLocaleBranding: {
65
+ type: "object",
66
+ properties: {
67
+ alias: {
68
+ type: "string"
69
+ },
70
+ locale: {
71
+ type: "string"
72
+ },
73
+ description: {
74
+ type: "string"
75
+ },
76
+ logo: {
77
+ $ref: "#/components/schemas/IBasicImageAttributes"
78
+ },
79
+ background: {
80
+ $ref: "#/components/schemas/IBasicBackgroundAttributes"
81
+ },
82
+ text: {
83
+ $ref: "#/components/schemas/IBasicTextAttributes"
84
+ },
85
+ claims: {
86
+ type: "array",
87
+ items: {
88
+ $ref: "#/components/schemas/IBasicCredentialClaim"
89
+ }
90
+ }
91
+ },
92
+ additionalProperties: false
93
+ },
94
+ IBasicImageAttributes: {
95
+ type: "object",
96
+ properties: {
97
+ uri: {
98
+ type: "string"
99
+ },
100
+ dataUri: {
101
+ type: "string"
102
+ },
103
+ mediaType: {
104
+ type: "string"
105
+ },
106
+ alt: {
107
+ type: "string"
108
+ },
109
+ dimensions: {
110
+ $ref: "#/components/schemas/IBasicImageDimensions"
111
+ }
112
+ },
113
+ additionalProperties: false
114
+ },
115
+ IBasicImageDimensions: {
116
+ type: "object",
117
+ additionalProperties: false,
118
+ properties: {
119
+ width: {
120
+ type: "number"
121
+ },
122
+ height: {
123
+ type: "number"
124
+ }
125
+ },
126
+ required: [
127
+ "height",
128
+ "width"
129
+ ]
130
+ },
131
+ IBasicBackgroundAttributes: {
132
+ type: "object",
133
+ properties: {
134
+ color: {
135
+ type: "string"
136
+ },
137
+ image: {
138
+ $ref: "#/components/schemas/IBasicImageAttributes"
139
+ }
140
+ },
141
+ additionalProperties: false
142
+ },
143
+ IBasicTextAttributes: {
144
+ type: "object",
145
+ additionalProperties: false,
146
+ properties: {
147
+ color: {
148
+ type: "string"
149
+ }
150
+ }
151
+ },
152
+ IBasicCredentialClaim: {
153
+ type: "object",
154
+ additionalProperties: false,
155
+ properties: {
156
+ key: {
157
+ type: "string"
158
+ },
159
+ name: {
160
+ type: "string"
161
+ }
162
+ },
163
+ required: [
164
+ "key",
165
+ "name"
166
+ ]
167
+ },
168
+ ICredentialBranding: {
169
+ type: "object",
170
+ properties: {
171
+ id: {
172
+ type: "string"
173
+ },
174
+ issuerCorrelationId: {
175
+ type: "string"
176
+ },
177
+ vcHash: {
178
+ type: "string"
179
+ },
180
+ localeBranding: {
181
+ type: "array",
182
+ items: {
183
+ $ref: "#/components/schemas/ICredentialLocaleBranding"
184
+ }
185
+ },
186
+ createdAt: {
187
+ type: "string",
188
+ format: "date-time"
189
+ },
190
+ lastUpdatedAt: {
191
+ type: "string",
192
+ format: "date-time"
193
+ }
194
+ },
195
+ required: [
196
+ "id",
197
+ "issuerCorrelationId",
198
+ "vcHash",
199
+ "localeBranding",
200
+ "createdAt",
201
+ "lastUpdatedAt"
202
+ ],
203
+ additionalProperties: false
204
+ },
205
+ ICredentialLocaleBranding: {
206
+ type: "object",
207
+ properties: {
208
+ id: {
209
+ type: "string"
210
+ },
211
+ alias: {
212
+ type: "string"
213
+ },
214
+ locale: {
215
+ type: "string"
216
+ },
217
+ logo: {
218
+ $ref: "#/components/schemas/IImageAttributes"
219
+ },
220
+ description: {
221
+ type: "string"
222
+ },
223
+ background: {
224
+ $ref: "#/components/schemas/IBackgroundAttributes"
225
+ },
226
+ text: {
227
+ $ref: "#/components/schemas/ITextAttributes"
228
+ },
229
+ createdAt: {
230
+ type: "string",
231
+ format: "date-time"
232
+ },
233
+ lastUpdatedAt: {
234
+ type: "string",
235
+ format: "date-time"
236
+ },
237
+ claims: {
238
+ type: "array",
239
+ items: {
240
+ $ref: "#/components/schemas/ICredentialClaim"
241
+ }
242
+ }
243
+ },
244
+ additionalProperties: false,
245
+ required: [
246
+ "createdAt",
247
+ "id",
248
+ "lastUpdatedAt"
249
+ ]
250
+ },
251
+ IImageAttributes: {
252
+ type: "object",
253
+ properties: {
254
+ id: {
255
+ type: "string"
256
+ },
257
+ uri: {
258
+ type: "string"
259
+ },
260
+ dataUri: {
261
+ type: "string"
262
+ },
263
+ mediaType: {
264
+ type: "string"
265
+ },
266
+ alt: {
267
+ type: "string"
268
+ },
269
+ dimensions: {
270
+ $ref: "#/components/schemas/IImageDimensions"
271
+ }
272
+ },
273
+ required: [
274
+ "id"
275
+ ],
276
+ additionalProperties: false
277
+ },
278
+ IImageDimensions: {
279
+ type: "object",
280
+ properties: {
281
+ id: {
282
+ type: "string"
283
+ },
284
+ width: {
285
+ type: "number"
286
+ },
287
+ height: {
288
+ type: "number"
289
+ }
290
+ },
291
+ required: [
292
+ "id",
293
+ "width",
294
+ "height"
295
+ ],
296
+ additionalProperties: false
297
+ },
298
+ IBackgroundAttributes: {
299
+ type: "object",
300
+ properties: {
301
+ id: {
302
+ type: "string"
303
+ },
304
+ color: {
305
+ type: "string"
306
+ },
307
+ image: {
308
+ $ref: "#/components/schemas/IImageAttributes"
309
+ }
310
+ },
311
+ required: [
312
+ "id"
313
+ ],
314
+ additionalProperties: false
315
+ },
316
+ ITextAttributes: {
317
+ type: "object",
318
+ properties: {
319
+ id: {
320
+ type: "string"
321
+ },
322
+ color: {
323
+ type: "string"
324
+ }
325
+ },
326
+ required: [
327
+ "id"
328
+ ],
329
+ additionalProperties: false
330
+ },
331
+ ICredentialClaim: {
332
+ type: "object",
333
+ properties: {
334
+ id: {
335
+ type: "string"
336
+ },
337
+ key: {
338
+ type: "string"
339
+ },
340
+ name: {
341
+ type: "string"
342
+ }
343
+ },
344
+ required: [
345
+ "id",
346
+ "key",
347
+ "name"
348
+ ],
349
+ additionalProperties: false
350
+ },
351
+ IAddCredentialLocaleBrandingArgs: {
352
+ type: "object",
353
+ properties: {
354
+ credentialBrandingId: {
355
+ type: "string"
356
+ },
357
+ localeBranding: {
358
+ type: "array",
359
+ items: {
360
+ $ref: "#/components/schemas/IBasicCredentialLocaleBranding"
361
+ }
362
+ }
363
+ },
364
+ required: [
365
+ "credentialBrandingId",
366
+ "localeBranding"
367
+ ],
368
+ additionalProperties: false
369
+ },
370
+ IAddIssuerBrandingArgs: {
371
+ type: "object",
372
+ properties: {
373
+ issuerCorrelationId: {
374
+ type: "string"
375
+ },
376
+ localeBranding: {
377
+ type: "array",
378
+ items: {
379
+ $ref: "#/components/schemas/IBasicIssuerLocaleBranding"
380
+ }
381
+ }
382
+ },
383
+ required: [
384
+ "issuerCorrelationId",
385
+ "localeBranding"
386
+ ],
387
+ additionalProperties: false
388
+ },
389
+ IBasicIssuerLocaleBranding: {
390
+ type: "object",
391
+ properties: {
392
+ clientUri: {
393
+ type: "string"
394
+ },
395
+ tosUri: {
396
+ type: "string"
397
+ },
398
+ policyUri: {
399
+ type: "string"
400
+ },
401
+ contacts: {
402
+ type: "array",
403
+ items: {
404
+ type: "string"
405
+ }
406
+ },
407
+ alias: {
408
+ type: "string"
409
+ },
410
+ locale: {
411
+ type: "string"
412
+ },
413
+ description: {
414
+ type: "string"
415
+ },
416
+ logo: {
417
+ $ref: "#/components/schemas/IBasicImageAttributes"
418
+ },
419
+ background: {
420
+ $ref: "#/components/schemas/IBasicBackgroundAttributes"
421
+ },
422
+ text: {
423
+ $ref: "#/components/schemas/IBasicTextAttributes"
424
+ }
425
+ },
426
+ additionalProperties: false
427
+ },
428
+ IIssuerBranding: {
429
+ type: "object",
430
+ properties: {
431
+ id: {
432
+ type: "string"
433
+ },
434
+ issuerCorrelationId: {
435
+ type: "string"
436
+ },
437
+ localeBranding: {
438
+ type: "array",
439
+ items: {
440
+ $ref: "#/components/schemas/IIssuerLocaleBranding"
441
+ }
442
+ },
443
+ createdAt: {
444
+ type: "string",
445
+ format: "date-time"
446
+ },
447
+ lastUpdatedAt: {
448
+ type: "string",
449
+ format: "date-time"
450
+ }
451
+ },
452
+ required: [
453
+ "id",
454
+ "issuerCorrelationId",
455
+ "localeBranding",
456
+ "createdAt",
457
+ "lastUpdatedAt"
458
+ ],
459
+ additionalProperties: false
460
+ },
461
+ IIssuerLocaleBranding: {
462
+ type: "object",
463
+ properties: {
464
+ id: {
465
+ type: "string"
466
+ },
467
+ alias: {
468
+ type: "string"
469
+ },
470
+ locale: {
471
+ type: "string"
472
+ },
473
+ logo: {
474
+ $ref: "#/components/schemas/IImageAttributes"
475
+ },
476
+ description: {
477
+ type: "string"
478
+ },
479
+ background: {
480
+ $ref: "#/components/schemas/IBackgroundAttributes"
481
+ },
482
+ text: {
483
+ $ref: "#/components/schemas/ITextAttributes"
484
+ },
485
+ createdAt: {
486
+ type: "string",
487
+ format: "date-time"
488
+ },
489
+ lastUpdatedAt: {
490
+ type: "string",
491
+ format: "date-time"
492
+ },
493
+ clientUri: {
494
+ type: "string"
495
+ },
496
+ tosUri: {
497
+ type: "string"
498
+ },
499
+ policyUri: {
500
+ type: "string"
501
+ },
502
+ contacts: {
503
+ type: "array",
504
+ items: {
505
+ type: "string"
506
+ }
507
+ }
508
+ },
509
+ additionalProperties: false,
510
+ required: [
511
+ "createdAt",
512
+ "id",
513
+ "lastUpdatedAt"
514
+ ]
515
+ },
516
+ IAddIssuerLocaleBrandingArgs: {
517
+ type: "object",
518
+ properties: {
519
+ issuerBrandingId: {
520
+ type: "string"
521
+ },
522
+ localeBranding: {
523
+ type: "array",
524
+ items: {
525
+ $ref: "#/components/schemas/IBasicIssuerLocaleBranding"
526
+ }
527
+ }
528
+ },
529
+ required: [
530
+ "issuerBrandingId",
531
+ "localeBranding"
532
+ ],
533
+ additionalProperties: false
534
+ },
535
+ ICredentialBrandingFromArgs: {
536
+ type: "object",
537
+ properties: {
538
+ localeBranding: {
539
+ $ref: "#/components/schemas/IBasicCredentialLocaleBranding"
540
+ }
541
+ },
542
+ required: [
543
+ "localeBranding"
544
+ ],
545
+ additionalProperties: false
546
+ },
547
+ IGetCredentialBrandingArgs: {
548
+ type: "object",
549
+ properties: {
550
+ filter: {
551
+ $ref: "#/components/schemas/FindCredentialBrandingArgs"
552
+ }
553
+ },
554
+ additionalProperties: false
555
+ },
556
+ FindCredentialBrandingArgs: {
557
+ type: "array",
558
+ items: {
559
+ $ref: "#/components/schemas/ICredentialBrandingFilter"
560
+ }
561
+ },
562
+ ICredentialBrandingFilter: {
563
+ type: "object",
564
+ additionalProperties: false,
565
+ properties: {
566
+ id: {
567
+ type: "string"
568
+ },
569
+ issuerCorrelationId: {
570
+ type: "string"
571
+ },
572
+ vcHash: {
573
+ type: "string"
574
+ },
575
+ createdAt: {
576
+ type: "string",
577
+ format: "date-time"
578
+ },
579
+ lastUpdatedAt: {
580
+ type: "string",
581
+ format: "date-time"
582
+ },
583
+ localeBranding: {
584
+ $ref: "#/components/schemas/IPartialCredentialLocaleBranding"
585
+ }
586
+ }
587
+ },
588
+ IPartialCredentialLocaleBranding: {
589
+ type: "object",
590
+ properties: {
591
+ id: {
592
+ type: "string"
593
+ },
594
+ alias: {
595
+ type: "string"
596
+ },
597
+ locale: {
598
+ type: "string"
599
+ },
600
+ description: {
601
+ type: "string"
602
+ },
603
+ createdAt: {
604
+ type: "string",
605
+ format: "date-time"
606
+ },
607
+ lastUpdatedAt: {
608
+ type: "string",
609
+ format: "date-time"
610
+ },
611
+ logo: {
612
+ $ref: "#/components/schemas/IPartialImageAttributes"
613
+ },
614
+ background: {
615
+ $ref: "#/components/schemas/IPartialBackgroundAttributes"
616
+ },
617
+ text: {
618
+ $ref: "#/components/schemas/IPartialTextAttributes"
619
+ },
620
+ claims: {
621
+ $ref: "#/components/schemas/IPartialCredentialClaim"
622
+ }
623
+ },
624
+ additionalProperties: false
625
+ },
626
+ IPartialImageAttributes: {
627
+ type: "object",
628
+ properties: {
629
+ id: {
630
+ type: "string"
631
+ },
632
+ uri: {
633
+ type: "string"
634
+ },
635
+ dataUri: {
636
+ type: "string"
637
+ },
638
+ mediaType: {
639
+ type: "string"
640
+ },
641
+ alt: {
642
+ type: "string"
643
+ },
644
+ dimensions: {
645
+ $ref: "#/components/schemas/IPartialImageDimensions"
646
+ }
647
+ },
648
+ additionalProperties: false
649
+ },
650
+ IPartialImageDimensions: {
651
+ type: "object",
652
+ additionalProperties: false,
653
+ properties: {
654
+ id: {
655
+ type: "string"
656
+ },
657
+ width: {
658
+ type: "number"
659
+ },
660
+ height: {
661
+ type: "number"
662
+ }
663
+ }
664
+ },
665
+ IPartialBackgroundAttributes: {
666
+ type: "object",
667
+ properties: {
668
+ id: {
669
+ type: "string"
670
+ },
671
+ color: {
672
+ type: "string"
673
+ },
674
+ image: {
675
+ $ref: "#/components/schemas/IPartialImageAttributes"
676
+ }
677
+ },
678
+ additionalProperties: false
679
+ },
680
+ IPartialTextAttributes: {
681
+ type: "object",
682
+ additionalProperties: false,
683
+ properties: {
684
+ id: {
685
+ type: "string"
686
+ },
687
+ color: {
688
+ type: "string"
689
+ }
690
+ }
691
+ },
692
+ IPartialCredentialClaim: {
693
+ type: "object",
694
+ additionalProperties: false,
695
+ properties: {
696
+ id: {
697
+ type: "string"
698
+ },
699
+ key: {
700
+ type: "string"
701
+ },
702
+ name: {
703
+ type: "string"
704
+ }
705
+ }
706
+ },
707
+ IGetCredentialLocaleBrandingArgs: {
708
+ type: "object",
709
+ properties: {
710
+ filter: {
711
+ $ref: "#/components/schemas/FindCredentialLocaleBrandingArgs"
712
+ }
713
+ },
714
+ additionalProperties: false
715
+ },
716
+ FindCredentialLocaleBrandingArgs: {
717
+ type: "array",
718
+ items: {
719
+ $ref: "#/components/schemas/ICredentialLocaleBrandingFilter"
720
+ }
721
+ },
722
+ ICredentialLocaleBrandingFilter: {
723
+ type: "object",
724
+ properties: {
725
+ id: {
726
+ type: "string"
727
+ },
728
+ alias: {
729
+ type: "string"
730
+ },
731
+ locale: {
732
+ type: "string"
733
+ },
734
+ description: {
735
+ type: "string"
736
+ },
737
+ createdAt: {
738
+ type: "string",
739
+ format: "date-time"
740
+ },
741
+ lastUpdatedAt: {
742
+ type: "string",
743
+ format: "date-time"
744
+ },
745
+ logo: {
746
+ $ref: "#/components/schemas/IPartialImageAttributes"
747
+ },
748
+ background: {
749
+ $ref: "#/components/schemas/IPartialBackgroundAttributes"
750
+ },
751
+ text: {
752
+ $ref: "#/components/schemas/IPartialTextAttributes"
753
+ },
754
+ claims: {
755
+ $ref: "#/components/schemas/IPartialCredentialClaim"
756
+ },
757
+ credentialBranding: {
758
+ $ref: "#/components/schemas/IPartialCredentialBranding"
759
+ }
760
+ },
761
+ additionalProperties: false
762
+ },
763
+ IPartialCredentialBranding: {
764
+ type: "object",
765
+ properties: {
766
+ id: {
767
+ type: "string"
768
+ },
769
+ issuerCorrelationId: {
770
+ type: "string"
771
+ },
772
+ vcHash: {
773
+ type: "string"
774
+ },
775
+ createdAt: {
776
+ type: "string",
777
+ format: "date-time"
778
+ },
779
+ lastUpdatedAt: {
780
+ type: "string",
781
+ format: "date-time"
782
+ },
783
+ localeBranding: {
784
+ $ref: "#/components/schemas/IPartialCredentialLocaleBranding"
785
+ }
786
+ },
787
+ additionalProperties: false
788
+ },
789
+ IGetIssuerBrandingArgs: {
790
+ type: "object",
791
+ properties: {
792
+ filter: {
793
+ $ref: "#/components/schemas/FindIssuerBrandingArgs"
794
+ }
795
+ },
796
+ additionalProperties: false
797
+ },
798
+ FindIssuerBrandingArgs: {
799
+ type: "array",
800
+ items: {
801
+ $ref: "#/components/schemas/IIssuerBrandingFilter"
802
+ }
803
+ },
804
+ IIssuerBrandingFilter: {
805
+ type: "object",
806
+ additionalProperties: false,
807
+ properties: {
808
+ id: {
809
+ type: "string"
810
+ },
811
+ issuerCorrelationId: {
812
+ type: "string"
813
+ },
814
+ createdAt: {
815
+ type: "string",
816
+ format: "date-time"
817
+ },
818
+ lastUpdatedAt: {
819
+ type: "string",
820
+ format: "date-time"
821
+ },
822
+ localeBranding: {
823
+ $ref: "#/components/schemas/IPartialIssuerLocaleBranding"
824
+ }
825
+ }
826
+ },
827
+ IPartialIssuerLocaleBranding: {
828
+ type: "object",
829
+ properties: {
830
+ clientUri: {
831
+ type: "string"
832
+ },
833
+ tosUri: {
834
+ type: "string"
835
+ },
836
+ policyUri: {
837
+ type: "string"
838
+ },
839
+ id: {
840
+ type: "string"
841
+ },
842
+ alias: {
843
+ type: "string"
844
+ },
845
+ locale: {
846
+ type: "string"
847
+ },
848
+ description: {
849
+ type: "string"
850
+ },
851
+ createdAt: {
852
+ type: "string",
853
+ format: "date-time"
854
+ },
855
+ lastUpdatedAt: {
856
+ type: "string",
857
+ format: "date-time"
858
+ },
859
+ logo: {
860
+ $ref: "#/components/schemas/IPartialImageAttributes"
861
+ },
862
+ background: {
863
+ $ref: "#/components/schemas/IPartialBackgroundAttributes"
864
+ },
865
+ text: {
866
+ $ref: "#/components/schemas/IPartialTextAttributes"
867
+ },
868
+ contacts: {
869
+ type: "string"
870
+ }
871
+ },
872
+ additionalProperties: false
873
+ },
874
+ IGetIssuerLocaleBrandingArgs: {
875
+ type: "object",
876
+ properties: {
877
+ filter: {
878
+ $ref: "#/components/schemas/FindIssuerLocaleBrandingArgs"
879
+ }
880
+ },
881
+ additionalProperties: false
882
+ },
883
+ FindIssuerLocaleBrandingArgs: {
884
+ type: "array",
885
+ items: {
886
+ $ref: "#/components/schemas/IIssuerLocaleBrandingFilter"
887
+ }
888
+ },
889
+ IIssuerLocaleBrandingFilter: {
890
+ type: "object",
891
+ properties: {
892
+ clientUri: {
893
+ type: "string"
894
+ },
895
+ tosUri: {
896
+ type: "string"
897
+ },
898
+ policyUri: {
899
+ type: "string"
900
+ },
901
+ id: {
902
+ type: "string"
903
+ },
904
+ alias: {
905
+ type: "string"
906
+ },
907
+ locale: {
908
+ type: "string"
909
+ },
910
+ description: {
911
+ type: "string"
912
+ },
913
+ createdAt: {
914
+ type: "string",
915
+ format: "date-time"
916
+ },
917
+ lastUpdatedAt: {
918
+ type: "string",
919
+ format: "date-time"
920
+ },
921
+ logo: {
922
+ $ref: "#/components/schemas/IPartialImageAttributes"
923
+ },
924
+ background: {
925
+ $ref: "#/components/schemas/IPartialBackgroundAttributes"
926
+ },
927
+ text: {
928
+ $ref: "#/components/schemas/IPartialTextAttributes"
929
+ },
930
+ contacts: {
931
+ type: "string"
932
+ },
933
+ issuerBranding: {
934
+ $ref: "#/components/schemas/IPartialIssuerBranding"
935
+ }
936
+ },
937
+ additionalProperties: false
938
+ },
939
+ IPartialIssuerBranding: {
940
+ type: "object",
941
+ properties: {
942
+ id: {
943
+ type: "string"
944
+ },
945
+ issuerCorrelationId: {
946
+ type: "string"
947
+ },
948
+ createdAt: {
949
+ type: "string",
950
+ format: "date-time"
951
+ },
952
+ lastUpdatedAt: {
953
+ type: "string",
954
+ format: "date-time"
955
+ },
956
+ localeBranding: {
957
+ $ref: "#/components/schemas/IPartialIssuerLocaleBranding"
958
+ }
959
+ },
960
+ additionalProperties: false
961
+ },
962
+ IIssuerBrandingFromArgs: {
963
+ type: "object",
964
+ properties: {
965
+ localeBranding: {
966
+ $ref: "#/components/schemas/IBasicIssuerLocaleBranding"
967
+ }
968
+ },
969
+ required: [
970
+ "localeBranding"
971
+ ],
972
+ additionalProperties: false
973
+ },
974
+ IRemoveCredentialBrandingArgs: {
975
+ type: "object",
976
+ properties: {
977
+ filter: {
978
+ $ref: "#/components/schemas/FindCredentialBrandingArgs"
979
+ }
980
+ },
981
+ required: [
982
+ "filter"
983
+ ],
984
+ additionalProperties: false
985
+ },
986
+ IDeletionResult: {
987
+ type: "object",
988
+ properties: {
989
+ result: {
990
+ type: "boolean"
991
+ },
992
+ error: {
993
+ type: "string"
994
+ }
995
+ },
996
+ required: [
997
+ "result"
998
+ ],
999
+ additionalProperties: false
1000
+ },
1001
+ IRemoveCredentialLocaleBrandingArgs: {
1002
+ type: "object",
1003
+ properties: {
1004
+ filter: {
1005
+ $ref: "#/components/schemas/FindCredentialLocaleBrandingArgs"
1006
+ }
1007
+ },
1008
+ required: [
1009
+ "filter"
1010
+ ],
1011
+ additionalProperties: false
1012
+ },
1013
+ IRemoveIssuerBrandingArgs: {
1014
+ type: "object",
1015
+ properties: {
1016
+ filter: {
1017
+ $ref: "#/components/schemas/FindIssuerBrandingArgs"
1018
+ }
1019
+ },
1020
+ required: [
1021
+ "filter"
1022
+ ],
1023
+ additionalProperties: false
1024
+ },
1025
+ IRemoveIssuerLocaleBrandingArgs: {
1026
+ type: "object",
1027
+ properties: {
1028
+ filter: {
1029
+ $ref: "#/components/schemas/FindIssuerLocaleBrandingArgs"
1030
+ }
1031
+ },
1032
+ required: [
1033
+ "filter"
1034
+ ],
1035
+ additionalProperties: false
1036
+ },
1037
+ IUpdateCredentialBrandingArgs: {
1038
+ type: "object",
1039
+ properties: {
1040
+ credentialBranding: {
1041
+ $ref: '#/components/schemas/Omit<ICredentialBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>'
1042
+ }
1043
+ },
1044
+ required: [
1045
+ "credentialBranding"
1046
+ ],
1047
+ additionalProperties: false
1048
+ },
1049
+ 'Omit<ICredentialBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>': {
1050
+ $ref: '#/components/schemas/Pick<ICredentialBranding,Exclude<("id"|"issuerCorrelationId"|"vcHash"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>'
1051
+ },
1052
+ 'Pick<ICredentialBranding,Exclude<("id"|"issuerCorrelationId"|"vcHash"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>': {
1053
+ type: "object",
1054
+ properties: {
1055
+ id: {
1056
+ type: "string"
1057
+ },
1058
+ issuerCorrelationId: {
1059
+ type: "string"
1060
+ },
1061
+ vcHash: {
1062
+ type: "string"
1063
+ }
1064
+ },
1065
+ required: [
1066
+ "id",
1067
+ "issuerCorrelationId",
1068
+ "vcHash"
1069
+ ],
1070
+ additionalProperties: false
1071
+ },
1072
+ IUpdateCredentialLocaleBrandingArgs: {
1073
+ type: "object",
1074
+ properties: {
1075
+ localeBranding: {
1076
+ $ref: '#/components/schemas/Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>'
1077
+ }
1078
+ },
1079
+ required: [
1080
+ "localeBranding"
1081
+ ],
1082
+ additionalProperties: false
1083
+ },
1084
+ 'Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>': {
1085
+ $ref: '#/components/schemas/Pick<ILocaleBranding,Exclude<("id"|"alias"|"locale"|"logo"|"description"|"background"|"text"|"createdAt"|"lastUpdatedAt"),("createdAt"|"lastUpdatedAt")>>'
1086
+ },
1087
+ 'Pick<ILocaleBranding,Exclude<("id"|"alias"|"locale"|"logo"|"description"|"background"|"text"|"createdAt"|"lastUpdatedAt"),("createdAt"|"lastUpdatedAt")>>': {
1088
+ type: "object",
1089
+ properties: {
1090
+ id: {
1091
+ type: "string"
1092
+ },
1093
+ alias: {
1094
+ type: "string"
1095
+ },
1096
+ locale: {
1097
+ type: "string"
1098
+ },
1099
+ logo: {
1100
+ $ref: "#/components/schemas/IImageAttributes"
1101
+ },
1102
+ description: {
1103
+ type: "string"
1104
+ },
1105
+ background: {
1106
+ $ref: "#/components/schemas/IBackgroundAttributes"
1107
+ },
1108
+ text: {
1109
+ $ref: "#/components/schemas/ITextAttributes"
1110
+ }
1111
+ },
1112
+ required: [
1113
+ "id"
1114
+ ],
1115
+ additionalProperties: false
1116
+ },
1117
+ IUpdateIssuerBrandingArgs: {
1118
+ type: "object",
1119
+ properties: {
1120
+ issuerBranding: {
1121
+ $ref: '#/components/schemas/Omit<IIssuerBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>'
1122
+ }
1123
+ },
1124
+ required: [
1125
+ "issuerBranding"
1126
+ ],
1127
+ additionalProperties: false
1128
+ },
1129
+ 'Omit<IIssuerBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>': {
1130
+ $ref: '#/components/schemas/Pick<IIssuerBranding,Exclude<("id"|"issuerCorrelationId"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>'
1131
+ },
1132
+ 'Pick<IIssuerBranding,Exclude<("id"|"issuerCorrelationId"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>': {
1133
+ type: "object",
1134
+ properties: {
1135
+ id: {
1136
+ type: "string"
1137
+ },
1138
+ issuerCorrelationId: {
1139
+ type: "string"
1140
+ }
1141
+ },
1142
+ required: [
1143
+ "id",
1144
+ "issuerCorrelationId"
1145
+ ],
1146
+ additionalProperties: false
1147
+ },
1148
+ IUpdateIssuerLocaleBrandingArgs: {
1149
+ type: "object",
1150
+ properties: {
1151
+ localeBranding: {
1152
+ $ref: '#/components/schemas/Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>'
1153
+ }
1154
+ },
1155
+ required: [
1156
+ "localeBranding"
1157
+ ],
1158
+ additionalProperties: false
1159
+ }
1160
+ },
1161
+ methods: {
1162
+ ibAddCredentialBranding: {
1163
+ description: "",
1164
+ arguments: {
1165
+ $ref: "#/components/schemas/IAddCredentialBrandingArgs"
1166
+ },
1167
+ returnType: {
1168
+ $ref: "#/components/schemas/ICredentialBranding"
1169
+ }
1170
+ },
1171
+ ibAddCredentialLocaleBranding: {
1172
+ description: "",
1173
+ arguments: {
1174
+ $ref: "#/components/schemas/IAddCredentialLocaleBrandingArgs"
1175
+ },
1176
+ returnType: {
1177
+ $ref: "#/components/schemas/ICredentialBranding"
1178
+ }
1179
+ },
1180
+ ibAddIssuerBranding: {
1181
+ description: "",
1182
+ arguments: {
1183
+ $ref: "#/components/schemas/IAddIssuerBrandingArgs"
1184
+ },
1185
+ returnType: {
1186
+ $ref: "#/components/schemas/IIssuerBranding"
1187
+ }
1188
+ },
1189
+ ibAddIssuerLocaleBranding: {
1190
+ description: "",
1191
+ arguments: {
1192
+ $ref: "#/components/schemas/IAddIssuerLocaleBrandingArgs"
1193
+ },
1194
+ returnType: {
1195
+ $ref: "#/components/schemas/IIssuerBranding"
1196
+ }
1197
+ },
1198
+ ibCredentialLocaleBrandingFrom: {
1199
+ description: "",
1200
+ arguments: {
1201
+ $ref: "#/components/schemas/ICredentialBrandingFromArgs"
1202
+ },
1203
+ returnType: {
1204
+ $ref: "#/components/schemas/IBasicCredentialLocaleBranding"
1205
+ }
1206
+ },
1207
+ ibGetCredentialBranding: {
1208
+ description: "",
1209
+ arguments: {
1210
+ $ref: "#/components/schemas/IGetCredentialBrandingArgs"
1211
+ },
1212
+ returnType: {
1213
+ type: "array",
1214
+ items: {
1215
+ $ref: "#/components/schemas/ICredentialBranding"
1216
+ }
1217
+ }
1218
+ },
1219
+ ibGetCredentialLocaleBranding: {
1220
+ description: "",
1221
+ arguments: {
1222
+ $ref: "#/components/schemas/IGetCredentialLocaleBrandingArgs"
1223
+ },
1224
+ returnType: {
1225
+ type: "array",
1226
+ items: {
1227
+ $ref: "#/components/schemas/ICredentialLocaleBranding"
1228
+ }
1229
+ }
1230
+ },
1231
+ ibGetIssuerBranding: {
1232
+ description: "",
1233
+ arguments: {
1234
+ $ref: "#/components/schemas/IGetIssuerBrandingArgs"
1235
+ },
1236
+ returnType: {
1237
+ type: "array",
1238
+ items: {
1239
+ $ref: "#/components/schemas/IIssuerBranding"
1240
+ }
1241
+ }
1242
+ },
1243
+ ibGetIssuerLocaleBranding: {
1244
+ description: "",
1245
+ arguments: {
1246
+ $ref: "#/components/schemas/IGetIssuerLocaleBrandingArgs"
1247
+ },
1248
+ returnType: {
1249
+ type: "array",
1250
+ items: {
1251
+ $ref: "#/components/schemas/IIssuerLocaleBranding"
1252
+ }
1253
+ }
1254
+ },
1255
+ ibIssuerLocaleBrandingFrom: {
1256
+ description: "",
1257
+ arguments: {
1258
+ $ref: "#/components/schemas/IIssuerBrandingFromArgs"
1259
+ },
1260
+ returnType: {
1261
+ $ref: "#/components/schemas/IBasicIssuerLocaleBranding"
1262
+ }
1263
+ },
1264
+ ibRemoveCredentialBranding: {
1265
+ description: "",
1266
+ arguments: {
1267
+ $ref: "#/components/schemas/IRemoveCredentialBrandingArgs"
1268
+ },
1269
+ returnType: {
1270
+ $ref: "#/components/schemas/IDeletionResult"
1271
+ }
1272
+ },
1273
+ ibRemoveCredentialLocaleBranding: {
1274
+ description: "",
1275
+ arguments: {
1276
+ $ref: "#/components/schemas/IRemoveCredentialLocaleBrandingArgs"
1277
+ },
1278
+ returnType: {
1279
+ $ref: "#/components/schemas/IDeletionResult"
1280
+ }
1281
+ },
1282
+ ibRemoveIssuerBranding: {
1283
+ description: "",
1284
+ arguments: {
1285
+ $ref: "#/components/schemas/IRemoveIssuerBrandingArgs"
1286
+ },
1287
+ returnType: {
1288
+ $ref: "#/components/schemas/IDeletionResult"
1289
+ }
1290
+ },
1291
+ ibRemoveIssuerLocaleBranding: {
1292
+ description: "",
1293
+ arguments: {
1294
+ $ref: "#/components/schemas/IRemoveIssuerLocaleBrandingArgs"
1295
+ },
1296
+ returnType: {
1297
+ $ref: "#/components/schemas/IDeletionResult"
1298
+ }
1299
+ },
1300
+ ibUpdateCredentialBranding: {
1301
+ description: "",
1302
+ arguments: {
1303
+ $ref: "#/components/schemas/IUpdateCredentialBrandingArgs"
1304
+ },
1305
+ returnType: {
1306
+ $ref: "#/components/schemas/ICredentialBranding"
1307
+ }
1308
+ },
1309
+ ibUpdateCredentialLocaleBranding: {
1310
+ description: "",
1311
+ arguments: {
1312
+ $ref: "#/components/schemas/IUpdateCredentialLocaleBrandingArgs"
1313
+ },
1314
+ returnType: {
1315
+ $ref: "#/components/schemas/ICredentialLocaleBranding"
1316
+ }
1317
+ },
1318
+ ibUpdateIssuerBranding: {
1319
+ description: "",
1320
+ arguments: {
1321
+ $ref: "#/components/schemas/IUpdateIssuerBrandingArgs"
1322
+ },
1323
+ returnType: {
1324
+ $ref: "#/components/schemas/IIssuerBranding"
1325
+ }
1326
+ },
1327
+ ibUpdateIssuerLocaleBranding: {
1328
+ description: "",
1329
+ arguments: {
1330
+ $ref: "#/components/schemas/IUpdateIssuerLocaleBrandingArgs"
1331
+ },
1332
+ returnType: {
1333
+ $ref: "#/components/schemas/IIssuerLocaleBranding"
1334
+ }
1335
+ }
1336
+ }
1337
+ }
1338
+ }
1339
+ };
1340
+ }
1341
+ });
1342
+
1343
+ // src/index.ts
1344
+ var index_exports = {};
1345
+ __export(index_exports, {
1346
+ IssuanceBranding: () => IssuanceBranding,
1347
+ issuanceBrandingMethods: () => issuanceBrandingMethods,
1348
+ schema: () => schema
1349
+ });
1350
+ module.exports = __toCommonJS(index_exports);
1351
+
1352
+ // src/agent/IssuanceBranding.ts
1353
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
1354
+ var import_debug = __toESM(require("debug"), 1);
1355
+ var debug = (0, import_debug.default)("sphereon:ssi-sdk:issuance-branding");
1356
+ var issuanceBrandingMethods = [
1357
+ "ibAddCredentialBranding",
1358
+ "ibGetCredentialBranding",
1359
+ "ibUpdateCredentialBranding",
1360
+ "ibRemoveCredentialBranding",
1361
+ "ibAddCredentialLocaleBranding",
1362
+ "ibGetCredentialLocaleBranding",
1363
+ "ibRemoveCredentialLocaleBranding",
1364
+ "ibUpdateCredentialLocaleBranding",
1365
+ "ibCredentialLocaleBrandingFrom",
1366
+ "ibAddIssuerBranding",
1367
+ "ibGetIssuerBranding",
1368
+ "ibUpdateIssuerBranding",
1369
+ "ibRemoveIssuerBranding",
1370
+ "ibAddIssuerLocaleBranding",
1371
+ "ibGetIssuerLocaleBranding",
1372
+ "ibRemoveIssuerLocaleBranding",
1373
+ "ibUpdateIssuerLocaleBranding",
1374
+ "ibIssuerLocaleBrandingFrom"
1375
+ ];
1376
+ var EMPTY_IMAGE_ATTRIBUTES = {
1377
+ mediaType: void 0,
1378
+ dataUri: void 0,
1379
+ dimensions: void 0
1380
+ };
1381
+ var IssuanceBranding = class {
1382
+ static {
1383
+ __name(this, "IssuanceBranding");
1384
+ }
1385
+ schema = schema.IIssuanceBranding;
1386
+ methods = {
1387
+ ibAddCredentialBranding: this.ibAddCredentialBranding.bind(this),
1388
+ ibGetCredentialBranding: this.ibGetCredentialBranding.bind(this),
1389
+ ibUpdateCredentialBranding: this.ibUpdateCredentialBranding.bind(this),
1390
+ ibRemoveCredentialBranding: this.ibRemoveCredentialBranding.bind(this),
1391
+ ibAddCredentialLocaleBranding: this.ibAddCredentialLocaleBranding.bind(this),
1392
+ ibGetCredentialLocaleBranding: this.ibGetCredentialLocaleBranding.bind(this),
1393
+ ibRemoveCredentialLocaleBranding: this.ibRemoveCredentialLocaleBranding.bind(this),
1394
+ ibUpdateCredentialLocaleBranding: this.ibUpdateCredentialLocaleBranding.bind(this),
1395
+ ibCredentialLocaleBrandingFrom: this.ibCredentialLocaleBrandingFrom.bind(this),
1396
+ ibAddIssuerBranding: this.ibAddIssuerBranding.bind(this),
1397
+ ibGetIssuerBranding: this.ibGetIssuerBranding.bind(this),
1398
+ ibUpdateIssuerBranding: this.ibUpdateIssuerBranding.bind(this),
1399
+ ibRemoveIssuerBranding: this.inRemoveIssuerBranding.bind(this),
1400
+ ibAddIssuerLocaleBranding: this.ibAddIssuerLocaleBranding.bind(this),
1401
+ ibGetIssuerLocaleBranding: this.ibAGetIssuerLocaleBranding.bind(this),
1402
+ ibRemoveIssuerLocaleBranding: this.ibRemoveIssuerLocaleBranding.bind(this),
1403
+ ibUpdateIssuerLocaleBranding: this.ibUpdateIssuerLocaleBranding.bind(this),
1404
+ ibIssuerLocaleBrandingFrom: this.ibIssuerLocaleBrandingFrom.bind(this)
1405
+ };
1406
+ store;
1407
+ constructor(options) {
1408
+ this.store = options.store;
1409
+ }
1410
+ /** {@inheritDoc IIssuanceBranding.ibAddCredentialBranding} */
1411
+ async ibAddCredentialBranding(args, context) {
1412
+ const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2)));
1413
+ const credentialBranding = {
1414
+ ...args,
1415
+ localeBranding
1416
+ };
1417
+ debug("Adding credential branding", credentialBranding);
1418
+ return this.store.addCredentialBranding(credentialBranding);
1419
+ }
1420
+ /** {@inheritDoc IIssuanceBranding.ibGetCredentialBranding} */
1421
+ async ibGetCredentialBranding(args) {
1422
+ debug("Getting credential branding", args);
1423
+ return this.store.getCredentialBranding(args);
1424
+ }
1425
+ /** {@inheritDoc IIssuanceBranding.ibUpdateCredentialBranding} */
1426
+ async ibUpdateCredentialBranding(args, context) {
1427
+ debug("Updating credential branding", args);
1428
+ return this.store.updateCredentialBranding(args);
1429
+ }
1430
+ /** {@inheritDoc IIssuanceBranding.ibRemoveCredentialBranding} */
1431
+ async ibRemoveCredentialBranding(args, context) {
1432
+ debug("Removing credential branding", args);
1433
+ return this.store.removeCredentialBranding(args).then(() => ({
1434
+ result: true
1435
+ })).catch((error) => ({
1436
+ result: false,
1437
+ error: error.message
1438
+ }));
1439
+ }
1440
+ /** {@inheritDoc IIssuanceBranding.ibAddCredentialLocaleBranding} */
1441
+ async ibAddCredentialLocaleBranding(args, context) {
1442
+ const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2)));
1443
+ const addCredentialLocaleBrandingArgs = {
1444
+ ...args,
1445
+ localeBranding
1446
+ };
1447
+ debug("Adding credential locale branding", addCredentialLocaleBrandingArgs);
1448
+ return this.store.addCredentialLocaleBranding(addCredentialLocaleBrandingArgs);
1449
+ }
1450
+ /** {@inheritDoc IIssuanceBranding.ibGetCredentialLocaleBranding} */
1451
+ async ibGetCredentialLocaleBranding(args) {
1452
+ debug("Getting credential locale branding", args);
1453
+ return this.store.getCredentialLocaleBranding(args);
1454
+ }
1455
+ /** {@inheritDoc IIssuanceBranding.ibRemoveCredentialLocaleBranding} */
1456
+ async ibRemoveCredentialLocaleBranding(args, context) {
1457
+ debug("Removing credential locale branding", args);
1458
+ return this.store.removeCredentialLocaleBranding(args).then(() => ({
1459
+ result: true
1460
+ })).catch((error) => ({
1461
+ result: false,
1462
+ error: error.message
1463
+ }));
1464
+ }
1465
+ /** {@inheritDoc IIssuanceBranding.ibUpdateCredentialLocaleBranding} */
1466
+ async ibUpdateCredentialLocaleBranding(args, context) {
1467
+ const localeBranding = await this.setAdditionalImageAttributes(args.localeBranding);
1468
+ const updateCredentialLocaleBrandingArgs = {
1469
+ ...args,
1470
+ localeBranding
1471
+ };
1472
+ debug("Updating credential locale branding", updateCredentialLocaleBrandingArgs);
1473
+ return this.store.updateCredentialLocaleBranding(updateCredentialLocaleBrandingArgs);
1474
+ }
1475
+ /** {@inheritDoc IIssuanceBranding.ibCredentialLocaleBrandingFrom} */
1476
+ async ibCredentialLocaleBrandingFrom(args, context) {
1477
+ debug("get credential locale branding from", args);
1478
+ return this.setAdditionalImageAttributes(args.localeBranding);
1479
+ }
1480
+ /** {@inheritDoc IIssuanceBranding.ibAddIssuerBranding} */
1481
+ async ibAddIssuerBranding(args, context) {
1482
+ const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2)));
1483
+ const issuerBranding = {
1484
+ ...args,
1485
+ localeBranding
1486
+ };
1487
+ debug("Adding issuer branding", issuerBranding);
1488
+ return this.store.addIssuerBranding(issuerBranding);
1489
+ }
1490
+ /** {@inheritDoc IIssuanceBranding.ibGetIssuerBranding} */
1491
+ async ibGetIssuerBranding(args) {
1492
+ debug("Getting issuer branding", args);
1493
+ return this.store.getIssuerBranding(args);
1494
+ }
1495
+ /** {@inheritDoc IIssuanceBranding.ibUpdateIssuerBranding} */
1496
+ async ibUpdateIssuerBranding(args, context) {
1497
+ debug("Updating issuer branding", args);
1498
+ return this.store.updateIssuerBranding(args);
1499
+ }
1500
+ /** {@inheritDoc IIssuanceBranding.inRemoveIssuerBranding} */
1501
+ async inRemoveIssuerBranding(args, context) {
1502
+ debug("Removing issuer branding", args);
1503
+ return this.store.removeIssuerBranding(args).then(() => ({
1504
+ result: true
1505
+ })).catch((error) => ({
1506
+ result: false,
1507
+ error: error.message
1508
+ }));
1509
+ }
1510
+ /** {@inheritDoc IIssuanceBranding.ibAddIssuerLocaleBranding} */
1511
+ async ibAddIssuerLocaleBranding(args, context) {
1512
+ const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2)));
1513
+ const addIssuerLocaleBrandingArgs = {
1514
+ ...args,
1515
+ localeBranding
1516
+ };
1517
+ debug("Adding issuer locale branding", addIssuerLocaleBrandingArgs);
1518
+ return this.store.addIssuerLocaleBranding(addIssuerLocaleBrandingArgs);
1519
+ }
1520
+ /** {@inheritDoc IIssuanceBranding.ibAGetIssuerLocaleBranding} */
1521
+ async ibAGetIssuerLocaleBranding(args) {
1522
+ debug("Getting issuer locale branding", args);
1523
+ return this.store.getIssuerLocaleBranding(args);
1524
+ }
1525
+ /** {@inheritDoc IIssuanceBranding.ibRemoveIssuerLocaleBranding} */
1526
+ async ibRemoveIssuerLocaleBranding(args, context) {
1527
+ debug("Removing issuer locale branding", args);
1528
+ return this.store.removeIssuerLocaleBranding(args).then(() => ({
1529
+ result: true
1530
+ })).catch((error) => ({
1531
+ result: false,
1532
+ error: error.message
1533
+ }));
1534
+ }
1535
+ /** {@inheritDoc IIssuanceBranding.ibUpdateIssuerLocaleBranding} */
1536
+ async ibUpdateIssuerLocaleBranding(args, context) {
1537
+ const localeBranding = await this.setAdditionalImageAttributes(args.localeBranding);
1538
+ const updateIssuerLocaleBrandingArgs = {
1539
+ ...args,
1540
+ localeBranding
1541
+ };
1542
+ debug("Updating issuer locale branding", updateIssuerLocaleBrandingArgs);
1543
+ return this.store.updateIssuerLocaleBranding(updateIssuerLocaleBrandingArgs);
1544
+ }
1545
+ /** {@inheritDoc IIssuanceBranding.ibIssuerLocaleBrandingFrom} */
1546
+ async ibIssuerLocaleBrandingFrom(args, context) {
1547
+ debug("get issuer locale branding from", args);
1548
+ return this.setAdditionalImageAttributes(args.localeBranding);
1549
+ }
1550
+ // todo: We really should add a cache for urls. We now fetch the same images multiple times in case the logo/background image is the same for multiple locales.
1551
+ async setAdditionalImageAttributes(localeBranding) {
1552
+ return {
1553
+ ...localeBranding,
1554
+ ...localeBranding.logo && {
1555
+ logo: {
1556
+ ...localeBranding.logo,
1557
+ ...localeBranding.logo.uri ? {
1558
+ ...await this.getAdditionalImageAttributes(localeBranding.logo)
1559
+ } : EMPTY_IMAGE_ATTRIBUTES
1560
+ }
1561
+ },
1562
+ ...localeBranding.background && {
1563
+ background: {
1564
+ ...localeBranding.background,
1565
+ ...localeBranding.background.image && {
1566
+ image: {
1567
+ ...localeBranding.background.image,
1568
+ ...localeBranding.background.image.uri ? {
1569
+ ...await this.getAdditionalImageAttributes(localeBranding.background.image)
1570
+ } : EMPTY_IMAGE_ATTRIBUTES
1571
+ }
1572
+ }
1573
+ }
1574
+ }
1575
+ };
1576
+ }
1577
+ async getAdditionalImageAttributes(image) {
1578
+ if (!image.uri) {
1579
+ debug(`No image URI present, returning empty attributes`);
1580
+ return EMPTY_IMAGE_ATTRIBUTES;
1581
+ }
1582
+ const data_uri_regex = /^data:image\/[^;]+;base64,/;
1583
+ if (data_uri_regex.test(image.uri)) {
1584
+ debug("Setting additional image properties for uri", image.uri);
1585
+ const base64Content = await this.extractBase64FromDataURI(image.uri);
1586
+ const dimensions2 = image.dimensions ?? await (0, import_ssi_sdk.getImageDimensions)(base64Content);
1587
+ const mediaType2 = image.mediaType ?? await this.getDataTypeFromDataURI(image.uri);
1588
+ return {
1589
+ mediaType: mediaType2,
1590
+ dimensions: dimensions2
1591
+ };
1592
+ }
1593
+ debug("Setting additional image properties for url", image.uri);
1594
+ const resource = !image.dataUri ? await (0, import_ssi_sdk.downloadImage)(image.uri) : void 0;
1595
+ const dimensions = image.dimensions ?? await (0, import_ssi_sdk.getImageDimensions)(resource?.base64Content ?? await this.extractBase64FromDataURI(image.dataUri));
1596
+ const mediaType = image.mediaType ?? resource?.contentType ?? (resource?.base64Content ? await (0, import_ssi_sdk.getImageMediaType)(resource?.base64Content) : await this.getDataTypeFromDataURI(image.uri));
1597
+ return {
1598
+ mediaType,
1599
+ dataUri: image.dataUri ?? `data:${mediaType};base64,${resource.base64Content}`,
1600
+ dimensions
1601
+ };
1602
+ }
1603
+ async extractBase64FromDataURI(uri) {
1604
+ const data_uri_base64_regex = /^data:[^;]+;base64,([\w+/=-]+)$/i;
1605
+ const matches = uri.match(data_uri_base64_regex);
1606
+ if (!matches || matches.length <= 1) {
1607
+ return Promise.reject(Error("invalid base64 uri"));
1608
+ }
1609
+ return matches[1];
1610
+ }
1611
+ async getDataTypeFromDataURI(uri) {
1612
+ const data_uri_data_type_regex = /^data:([^;]+);base64,([\w+/=-]+)$/i;
1613
+ const matches = uri.match(data_uri_data_type_regex);
1614
+ if (!matches || matches.length <= 1) {
1615
+ return Promise.reject(Error("invalid base64 uri"));
1616
+ }
1617
+ return matches[1];
1618
+ }
1619
+ };
1620
+
1621
+ // src/index.ts
1622
+ var schema = require_plugin_schema();
1623
+ //# sourceMappingURL=index.cjs.map