@sphereon/ssi-sdk.oid4vci-issuer-store 0.33.0 → 0.33.1-feature.vcdm2.tsup.18

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,712 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // plugin.schema.json
25
+ var require_plugin_schema = __commonJS({
26
+ "plugin.schema.json"(exports2, module2) {
27
+ module2.exports = {
28
+ IDidAuthSiopOpAuthenticator: {
29
+ components: {
30
+ schemas: {
31
+ IGetSiopSessionArgs: {
32
+ type: "object",
33
+ properties: {
34
+ sessionId: {
35
+ type: "string"
36
+ },
37
+ additionalProperties: false
38
+ },
39
+ required: ["sessionId"],
40
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
41
+ },
42
+ IRegisterSiopSessionArgs: {
43
+ type: "object",
44
+ properties: {
45
+ identifier: {
46
+ type: "object",
47
+ properties: {
48
+ did: {
49
+ type: "string"
50
+ },
51
+ alias: {
52
+ type: "string"
53
+ },
54
+ provider: {
55
+ type: "string"
56
+ },
57
+ controllerKeyId: {
58
+ type: "string"
59
+ },
60
+ keys: {
61
+ type: "array",
62
+ items: {
63
+ type: "object",
64
+ properties: {
65
+ additionalProperties: true
66
+ }
67
+ }
68
+ },
69
+ services: {
70
+ type: "array",
71
+ items: {
72
+ type: "object",
73
+ properties: {
74
+ additionalProperties: true
75
+ }
76
+ }
77
+ }
78
+ },
79
+ additionalProperties: false,
80
+ required: ["did", "provider", "keys", "services"]
81
+ },
82
+ sessionId: {
83
+ type: "string"
84
+ },
85
+ expiresIn: {
86
+ type: "number"
87
+ },
88
+ additionalProperties: false
89
+ },
90
+ required: ["identifier"],
91
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
92
+ },
93
+ IRemoveSiopSessionArgs: {
94
+ type: "object",
95
+ properties: {
96
+ sessionId: {
97
+ type: "string"
98
+ },
99
+ additionalProperties: false
100
+ },
101
+ required: ["sessionId"],
102
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
103
+ },
104
+ IAuthenticateWithSiopArgs: {
105
+ type: "object",
106
+ properties: {
107
+ sessionId: {
108
+ type: "string"
109
+ },
110
+ stateId: {
111
+ type: "string"
112
+ },
113
+ redirectUrl: {
114
+ type: "string"
115
+ },
116
+ additionalProperties: false
117
+ },
118
+ required: ["sessionId", "stateId", "redirectUrl"],
119
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
120
+ },
121
+ IResponse: {
122
+ type: "object",
123
+ properties: {
124
+ status: {
125
+ type: "number"
126
+ },
127
+ additionalProperties: true
128
+ },
129
+ required: ["status"],
130
+ description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
131
+ },
132
+ IGetSiopAuthenticationRequestFromRpArgs: {
133
+ type: "object",
134
+ properties: {
135
+ sessionId: {
136
+ type: "string"
137
+ },
138
+ stateId: {
139
+ type: "string"
140
+ },
141
+ redirectUrl: {
142
+ type: "string"
143
+ },
144
+ additionalProperties: false
145
+ },
146
+ required: ["sessionId", "stateId", "redirectUrl"],
147
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
148
+ },
149
+ ParsedAuthenticationRequestURI: {
150
+ type: "object",
151
+ properties: {
152
+ jwt: {
153
+ type: "string"
154
+ },
155
+ requestPayload: {
156
+ type: "object",
157
+ properties: {
158
+ additionalProperties: true
159
+ }
160
+ },
161
+ registration: {
162
+ type: "object",
163
+ properties: {
164
+ additionalProperties: true
165
+ }
166
+ },
167
+ additionalProperties: false
168
+ },
169
+ required: ["jwt", "requestPayload", "registration"],
170
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
171
+ },
172
+ IGetSiopAuthenticationRequestDetailsArgs: {
173
+ type: "object",
174
+ properties: {
175
+ sessionId: {
176
+ type: "string"
177
+ },
178
+ verifiedAuthenticationRequest: {
179
+ type: "object",
180
+ properties: {
181
+ additionalProperties: true
182
+ }
183
+ },
184
+ credentialFilter: {
185
+ type: "object",
186
+ properties: {
187
+ additionalProperties: true
188
+ }
189
+ },
190
+ additionalProperties: false
191
+ },
192
+ required: ["sessionId", "verifiedAuthenticationRequest"],
193
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
194
+ },
195
+ IAuthRequestDetails: {
196
+ type: "object",
197
+ properties: {
198
+ id: {
199
+ type: "string"
200
+ },
201
+ alsoKnownAs: {
202
+ type: "array",
203
+ items: {
204
+ type: "string"
205
+ }
206
+ },
207
+ vpResponseOpts: {
208
+ type: "object",
209
+ properties: {
210
+ additionalProperties: true
211
+ }
212
+ },
213
+ additionalProperties: false
214
+ },
215
+ required: ["id", "vpResponseOpts"],
216
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
217
+ },
218
+ IVerifySiopAuthenticationRequestUriArgs: {
219
+ type: "object",
220
+ properties: {
221
+ sessionId: {
222
+ type: "string"
223
+ },
224
+ ParsedAuthenticationRequestURI: {
225
+ type: "object",
226
+ properties: {
227
+ additionalProperties: true
228
+ }
229
+ },
230
+ additionalProperties: false
231
+ },
232
+ required: ["sessionId", "ParsedAuthenticationRequestURI"],
233
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
234
+ },
235
+ VerifiedAuthorizationRequest: {
236
+ type: "object",
237
+ properties: {
238
+ payload: {
239
+ type: "object",
240
+ properties: {
241
+ additionalProperties: true
242
+ }
243
+ },
244
+ presentationDefinitions: {
245
+ type: "object",
246
+ properties: {
247
+ additionalProperties: true
248
+ }
249
+ },
250
+ verifyOpts: {
251
+ type: "object",
252
+ properties: {
253
+ additionalProperties: true
254
+ }
255
+ },
256
+ additionalProperties: false
257
+ },
258
+ required: ["payload", "verifyOpts"],
259
+ description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
260
+ },
261
+ ISendSiopAuthenticationResponseArgs: {
262
+ type: "object",
263
+ properties: {
264
+ sessionId: {
265
+ type: "string"
266
+ },
267
+ verifiedAuthenticationRequest: {
268
+ type: "object",
269
+ properties: {
270
+ additionalProperties: true
271
+ }
272
+ },
273
+ verifiablePresentationResponse: {
274
+ type: "object",
275
+ properties: {
276
+ additionalProperties: true
277
+ }
278
+ },
279
+ additionalProperties: false
280
+ },
281
+ required: ["sessionId", "verifiedAuthenticationRequest"],
282
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
283
+ }
284
+ },
285
+ methods: {
286
+ getSessionForSiop: {
287
+ description: "Get SIOP session",
288
+ arguments: {
289
+ $ref: "#/components/schemas/IGetSiopSessionArgs"
290
+ },
291
+ returnType: "object"
292
+ },
293
+ registerSessionForSiop: {
294
+ description: "Register SIOP session",
295
+ arguments: {
296
+ $ref: "#/components/schemas/IRegisterSiopSessionArgs"
297
+ },
298
+ returnType: "object"
299
+ },
300
+ removeSessionForSiop: {
301
+ description: "Remove SIOP session",
302
+ arguments: {
303
+ $ref: "#/components/schemas/IRemoveSiopSessionArgs"
304
+ },
305
+ returnType: "boolean"
306
+ },
307
+ authenticateWithSiop: {
308
+ description: "Authenticate using DID Auth SIOP",
309
+ arguments: {
310
+ $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
311
+ },
312
+ returnType: {
313
+ $ref: "#/components/schemas/Response"
314
+ }
315
+ },
316
+ getSiopAuthenticationRequestFromRP: {
317
+ description: "Get authentication request from RP",
318
+ arguments: {
319
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
320
+ },
321
+ returnType: {
322
+ $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
323
+ }
324
+ },
325
+ getSiopAuthenticationRequestDetails: {
326
+ description: "Get authentication request details",
327
+ arguments: {
328
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
329
+ },
330
+ returnType: {
331
+ $ref: "#/components/schemas/IAuthRequestDetails"
332
+ }
333
+ },
334
+ verifySiopAuthenticationRequestURI: {
335
+ description: "Verify authentication request URI",
336
+ arguments: {
337
+ $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
338
+ },
339
+ returnType: {
340
+ $ref: "#/components/schemas/VerifiedAuthorizationRequest"
341
+ }
342
+ },
343
+ sendSiopAuthenticationResponse: {
344
+ description: "Send authentication response",
345
+ arguments: {
346
+ $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
347
+ },
348
+ returnType: {
349
+ $ref: "#/components/schemas/IRequiredContext"
350
+ }
351
+ }
352
+ }
353
+ }
354
+ }
355
+ };
356
+ }
357
+ });
358
+
359
+ // src/index.ts
360
+ var index_exports = {};
361
+ __export(index_exports, {
362
+ OID4VCIStore: () => OID4VCIStore,
363
+ schema: () => schema
364
+ });
365
+ module.exports = __toCommonJS(index_exports);
366
+
367
+ // src/agent/OID4VCIStore.ts
368
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.kv-store-temp");
369
+ var OID4VCIStore = class {
370
+ static {
371
+ __name(this, "OID4VCIStore");
372
+ }
373
+ get defaultOpts() {
374
+ return this._defaultOpts;
375
+ }
376
+ set defaultOpts(value) {
377
+ this._defaultOpts = value;
378
+ }
379
+ _issuerMetadataStores;
380
+ _authorizationServerMetadataStores;
381
+ _optionStores;
382
+ defaultStoreId;
383
+ defaultNamespace;
384
+ _defaultOpts;
385
+ methods = {
386
+ oid4vciStoreDefaultMetadata: this.oid4vciStoreDefaultMetadata.bind(this),
387
+ oid4vciStoreDefaultIssuerOptions: this.oid4vciStoreIssuerOptions.bind(this),
388
+ oid4vciStoreDefaultStoreId: this.oid4vciStoreDefaultStoreId.bind(this),
389
+ oid4vciStoreDefaultNamespace: this.oid4vciStoreDefaultNamespace.bind(this),
390
+ oid4vciStoreGetIssuerOpts: this.oid4vciStoreGetIssuerOpts.bind(this),
391
+ oid4vciStoreHasIssuerOpts: this.oid4vciStoreHasIssuerOpts.bind(this),
392
+ oid4vciStorePersistIssuerOpts: this.oid4vciStorePersistIssuerOpts.bind(this),
393
+ oid4vciStoreRemoveIssuerOpts: this.oid4vciStoreRemoveIssuerOpts.bind(this),
394
+ oid4vciStoreClearAllIssuerOpts: this.oid4vciStoreClearAllIssuerOpts.bind(this),
395
+ oid4vciStoreGetMetadata: this.oid4vciStoreGetMetadata.bind(this),
396
+ oid4vciStoreListMetadata: this.oid4vciStoreListMetadata.bind(this),
397
+ oid4vciStoreHasMetadata: this.oid4vciStoreHasMetadata.bind(this),
398
+ oid4vciStorePersistMetadata: this.oid4vciStorePersistMetadata.bind(this),
399
+ oid4vciStoreRemoveMetadata: this.oid4vciStoreRemoveMetadata.bind(this),
400
+ oid4vciStoreClearAllMetadata: this.oid4vciStoreClearAllMetadata.bind(this)
401
+ };
402
+ constructor(opts) {
403
+ this.defaultStoreId = opts.defaultStore ?? "_default";
404
+ this.defaultNamespace = opts.defaultNamespace ?? "oid4vci";
405
+ if (opts.defaultOpts) {
406
+ this._defaultOpts = opts.defaultOpts;
407
+ }
408
+ if (opts?.issuerMetadataStores && opts.issuerMetadataStores instanceof Map) {
409
+ this._issuerMetadataStores = opts.issuerMetadataStores;
410
+ } else if (opts?.issuerMetadataStores) {
411
+ this._issuerMetadataStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, opts.issuerMetadataStores);
412
+ } else {
413
+ this._issuerMetadataStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new import_ssi_sdk.KeyValueStore({
414
+ namespace: this.defaultNamespace,
415
+ store: /* @__PURE__ */ new Map()
416
+ }));
417
+ }
418
+ if (opts?.authorizationServerMetadataStores && opts.authorizationServerMetadataStores instanceof Map) {
419
+ this._authorizationServerMetadataStores = opts.authorizationServerMetadataStores;
420
+ } else if (opts?.authorizationServerMetadataStores) {
421
+ this._authorizationServerMetadataStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, opts.authorizationServerMetadataStores);
422
+ } else {
423
+ this._authorizationServerMetadataStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new import_ssi_sdk.KeyValueStore({
424
+ namespace: this.defaultNamespace,
425
+ store: /* @__PURE__ */ new Map()
426
+ }));
427
+ }
428
+ if (opts && Array.isArray(opts?.importMetadatas)) {
429
+ opts.importMetadatas.forEach((metaImport) => {
430
+ const meta = metaImport;
431
+ void this.oid4vciStorePersistMetadata({
432
+ metadataType: meta.metadataType,
433
+ metadata: meta.metadata,
434
+ storeId: meta.storeId ?? this.defaultStoreId,
435
+ correlationId: meta.correlationId,
436
+ namespace: meta.namespace ?? this.defaultNamespace,
437
+ overwriteExisting: meta.overwriteExisting === void 0 ? true : meta.overwriteExisting
438
+ });
439
+ });
440
+ }
441
+ if (opts?.issuerOptsStores && opts.issuerOptsStores instanceof Map) {
442
+ this._optionStores = opts.issuerOptsStores;
443
+ } else if (opts?.issuerOptsStores) {
444
+ this._optionStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, opts.issuerOptsStores);
445
+ } else {
446
+ this._optionStores = (/* @__PURE__ */ new Map()).set(this.defaultStoreId, new import_ssi_sdk.KeyValueStore({
447
+ namespace: this.defaultNamespace,
448
+ store: /* @__PURE__ */ new Map()
449
+ }));
450
+ }
451
+ if (opts && Array.isArray(opts?.importIssuerOpts)) {
452
+ opts.importIssuerOpts.forEach((opt) => this.oid4vciStorePersistIssuerOpts(opt));
453
+ }
454
+ }
455
+ async oid4vciStoreGetIssuerOpts({ correlationId, storeId, namespace }) {
456
+ return await this.store({
457
+ stores: this._optionStores,
458
+ storeId
459
+ }).get(this.prefix({
460
+ namespace,
461
+ correlationId
462
+ })) ?? this.defaultOpts;
463
+ }
464
+ importIssuerOpts(importOpts) {
465
+ importOpts.forEach((opt) => this.oid4vciStorePersistIssuerOpts(opt));
466
+ }
467
+ async oid4vciStoreHasIssuerOpts({ correlationId, storeId, namespace }) {
468
+ return this.store({
469
+ stores: this._optionStores,
470
+ storeId
471
+ }).has(this.prefix({
472
+ namespace,
473
+ correlationId
474
+ }));
475
+ }
476
+ async oid4vciStorePersistIssuerOpts(args) {
477
+ const storeId = this.storeIdStr(args);
478
+ const namespace = this.namespaceStr(args);
479
+ const { correlationId, issuerOpts, ttl } = args;
480
+ if (args?.validation !== false) {
481
+ }
482
+ const existing = await this.store({
483
+ stores: this._optionStores,
484
+ storeId
485
+ }).getAsValueData(this.prefix({
486
+ namespace,
487
+ correlationId
488
+ }));
489
+ if (!existing.value || existing.value && args.overwriteExisting !== false) {
490
+ return await this.store({
491
+ stores: this._optionStores,
492
+ storeId
493
+ }).set(this.prefix({
494
+ namespace,
495
+ correlationId
496
+ }), issuerOpts, ttl);
497
+ }
498
+ return existing;
499
+ }
500
+ async oid4vciStoreRemoveIssuerOpts({ storeId, correlationId, namespace }) {
501
+ return this.store({
502
+ stores: this._optionStores,
503
+ storeId
504
+ }).delete(this.prefix({
505
+ namespace,
506
+ correlationId
507
+ }));
508
+ }
509
+ async oid4vciStoreClearAllIssuerOpts({ storeId }) {
510
+ return await this.store({
511
+ stores: this._optionStores,
512
+ storeId
513
+ }).clear().then(() => true);
514
+ }
515
+ async oid4vciStoreGetMetadata({ metadataType, correlationId, storeId, namespace }) {
516
+ switch (metadataType) {
517
+ case "authorizationServer":
518
+ return this.store({
519
+ stores: this._authorizationServerMetadataStores,
520
+ storeId
521
+ }).get(this.prefix({
522
+ namespace,
523
+ correlationId
524
+ }));
525
+ case "issuer":
526
+ return this.store({
527
+ stores: this._issuerMetadataStores,
528
+ storeId
529
+ }).get(this.prefix({
530
+ namespace,
531
+ correlationId
532
+ }));
533
+ }
534
+ return void 0;
535
+ }
536
+ async oid4vciStoreListMetadata({ metadataType, storeId, namespace }) {
537
+ switch (metadataType) {
538
+ case "authorizationServer":
539
+ return this.store({
540
+ stores: this._authorizationServerMetadataStores,
541
+ storeId
542
+ }).getMany([
543
+ `${this.namespaceStr({
544
+ namespace
545
+ })}`
546
+ ]);
547
+ case "issuer":
548
+ return this.store({
549
+ stores: this._issuerMetadataStores,
550
+ storeId
551
+ }).getMany([
552
+ `${this.namespaceStr({
553
+ namespace
554
+ })}`
555
+ ]);
556
+ }
557
+ return [];
558
+ }
559
+ async oid4vciStoreHasMetadata({ metadataType, correlationId, storeId, namespace }) {
560
+ switch (metadataType) {
561
+ case "authorizationServer":
562
+ return this.store({
563
+ stores: this._authorizationServerMetadataStores,
564
+ storeId
565
+ }).has(this.prefix({
566
+ namespace,
567
+ correlationId
568
+ }));
569
+ case "issuer":
570
+ return this.store({
571
+ stores: this._issuerMetadataStores,
572
+ storeId
573
+ }).has(this.prefix({
574
+ namespace,
575
+ correlationId
576
+ }));
577
+ }
578
+ return false;
579
+ }
580
+ async oid4vciStorePersistMetadata(args) {
581
+ const namespace = this.namespaceStr(args);
582
+ const storeId = this.storeIdStr(args);
583
+ const { correlationId, metadata, ttl, metadataType } = args;
584
+ if (args?.validation !== false) {
585
+ }
586
+ switch (metadataType) {
587
+ case "authorizationServer":
588
+ const existingAuth = await this.store({
589
+ stores: this._authorizationServerMetadataStores,
590
+ storeId
591
+ }).getAsValueData(this.prefix({
592
+ namespace,
593
+ correlationId
594
+ }));
595
+ if (!existingAuth.value || existingAuth.value && args.overwriteExisting !== false) {
596
+ return await this.store({
597
+ stores: this._authorizationServerMetadataStores,
598
+ storeId
599
+ }).set(this.prefix({
600
+ namespace,
601
+ correlationId
602
+ }), metadata, ttl);
603
+ }
604
+ return existingAuth;
605
+ case "issuer":
606
+ const existingIssuer = await this.store({
607
+ stores: this._issuerMetadataStores,
608
+ storeId
609
+ }).getAsValueData(this.prefix({
610
+ namespace,
611
+ correlationId
612
+ }));
613
+ if (!existingIssuer.value || existingIssuer.value && args.overwriteExisting !== false) {
614
+ return await this.store({
615
+ stores: this._issuerMetadataStores,
616
+ storeId
617
+ }).set(this.prefix({
618
+ namespace,
619
+ correlationId
620
+ }), metadata, ttl);
621
+ }
622
+ return existingIssuer;
623
+ }
624
+ return void 0;
625
+ }
626
+ async oid4vciStoreRemoveMetadata(args) {
627
+ const namespace = this.namespaceStr(args);
628
+ const storeId = this.storeIdStr(args);
629
+ switch (args.metadataType) {
630
+ case "authorizationServer":
631
+ return this.store({
632
+ stores: this._authorizationServerMetadataStores,
633
+ storeId
634
+ }).delete(this.prefix({
635
+ namespace,
636
+ correlationId: args.correlationId
637
+ }));
638
+ case "issuer":
639
+ return this.store({
640
+ stores: this._issuerMetadataStores,
641
+ storeId
642
+ }).delete(this.prefix({
643
+ namespace,
644
+ correlationId: args.correlationId
645
+ }));
646
+ }
647
+ return false;
648
+ }
649
+ async oid4vciStoreClearAllMetadata({ metadataType, storeId }) {
650
+ switch (metadataType) {
651
+ case "authorizationServer":
652
+ return await this.store({
653
+ stores: this._authorizationServerMetadataStores,
654
+ storeId
655
+ }).clear().then(() => true);
656
+ case "issuer":
657
+ return await this.store({
658
+ stores: this._issuerMetadataStores,
659
+ storeId
660
+ }).clear().then(() => true);
661
+ }
662
+ return false;
663
+ }
664
+ oid4vciStoreIssuerOptions() {
665
+ return Promise.resolve(this.store({
666
+ stores: this._optionStores,
667
+ storeId: this.defaultStoreId
668
+ }));
669
+ }
670
+ oid4vciStoreDefaultMetadata() {
671
+ return Promise.resolve(this.store({
672
+ stores: this._issuerMetadataStores,
673
+ storeId: this.defaultStoreId
674
+ }));
675
+ }
676
+ oid4vciStoreDefaultStoreId() {
677
+ return Promise.resolve(this.defaultStoreId);
678
+ }
679
+ oid4vciStoreDefaultNamespace() {
680
+ return Promise.resolve(this.defaultNamespace);
681
+ }
682
+ store(args) {
683
+ const storeId = this.storeIdStr({
684
+ storeId: args.storeId
685
+ });
686
+ const store = args.stores.get(storeId);
687
+ if (!store) {
688
+ throw Error(`Could not get issuer metadata store: ${storeId}`);
689
+ }
690
+ return store;
691
+ }
692
+ storeIdStr({ storeId }) {
693
+ return storeId ?? this.defaultStoreId;
694
+ }
695
+ namespaceStr({ namespace }) {
696
+ return namespace ?? this.defaultNamespace;
697
+ }
698
+ prefix({ namespace, correlationId }) {
699
+ return `${this.namespaceStr({
700
+ namespace
701
+ })}:${correlationId}`;
702
+ }
703
+ };
704
+
705
+ // src/index.ts
706
+ var schema = require_plugin_schema();
707
+ // Annotate the CommonJS export names for ESM import in node:
708
+ 0 && (module.exports = {
709
+ OID4VCIStore,
710
+ schema
711
+ });
712
+ //# sourceMappingURL=index.cjs.map