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