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