@sphereon/ssi-sdk.issuance-branding 0.33.1-next.3 → 0.33.1-next.73

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