@sphereon/ssi-sdk.issuance-branding 0.32.1-next.54 → 0.33.1-feature.jose.vcdm.55

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