@sphereon/oid4vci-common 0.19.1-fix.37 → 0.19.1-next.220
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 +232 -476
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +198 -245
- package/dist/index.d.ts +198 -245
- package/dist/index.js +223 -462
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.19_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.19_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -151,9 +151,7 @@ __export(index_exports, {
|
|
|
151
151
|
convertURIToJsonObject: () => convertURIToJsonObject,
|
|
152
152
|
createCodeChallenge: () => createCodeChallenge,
|
|
153
153
|
createProofOfPossession: () => createProofOfPossession,
|
|
154
|
-
|
|
155
|
-
credentialSupportedV8ToV13: () => credentialSupportedV8ToV13,
|
|
156
|
-
credentialsSupportedV8ToV13: () => credentialsSupportedV8ToV13,
|
|
154
|
+
credentialIssuerMetadataFieldNamesV1_0_15: () => credentialIssuerMetadataFieldNamesV1_0_15,
|
|
157
155
|
decodeJsonProperties: () => decodeJsonProperties,
|
|
158
156
|
determineFlowType: () => determineFlowType,
|
|
159
157
|
determineGrantTypes: () => determineGrantTypes,
|
|
@@ -167,8 +165,8 @@ __export(index_exports, {
|
|
|
167
165
|
generateNonce: () => generateNonce,
|
|
168
166
|
generateRandomString: () => generateRandomString,
|
|
169
167
|
getClientIdFromCredentialOfferPayload: () => getClientIdFromCredentialOfferPayload,
|
|
168
|
+
getCredentialConfigurationIdsFromOfferV1_0_15: () => getCredentialConfigurationIdsFromOfferV1_0_15,
|
|
170
169
|
getCredentialOfferPayload: () => getCredentialOfferPayload,
|
|
171
|
-
getCredentialRequestForVersion: () => getCredentialRequestForVersion,
|
|
172
170
|
getFormatForVersion: () => getFormatForVersion,
|
|
173
171
|
getIssuerDisplays: () => getIssuerDisplays,
|
|
174
172
|
getIssuerFromCredentialOfferPayload: () => getIssuerFromCredentialOfferPayload,
|
|
@@ -180,15 +178,10 @@ __export(index_exports, {
|
|
|
180
178
|
getSupportedCredential: () => getSupportedCredential,
|
|
181
179
|
getSupportedCredentials: () => getSupportedCredentials,
|
|
182
180
|
getTypesFromAuthorizationDetails: () => getTypesFromAuthorizationDetails,
|
|
183
|
-
getTypesFromCredentialOffer: () => getTypesFromCredentialOffer,
|
|
184
181
|
getTypesFromCredentialSupported: () => getTypesFromCredentialSupported,
|
|
185
182
|
getTypesFromObject: () => getTypesFromObject,
|
|
186
|
-
getTypesFromOfferV1_0_11: () => getTypesFromOfferV1_0_11,
|
|
187
|
-
getTypesFromRequest: () => getTypesFromRequest,
|
|
188
183
|
getURIComponentsAsArray: () => getURIComponentsAsArray,
|
|
189
184
|
getUniformFormat: () => getUniformFormat,
|
|
190
|
-
isAuthorizationRequestV1_0_09: () => isAuthorizationRequestV1_0_09,
|
|
191
|
-
isAuthorizationRequestV1_0_11: () => isAuthorizationRequestV1_0_11,
|
|
192
185
|
isCredentialOfferVersion: () => isCredentialOfferVersion,
|
|
193
186
|
isDeferredCredentialIssuancePending: () => isDeferredCredentialIssuancePending,
|
|
194
187
|
isDeferredCredentialResponse: () => isDeferredCredentialResponse,
|
|
@@ -198,8 +191,10 @@ __export(index_exports, {
|
|
|
198
191
|
isPreAuthCode: () => isPreAuthCode,
|
|
199
192
|
isValidURL: () => isValidURL,
|
|
200
193
|
isW3cCredentialSupported: () => isW3cCredentialSupported,
|
|
194
|
+
normalizeOfferInput: () => normalizeOfferInput,
|
|
201
195
|
post: () => post,
|
|
202
196
|
resolveCredentialOfferURI: () => resolveCredentialOfferURI,
|
|
197
|
+
supportedOID4VCICredentialFormat: () => supportedOID4VCICredentialFormat,
|
|
203
198
|
toAuthorizationResponsePayload: () => toAuthorizationResponsePayload,
|
|
204
199
|
toUniformCredentialOfferPayload: () => toUniformCredentialOfferPayload,
|
|
205
200
|
toUniformCredentialOfferRequest: () => toUniformCredentialOfferRequest,
|
|
@@ -218,6 +213,14 @@ init_cjs_shims();
|
|
|
218
213
|
// lib/functions/CredentialRequestUtil.ts
|
|
219
214
|
init_cjs_shims();
|
|
220
215
|
|
|
216
|
+
// lib/functions/CredentialResponseUtil.ts
|
|
217
|
+
init_cjs_shims();
|
|
218
|
+
|
|
219
|
+
// lib/functions/HttpUtils.ts
|
|
220
|
+
init_cjs_shims();
|
|
221
|
+
var import_ssi_types = require("@sphereon/ssi-types");
|
|
222
|
+
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
223
|
+
|
|
221
224
|
// lib/types/index.ts
|
|
222
225
|
init_cjs_shims();
|
|
223
226
|
|
|
@@ -229,11 +232,19 @@ init_cjs_shims();
|
|
|
229
232
|
|
|
230
233
|
// lib/types/Generic.types.ts
|
|
231
234
|
init_cjs_shims();
|
|
235
|
+
var supportedOID4VCICredentialFormat = [
|
|
236
|
+
"jwt_vc_json",
|
|
237
|
+
"jwt_vc_json-ld",
|
|
238
|
+
"ldp_vc",
|
|
239
|
+
"dc+sd-jwt",
|
|
240
|
+
"jwt_vc",
|
|
241
|
+
"mso_mdoc"
|
|
242
|
+
];
|
|
232
243
|
var PRE_AUTH_CODE_LITERAL = "pre-authorized_code";
|
|
233
244
|
var PRE_AUTH_GRANT_LITERAL = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
|
|
234
245
|
|
|
235
246
|
// lib/types/Authorization.types.ts
|
|
236
|
-
var AuthorizationChallengeError = /* @__PURE__ */ function(AuthorizationChallengeError2) {
|
|
247
|
+
var AuthorizationChallengeError = /* @__PURE__ */ (function(AuthorizationChallengeError2) {
|
|
237
248
|
AuthorizationChallengeError2["invalid_request"] = "invalid_request";
|
|
238
249
|
AuthorizationChallengeError2["invalid_client"] = "invalid_client";
|
|
239
250
|
AuthorizationChallengeError2["unauthorized_client"] = "unauthorized_client";
|
|
@@ -242,44 +253,44 @@ var AuthorizationChallengeError = /* @__PURE__ */ function(AuthorizationChalleng
|
|
|
242
253
|
AuthorizationChallengeError2["insufficient_authorization"] = "insufficient_authorization";
|
|
243
254
|
AuthorizationChallengeError2["redirect_to_web"] = "redirect_to_web";
|
|
244
255
|
return AuthorizationChallengeError2;
|
|
245
|
-
}({});
|
|
246
|
-
var GrantTypes = /* @__PURE__ */ function(GrantTypes2) {
|
|
256
|
+
})({});
|
|
257
|
+
var GrantTypes = /* @__PURE__ */ (function(GrantTypes2) {
|
|
247
258
|
GrantTypes2["AUTHORIZATION_CODE"] = "authorization_code";
|
|
248
259
|
GrantTypes2["PRE_AUTHORIZED_CODE"] = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
|
|
249
260
|
GrantTypes2["PASSWORD"] = "password";
|
|
250
261
|
return GrantTypes2;
|
|
251
|
-
}({});
|
|
252
|
-
var Encoding = /* @__PURE__ */ function(Encoding2) {
|
|
262
|
+
})({});
|
|
263
|
+
var Encoding = /* @__PURE__ */ (function(Encoding2) {
|
|
253
264
|
Encoding2["FORM_URL_ENCODED"] = "application/x-www-form-urlencoded";
|
|
254
265
|
Encoding2["UTF_8"] = "UTF-8";
|
|
255
266
|
return Encoding2;
|
|
256
|
-
}({});
|
|
257
|
-
var ResponseType = /* @__PURE__ */ function(ResponseType2) {
|
|
267
|
+
})({});
|
|
268
|
+
var ResponseType = /* @__PURE__ */ (function(ResponseType2) {
|
|
258
269
|
ResponseType2["AUTH_CODE"] = "code";
|
|
259
270
|
return ResponseType2;
|
|
260
|
-
}({});
|
|
261
|
-
var CodeChallengeMethod = /* @__PURE__ */ function(CodeChallengeMethod2) {
|
|
271
|
+
})({});
|
|
272
|
+
var CodeChallengeMethod = /* @__PURE__ */ (function(CodeChallengeMethod2) {
|
|
262
273
|
CodeChallengeMethod2["plain"] = "plain";
|
|
263
274
|
CodeChallengeMethod2["S256"] = "S256";
|
|
264
275
|
return CodeChallengeMethod2;
|
|
265
|
-
}({});
|
|
266
|
-
var PARMode = /* @__PURE__ */ function(PARMode2) {
|
|
276
|
+
})({});
|
|
277
|
+
var PARMode = /* @__PURE__ */ (function(PARMode2) {
|
|
267
278
|
PARMode2[PARMode2["REQUIRE"] = 0] = "REQUIRE";
|
|
268
279
|
PARMode2[PARMode2["AUTO"] = 1] = "AUTO";
|
|
269
280
|
PARMode2[PARMode2["NEVER"] = 2] = "NEVER";
|
|
270
281
|
return PARMode2;
|
|
271
|
-
}({});
|
|
272
|
-
var CreateRequestObjectMode = /* @__PURE__ */ function(CreateRequestObjectMode2) {
|
|
282
|
+
})({});
|
|
283
|
+
var CreateRequestObjectMode = /* @__PURE__ */ (function(CreateRequestObjectMode2) {
|
|
273
284
|
CreateRequestObjectMode2[CreateRequestObjectMode2["NONE"] = 0] = "NONE";
|
|
274
285
|
CreateRequestObjectMode2[CreateRequestObjectMode2["REQUEST_OBJECT"] = 1] = "REQUEST_OBJECT";
|
|
275
286
|
CreateRequestObjectMode2[CreateRequestObjectMode2["REQUEST_URI"] = 2] = "REQUEST_URI";
|
|
276
287
|
return CreateRequestObjectMode2;
|
|
277
|
-
}({});
|
|
278
|
-
var AuthzFlowType = /* @__PURE__ */ function(AuthzFlowType2) {
|
|
288
|
+
})({});
|
|
289
|
+
var AuthzFlowType = /* @__PURE__ */ (function(AuthzFlowType2) {
|
|
279
290
|
AuthzFlowType2["AUTHORIZATION_CODE_FLOW"] = "Authorization Code Flow";
|
|
280
291
|
AuthzFlowType2["PRE_AUTHORIZED_CODE_FLOW"] = "Pre-Authorized Code Flow";
|
|
281
292
|
return AuthzFlowType2;
|
|
282
|
-
}({});
|
|
293
|
+
})({});
|
|
283
294
|
(function(AuthzFlowType2) {
|
|
284
295
|
function valueOf(request) {
|
|
285
296
|
if (PRE_AUTH_CODE_LITERAL in request) {
|
|
@@ -293,12 +304,12 @@ var AuthzFlowType = /* @__PURE__ */ function(AuthzFlowType2) {
|
|
|
293
304
|
|
|
294
305
|
// lib/types/CredentialIssuance.types.ts
|
|
295
306
|
init_cjs_shims();
|
|
296
|
-
var JsonURIMode = /* @__PURE__ */ function(JsonURIMode2) {
|
|
307
|
+
var JsonURIMode = /* @__PURE__ */ (function(JsonURIMode2) {
|
|
297
308
|
JsonURIMode2[JsonURIMode2["JSON_STRINGIFY"] = 0] = "JSON_STRINGIFY";
|
|
298
309
|
JsonURIMode2[JsonURIMode2["X_FORM_WWW_URLENCODED"] = 1] = "X_FORM_WWW_URLENCODED";
|
|
299
310
|
return JsonURIMode2;
|
|
300
|
-
}({});
|
|
301
|
-
var Alg = /* @__PURE__ */ function(Alg2) {
|
|
311
|
+
})({});
|
|
312
|
+
var Alg = /* @__PURE__ */ (function(Alg2) {
|
|
302
313
|
Alg2["EdDSA"] = "EdDSA";
|
|
303
314
|
Alg2["ES256"] = "ES256";
|
|
304
315
|
Alg2["ES256K"] = "ES256K";
|
|
@@ -309,44 +320,26 @@ var Alg = /* @__PURE__ */ function(Alg2) {
|
|
|
309
320
|
Alg2["RS384"] = "RS384";
|
|
310
321
|
Alg2["RS512"] = "RS512";
|
|
311
322
|
return Alg2;
|
|
312
|
-
}({});
|
|
323
|
+
})({});
|
|
313
324
|
|
|
314
|
-
// lib/types/
|
|
325
|
+
// lib/types/v1_0_15.types.ts
|
|
315
326
|
init_cjs_shims();
|
|
316
|
-
|
|
317
|
-
// lib/types/v1_0_09.types.ts
|
|
318
|
-
init_cjs_shims();
|
|
319
|
-
function isAuthorizationRequestV1_0_09(request) {
|
|
320
|
-
return request && "op_state" in request;
|
|
321
|
-
}
|
|
322
|
-
__name(isAuthorizationRequestV1_0_09, "isAuthorizationRequestV1_0_09");
|
|
323
|
-
|
|
324
|
-
// lib/types/v1_0_11.types.ts
|
|
325
|
-
init_cjs_shims();
|
|
326
|
-
function isAuthorizationRequestV1_0_11(request) {
|
|
327
|
-
return request && "issuer_state" in request;
|
|
328
|
-
}
|
|
329
|
-
__name(isAuthorizationRequestV1_0_11, "isAuthorizationRequestV1_0_11");
|
|
330
|
-
|
|
331
|
-
// lib/types/v1_0_13.types.ts
|
|
332
|
-
init_cjs_shims();
|
|
333
|
-
var credentialIssuerMetadataFieldNames = [
|
|
334
|
-
// Required fields
|
|
327
|
+
var credentialIssuerMetadataFieldNamesV1_0_15 = [
|
|
335
328
|
"credential_issuer",
|
|
336
329
|
"credential_configurations_supported",
|
|
337
330
|
"credential_endpoint",
|
|
338
|
-
|
|
339
|
-
"batch_credential_endpoint",
|
|
331
|
+
"nonce_endpoint",
|
|
340
332
|
"deferred_credential_endpoint",
|
|
341
333
|
"notification_endpoint",
|
|
342
334
|
"credential_response_encryption",
|
|
335
|
+
"batch_credential_issuance",
|
|
343
336
|
"authorization_servers",
|
|
344
337
|
"token_endpoint",
|
|
345
338
|
"display",
|
|
346
339
|
"credential_supplier_config",
|
|
347
|
-
// Optional fields from v1.0.13
|
|
348
340
|
"credential_identifiers_supported",
|
|
349
|
-
"signed_metadata"
|
|
341
|
+
"signed_metadata",
|
|
342
|
+
"authorization_challenge_endpoint"
|
|
350
343
|
];
|
|
351
344
|
|
|
352
345
|
// lib/types/ServerMetadata.ts
|
|
@@ -377,12 +370,12 @@ var authorizationServerMetadataFieldNames = [
|
|
|
377
370
|
"code_challenge_methods_supported",
|
|
378
371
|
"signed_metadata"
|
|
379
372
|
];
|
|
380
|
-
var WellKnownEndpoints = /* @__PURE__ */ function(WellKnownEndpoints2) {
|
|
373
|
+
var WellKnownEndpoints = /* @__PURE__ */ (function(WellKnownEndpoints2) {
|
|
381
374
|
WellKnownEndpoints2["OPENID_CONFIGURATION"] = "/.well-known/openid-configuration";
|
|
382
375
|
WellKnownEndpoints2["OAUTH_AS"] = "/.well-known/oauth-authorization-server";
|
|
383
376
|
WellKnownEndpoints2["OPENID4VCI_ISSUER"] = "/.well-known/openid-credential-issuer";
|
|
384
377
|
return WellKnownEndpoints2;
|
|
385
|
-
}({});
|
|
378
|
+
})({});
|
|
386
379
|
|
|
387
380
|
// lib/types/OpenID4VCIErrors.ts
|
|
388
381
|
init_cjs_shims();
|
|
@@ -425,24 +418,20 @@ var WRONG_METADATA_FORMAT = "Wrong metadata format";
|
|
|
425
418
|
|
|
426
419
|
// lib/types/OpenID4VCIVersions.types.ts
|
|
427
420
|
init_cjs_shims();
|
|
428
|
-
var OpenId4VCIVersion = /* @__PURE__ */ function(OpenId4VCIVersion2) {
|
|
429
|
-
OpenId4VCIVersion2[OpenId4VCIVersion2["
|
|
430
|
-
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_09"] = 1009] = "VER_1_0_09";
|
|
431
|
-
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_11"] = 1011] = "VER_1_0_11";
|
|
432
|
-
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_12"] = 1012] = "VER_1_0_12";
|
|
433
|
-
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_13"] = 1013] = "VER_1_0_13";
|
|
421
|
+
var OpenId4VCIVersion = /* @__PURE__ */ (function(OpenId4VCIVersion2) {
|
|
422
|
+
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_15"] = 1015] = "VER_1_0_15";
|
|
434
423
|
OpenId4VCIVersion2[OpenId4VCIVersion2["VER_UNKNOWN"] = Number.MAX_VALUE] = "VER_UNKNOWN";
|
|
435
424
|
return OpenId4VCIVersion2;
|
|
436
|
-
}({});
|
|
437
|
-
var DefaultURISchemes = /* @__PURE__ */ function(DefaultURISchemes2) {
|
|
425
|
+
})({});
|
|
426
|
+
var DefaultURISchemes = /* @__PURE__ */ (function(DefaultURISchemes2) {
|
|
438
427
|
DefaultURISchemes2["INITIATE_ISSUANCE"] = "openid-initiate-issuance";
|
|
439
428
|
DefaultURISchemes2["CREDENTIAL_OFFER"] = "openid-credential-offer";
|
|
440
429
|
return DefaultURISchemes2;
|
|
441
|
-
}({});
|
|
430
|
+
})({});
|
|
442
431
|
|
|
443
432
|
// lib/types/StateManager.types.ts
|
|
444
433
|
init_cjs_shims();
|
|
445
|
-
var IssueStatus = /* @__PURE__ */ function(IssueStatus2) {
|
|
434
|
+
var IssueStatus = /* @__PURE__ */ (function(IssueStatus2) {
|
|
446
435
|
IssueStatus2["OFFER_CREATED"] = "OFFER_CREATED";
|
|
447
436
|
IssueStatus2["ACCESS_TOKEN_REQUESTED"] = "ACCESS_TOKEN_REQUESTED";
|
|
448
437
|
IssueStatus2["ACCESS_TOKEN_CREATED"] = "ACCESS_TOKEN_CREATED";
|
|
@@ -453,18 +442,18 @@ var IssueStatus = /* @__PURE__ */ function(IssueStatus2) {
|
|
|
453
442
|
IssueStatus2["NOTIFICATION_CREDENTIAL_FAILURE"] = "NOTIFICATION_CREDENTIAL_FAILURE";
|
|
454
443
|
IssueStatus2["ERROR"] = "ERROR";
|
|
455
444
|
return IssueStatus2;
|
|
456
|
-
}({});
|
|
445
|
+
})({});
|
|
457
446
|
|
|
458
447
|
// lib/types/Token.types.ts
|
|
459
448
|
init_cjs_shims();
|
|
460
|
-
var TokenErrorResponse = /* @__PURE__ */ function(TokenErrorResponse2) {
|
|
449
|
+
var TokenErrorResponse = /* @__PURE__ */ (function(TokenErrorResponse2) {
|
|
461
450
|
TokenErrorResponse2["invalid_request"] = "invalid_request";
|
|
462
451
|
TokenErrorResponse2["invalid_grant"] = "invalid_grant";
|
|
463
452
|
TokenErrorResponse2["invalid_client"] = "invalid_client";
|
|
464
453
|
TokenErrorResponse2["invalid_scope"] = "invalid_scope";
|
|
465
454
|
TokenErrorResponse2["invalid_dpop_proof"] = "invalid_dpop_proof";
|
|
466
455
|
return TokenErrorResponse2;
|
|
467
|
-
}({});
|
|
456
|
+
})({});
|
|
468
457
|
var TokenError = class _TokenError extends Error {
|
|
469
458
|
static {
|
|
470
459
|
__name(this, "TokenError");
|
|
@@ -491,110 +480,7 @@ var TokenError = class _TokenError extends Error {
|
|
|
491
480
|
// lib/types/QRCode.types.ts
|
|
492
481
|
init_cjs_shims();
|
|
493
482
|
|
|
494
|
-
// lib/functions/FormatUtils.ts
|
|
495
|
-
init_cjs_shims();
|
|
496
|
-
function isFormat(formatObject, format) {
|
|
497
|
-
return formatObject.format === format;
|
|
498
|
-
}
|
|
499
|
-
__name(isFormat, "isFormat");
|
|
500
|
-
function isNotFormat(formatObject, format) {
|
|
501
|
-
return formatObject.format !== format;
|
|
502
|
-
}
|
|
503
|
-
__name(isNotFormat, "isNotFormat");
|
|
504
|
-
var isUniformFormat = /* @__PURE__ */ __name((format) => {
|
|
505
|
-
return [
|
|
506
|
-
"jwt_vc_json",
|
|
507
|
-
"jwt_vc_json-ld",
|
|
508
|
-
"ldp_vc",
|
|
509
|
-
"vc+sd-jwt",
|
|
510
|
-
"mso_mdoc"
|
|
511
|
-
].includes(format);
|
|
512
|
-
}, "isUniformFormat");
|
|
513
|
-
function getUniformFormat(format) {
|
|
514
|
-
if (isUniformFormat(format)) {
|
|
515
|
-
return format;
|
|
516
|
-
}
|
|
517
|
-
if (format.toLocaleLowerCase() === "jwt_vc" || format.toLocaleLowerCase() === "jwt") {
|
|
518
|
-
return "jwt_vc";
|
|
519
|
-
}
|
|
520
|
-
if (format === "ldp_vc" || format === "ldp") {
|
|
521
|
-
return "ldp_vc";
|
|
522
|
-
}
|
|
523
|
-
throw new Error(`Invalid format: ${format}`);
|
|
524
|
-
}
|
|
525
|
-
__name(getUniformFormat, "getUniformFormat");
|
|
526
|
-
function getFormatForVersion(format, version) {
|
|
527
|
-
const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
|
|
528
|
-
if (version === OpenId4VCIVersion.VER_1_0_08) {
|
|
529
|
-
if (uniformFormat === "jwt_vc_json") {
|
|
530
|
-
return "jwt_vc";
|
|
531
|
-
} else if (uniformFormat === "ldp_vc" || uniformFormat === "jwt_vc_json-ld") {
|
|
532
|
-
return "ldp_vc";
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
return uniformFormat;
|
|
536
|
-
}
|
|
537
|
-
__name(getFormatForVersion, "getFormatForVersion");
|
|
538
|
-
|
|
539
|
-
// lib/functions/CredentialRequestUtil.ts
|
|
540
|
-
function getTypesFromRequest(credentialRequest, opts) {
|
|
541
|
-
let types = [];
|
|
542
|
-
if ("credential_identifier" in credentialRequest && credentialRequest.credential_identifier) {
|
|
543
|
-
throw Error(`Cannot get types from request when it contains a credential_identifier`);
|
|
544
|
-
} else if (credentialRequest.format === "jwt_vc_json-ld" || credentialRequest.format === "ldp_vc" || credentialRequest.format === "jwt_vc" || credentialRequest.format === "jwt_vc_json") {
|
|
545
|
-
if ("credential_definition" in credentialRequest && credentialRequest.credential_definition) {
|
|
546
|
-
types = "types" in credentialRequest.credential_definition ? credentialRequest.credential_definition.types : credentialRequest.credential_definition.type;
|
|
547
|
-
}
|
|
548
|
-
if ("type" in credentialRequest && Array.isArray(credentialRequest.type)) {
|
|
549
|
-
types = credentialRequest.type;
|
|
550
|
-
}
|
|
551
|
-
if ("types" in credentialRequest && Array.isArray(credentialRequest.types)) {
|
|
552
|
-
types = credentialRequest.types;
|
|
553
|
-
}
|
|
554
|
-
} else if (credentialRequest.format === "vc+sd-jwt" && "vct" in credentialRequest) {
|
|
555
|
-
types = [
|
|
556
|
-
credentialRequest.vct
|
|
557
|
-
];
|
|
558
|
-
} else if (credentialRequest.format === "mso_mdoc" && "doctype" in credentialRequest) {
|
|
559
|
-
types = [
|
|
560
|
-
credentialRequest.doctype
|
|
561
|
-
];
|
|
562
|
-
}
|
|
563
|
-
if (!types || types.length === 0) {
|
|
564
|
-
throw Error("Could not deduce types from credential request");
|
|
565
|
-
}
|
|
566
|
-
if (opts?.filterVerifiableCredential) {
|
|
567
|
-
return types.filter((type) => type !== "VerifiableCredential");
|
|
568
|
-
}
|
|
569
|
-
return types;
|
|
570
|
-
}
|
|
571
|
-
__name(getTypesFromRequest, "getTypesFromRequest");
|
|
572
|
-
function getCredentialRequestForVersion(credentialRequest, version) {
|
|
573
|
-
if (version === OpenId4VCIVersion.VER_1_0_08) {
|
|
574
|
-
const draft8Format = getFormatForVersion(credentialRequest.format, version);
|
|
575
|
-
const types = getTypesFromRequest(credentialRequest, {
|
|
576
|
-
filterVerifiableCredential: true
|
|
577
|
-
});
|
|
578
|
-
if (credentialRequest.credential_subject_issuance) {
|
|
579
|
-
throw Error("Experimental subject issuance is not supported for older versions of the spec");
|
|
580
|
-
}
|
|
581
|
-
return {
|
|
582
|
-
format: draft8Format,
|
|
583
|
-
proof: credentialRequest.proof,
|
|
584
|
-
type: types[0]
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
return credentialRequest;
|
|
588
|
-
}
|
|
589
|
-
__name(getCredentialRequestForVersion, "getCredentialRequestForVersion");
|
|
590
|
-
|
|
591
|
-
// lib/functions/CredentialResponseUtil.ts
|
|
592
|
-
init_cjs_shims();
|
|
593
|
-
|
|
594
483
|
// lib/functions/HttpUtils.ts
|
|
595
|
-
init_cjs_shims();
|
|
596
|
-
var import_ssi_types = require("@sphereon/ssi-types");
|
|
597
|
-
var import_cross_fetch = require("cross-fetch");
|
|
598
484
|
var logger = import_ssi_types.Loggers.DEFAULT.get("sphereon:openid4vci:http");
|
|
599
485
|
var getJson = /* @__PURE__ */ __name(async (URL1, opts) => {
|
|
600
486
|
return await openIdFetch(URL1, void 0, {
|
|
@@ -647,7 +533,7 @@ ${typeof body == "string" ? body : JSON.stringify(body)}`);
|
|
|
647
533
|
}
|
|
648
534
|
logger.debug(`Headers:\r
|
|
649
535
|
${JSON.stringify(payload.headers)}`);
|
|
650
|
-
const origResponse = await (0, import_cross_fetch.
|
|
536
|
+
const origResponse = await (0, import_cross_fetch.default)(url, payload);
|
|
651
537
|
const isJSONResponse = accept === "application/json" || origResponse.headers.get("Content-Type") === "application/json";
|
|
652
538
|
const success = origResponse && origResponse.status >= 200 && origResponse.status < 400;
|
|
653
539
|
const responseText = await origResponse.text();
|
|
@@ -718,7 +604,7 @@ var adjustUrl = /* @__PURE__ */ __name((urlOrPath, opts) => {
|
|
|
718
604
|
// lib/functions/CredentialResponseUtil.ts
|
|
719
605
|
function isDeferredCredentialResponse(credentialResponse) {
|
|
720
606
|
const orig = credentialResponse.successBody;
|
|
721
|
-
return credentialResponse.origResponse.status % 200 <= 2 && !!orig && !orig.
|
|
607
|
+
return credentialResponse.origResponse.status % 200 <= 2 && !!orig && !orig.credentials && (!!orig.acceptance_token || !!orig.transaction_id);
|
|
722
608
|
}
|
|
723
609
|
__name(isDeferredCredentialResponse, "isDeferredCredentialResponse");
|
|
724
610
|
function assertNonFatalError(credentialResponse) {
|
|
@@ -756,12 +642,12 @@ async function acquireDeferredCredential({ bearerToken, transactionId, deferredC
|
|
|
756
642
|
deferredCredentialEndpoint
|
|
757
643
|
});
|
|
758
644
|
const DEFAULT_SLEEP_IN_MS = 5e3;
|
|
759
|
-
while (!credentialResponse.successBody?.
|
|
645
|
+
while (!credentialResponse.successBody?.credentials && deferredCredentialAwait) {
|
|
760
646
|
assertNonFatalError(credentialResponse);
|
|
761
647
|
const pending = isDeferredCredentialIssuancePending(credentialResponse);
|
|
762
648
|
console.log(`Issuance still pending?: ${pending}`);
|
|
763
649
|
if (!pending) {
|
|
764
|
-
|
|
650
|
+
return Promise.reject(Error(`Issuance isn't pending anymore: ${credentialResponse}`));
|
|
765
651
|
}
|
|
766
652
|
await sleep(deferredCredentialIntervalInMS ?? DEFAULT_SLEEP_IN_MS);
|
|
767
653
|
credentialResponse = await acquireDeferredCredentialImpl({
|
|
@@ -792,61 +678,87 @@ __name(acquireDeferredCredentialImpl, "acquireDeferredCredentialImpl");
|
|
|
792
678
|
init_cjs_shims();
|
|
793
679
|
var import_ssi_types2 = require("@sphereon/ssi-types");
|
|
794
680
|
var import_jwt_decode = require("jwt-decode");
|
|
681
|
+
var import_oid4vc_common = require("@sphereon/oid4vc-common");
|
|
795
682
|
var logger2 = import_ssi_types2.Loggers.DEFAULT.get("sphereon:oid4vci:offer");
|
|
796
683
|
function determineSpecVersionFromURI(uri) {
|
|
797
684
|
let version = determineSpecVersionFromScheme(uri, OpenId4VCIVersion.VER_UNKNOWN) ?? OpenId4VCIVersion.VER_UNKNOWN;
|
|
798
|
-
version = getVersionFromURIParam(uri, version, [
|
|
799
|
-
OpenId4VCIVersion.VER_1_0_08
|
|
800
|
-
], "initiate_issuance");
|
|
801
|
-
version = getVersionFromURIParam(uri, version, [
|
|
802
|
-
OpenId4VCIVersion.VER_1_0_08
|
|
803
|
-
], "credential_type");
|
|
804
|
-
version = getVersionFromURIParam(uri, version, [
|
|
805
|
-
OpenId4VCIVersion.VER_1_0_08
|
|
806
|
-
], "op_state");
|
|
807
|
-
version = getVersionFromURIParam(uri, version, [
|
|
808
|
-
OpenId4VCIVersion.VER_1_0_11
|
|
809
|
-
], "credentials");
|
|
810
|
-
version = getVersionFromURIParam(uri, version, [
|
|
811
|
-
OpenId4VCIVersion.VER_1_0_11
|
|
812
|
-
], "grants.user_pin_required");
|
|
813
|
-
version = getVersionFromURIParam(uri, version, [
|
|
814
|
-
OpenId4VCIVersion.VER_1_0_13
|
|
815
|
-
], "credential_configuration_ids");
|
|
816
|
-
version = getVersionFromURIParam(uri, version, [
|
|
817
|
-
OpenId4VCIVersion.VER_1_0_13
|
|
818
|
-
], "tx_code");
|
|
819
685
|
if (version === OpenId4VCIVersion.VER_UNKNOWN) {
|
|
820
|
-
version = OpenId4VCIVersion.
|
|
686
|
+
version = OpenId4VCIVersion.VER_1_0_15;
|
|
821
687
|
}
|
|
822
688
|
return version;
|
|
823
689
|
}
|
|
824
690
|
__name(determineSpecVersionFromURI, "determineSpecVersionFromURI");
|
|
825
691
|
function determineSpecVersionFromScheme(credentialOfferURI, openId4VCIVersion) {
|
|
826
692
|
const scheme = getScheme(credentialOfferURI);
|
|
827
|
-
|
|
693
|
+
const url = toUrlWithDummyBase(credentialOfferURI);
|
|
694
|
+
const qp = url.searchParams;
|
|
695
|
+
if (scheme === DefaultURISchemes.INITIATE_ISSUANCE) {
|
|
696
|
+
if (qp.has("credential_offer") || qp.has("credential_offer_uri")) {
|
|
697
|
+
return recordVersion(openId4VCIVersion, [
|
|
698
|
+
OpenId4VCIVersion.VER_1_0_15
|
|
699
|
+
], scheme);
|
|
700
|
+
}
|
|
828
701
|
return recordVersion(openId4VCIVersion, [
|
|
829
|
-
OpenId4VCIVersion.
|
|
702
|
+
OpenId4VCIVersion.VER_UNKNOWN
|
|
830
703
|
], scheme);
|
|
831
704
|
}
|
|
832
|
-
if (
|
|
833
|
-
|
|
834
|
-
} else if (credentialOfferURI.includes(DefaultURISchemes.CREDENTIAL_OFFER)) {
|
|
835
|
-
if (credentialOfferURI.includes("credentials:") || credentialOfferURI.includes("credentials%22")) {
|
|
705
|
+
if (scheme === DefaultURISchemes.CREDENTIAL_OFFER) {
|
|
706
|
+
if (qp.has("credential_offer_uri")) {
|
|
836
707
|
return recordVersion(openId4VCIVersion, [
|
|
837
|
-
OpenId4VCIVersion.
|
|
708
|
+
OpenId4VCIVersion.VER_1_0_15
|
|
838
709
|
], scheme);
|
|
839
710
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
711
|
+
const rawParam = getParamValueLoose(qp, "credential_offer");
|
|
712
|
+
if (rawParam) {
|
|
713
|
+
const decoded = tryDecodeOffer(rawParam);
|
|
714
|
+
const version = sniffOfferVersion(decoded);
|
|
715
|
+
if (version !== OpenId4VCIVersion.VER_UNKNOWN) {
|
|
716
|
+
return recordVersion(openId4VCIVersion, [
|
|
717
|
+
version
|
|
718
|
+
], scheme);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
844
721
|
return recordVersion(openId4VCIVersion, [
|
|
845
722
|
OpenId4VCIVersion.VER_UNKNOWN
|
|
846
723
|
], scheme);
|
|
847
724
|
}
|
|
725
|
+
return recordVersion(openId4VCIVersion, [
|
|
726
|
+
OpenId4VCIVersion.VER_UNKNOWN
|
|
727
|
+
], scheme);
|
|
848
728
|
}
|
|
849
729
|
__name(determineSpecVersionFromScheme, "determineSpecVersionFromScheme");
|
|
730
|
+
function toUrlWithDummyBase(uri) {
|
|
731
|
+
const normalized = uri.replace(/^openid-[^?]+:\/\//, "https://dummy/?");
|
|
732
|
+
return new URL(normalized);
|
|
733
|
+
}
|
|
734
|
+
__name(toUrlWithDummyBase, "toUrlWithDummyBase");
|
|
735
|
+
function getParamValueLoose(qp, key) {
|
|
736
|
+
if (qp.has(key)) return qp.get(key);
|
|
737
|
+
if (qp.has(`?${key}`)) return qp.get(`?${key}`);
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
__name(getParamValueLoose, "getParamValueLoose");
|
|
741
|
+
function tryDecodeOffer(input) {
|
|
742
|
+
let candidate = input;
|
|
743
|
+
try {
|
|
744
|
+
candidate = decodeURIComponent(candidate);
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
if (!/[{}]/.test(candidate) && /^[A-Za-z0-9\-_]+$/.test(candidate)) {
|
|
748
|
+
try {
|
|
749
|
+
const b64 = candidate.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(candidate.length / 4) * 4, "=");
|
|
750
|
+
candidate = atob(b64);
|
|
751
|
+
} catch {
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return candidate;
|
|
755
|
+
}
|
|
756
|
+
__name(tryDecodeOffer, "tryDecodeOffer");
|
|
757
|
+
function sniffOfferVersion(jsonLike) {
|
|
758
|
+
if (!jsonLike) return OpenId4VCIVersion.VER_UNKNOWN;
|
|
759
|
+
return OpenId4VCIVersion.VER_UNKNOWN;
|
|
760
|
+
}
|
|
761
|
+
__name(sniffOfferVersion, "sniffOfferVersion");
|
|
850
762
|
function getScheme(credentialOfferURI) {
|
|
851
763
|
if (!credentialOfferURI || !credentialOfferURI.includes("://")) {
|
|
852
764
|
throw Error("Invalid credential offer URI");
|
|
@@ -902,14 +814,8 @@ var getStateFromCredentialOfferPayload = /* @__PURE__ */ __name((credentialOffer
|
|
|
902
814
|
return;
|
|
903
815
|
}, "getStateFromCredentialOfferPayload");
|
|
904
816
|
function determineSpecVersionFromOffer(offer) {
|
|
905
|
-
if (
|
|
906
|
-
return OpenId4VCIVersion.
|
|
907
|
-
} else if (isCredentialOfferV1_0_11(offer)) {
|
|
908
|
-
return OpenId4VCIVersion.VER_1_0_11;
|
|
909
|
-
} else if (isCredentialOfferV1_0_09(offer)) {
|
|
910
|
-
return OpenId4VCIVersion.VER_1_0_09;
|
|
911
|
-
} else if (isCredentialOfferV1_0_08(offer)) {
|
|
912
|
-
return OpenId4VCIVersion.VER_1_0_08;
|
|
817
|
+
if (isCredentialOfferV1_0_15(offer)) {
|
|
818
|
+
return OpenId4VCIVersion.VER_1_0_15;
|
|
913
819
|
}
|
|
914
820
|
return OpenId4VCIVersion.VER_UNKNOWN;
|
|
915
821
|
}
|
|
@@ -929,60 +835,20 @@ function isCredentialOfferVersion(offer, min, max) {
|
|
|
929
835
|
return true;
|
|
930
836
|
}
|
|
931
837
|
__name(isCredentialOfferVersion, "isCredentialOfferVersion");
|
|
932
|
-
function
|
|
838
|
+
function isCredentialOfferV1_0_15(offer) {
|
|
933
839
|
if (!offer) {
|
|
934
840
|
return false;
|
|
935
841
|
}
|
|
936
|
-
|
|
937
|
-
return true;
|
|
938
|
-
}
|
|
939
|
-
if ("credential_offer" in offer && offer["credential_offer"]) {
|
|
940
|
-
return isCredentialOfferV1_0_08(offer["credential_offer"]);
|
|
941
|
-
}
|
|
942
|
-
return false;
|
|
943
|
-
}
|
|
944
|
-
__name(isCredentialOfferV1_0_08, "isCredentialOfferV1_0_08");
|
|
945
|
-
function isCredentialOfferV1_0_09(offer) {
|
|
946
|
-
if (!offer) {
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
if ("issuer" in offer && "credentials" in offer) {
|
|
950
|
-
return true;
|
|
951
|
-
}
|
|
952
|
-
if ("credential_offer" in offer && offer["credential_offer"]) {
|
|
953
|
-
return isCredentialOfferV1_0_09(offer["credential_offer"]);
|
|
954
|
-
}
|
|
955
|
-
return false;
|
|
956
|
-
}
|
|
957
|
-
__name(isCredentialOfferV1_0_09, "isCredentialOfferV1_0_09");
|
|
958
|
-
function isCredentialOfferV1_0_11(offer) {
|
|
959
|
-
if (!offer) {
|
|
960
|
-
return false;
|
|
961
|
-
}
|
|
962
|
-
if ("credential_issuer" in offer && "credentials" in offer) {
|
|
963
|
-
return true;
|
|
964
|
-
}
|
|
965
|
-
if ("credential_offer" in offer && offer["credential_offer"]) {
|
|
966
|
-
return isCredentialOfferV1_0_11(offer["credential_offer"]);
|
|
967
|
-
}
|
|
968
|
-
return "credential_offer_uri" in offer;
|
|
969
|
-
}
|
|
970
|
-
__name(isCredentialOfferV1_0_11, "isCredentialOfferV1_0_11");
|
|
971
|
-
function isCredentialOfferV1_0_13(offer) {
|
|
972
|
-
if (!offer) {
|
|
973
|
-
return false;
|
|
974
|
-
} else if (typeof offer === "string" && offer.startsWith("{")) {
|
|
975
|
-
offer = JSON.parse(offer);
|
|
976
|
-
}
|
|
842
|
+
offer = normalizeOfferInput(offer);
|
|
977
843
|
if ("credential_issuer" in offer && "credential_configuration_ids" in offer) {
|
|
978
|
-
return
|
|
844
|
+
return Array.isArray(offer.credential_configuration_ids);
|
|
979
845
|
}
|
|
980
846
|
if ("credential_offer" in offer && offer["credential_offer"]) {
|
|
981
|
-
return
|
|
847
|
+
return isCredentialOfferV1_0_15(offer["credential_offer"]);
|
|
982
848
|
}
|
|
983
849
|
return "credential_offer_uri" in offer;
|
|
984
850
|
}
|
|
985
|
-
__name(
|
|
851
|
+
__name(isCredentialOfferV1_0_15, "isCredentialOfferV1_0_15");
|
|
986
852
|
async function toUniformCredentialOfferRequest(offer, opts) {
|
|
987
853
|
let version = opts?.version ?? determineSpecVersionFromOffer(offer);
|
|
988
854
|
let originalCredentialOffer = offer.credential_offer;
|
|
@@ -1018,6 +884,7 @@ async function toUniformCredentialOfferRequest(offer, opts) {
|
|
|
1018
884
|
}
|
|
1019
885
|
__name(toUniformCredentialOfferRequest, "toUniformCredentialOfferRequest");
|
|
1020
886
|
function isPreAuthCode(request) {
|
|
887
|
+
request = normalizeOfferInput(request);
|
|
1021
888
|
const payload = "credential_offer" in request ? request.credential_offer : request;
|
|
1022
889
|
return payload?.grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL] !== void 0;
|
|
1023
890
|
}
|
|
@@ -1051,56 +918,15 @@ async function resolveCredentialOfferURI(uri) {
|
|
|
1051
918
|
return response.successBody;
|
|
1052
919
|
}
|
|
1053
920
|
__name(resolveCredentialOfferURI, "resolveCredentialOfferURI");
|
|
1054
|
-
function toUniformCredentialOfferPayload(
|
|
921
|
+
function toUniformCredentialOfferPayload(rawOffer, opts) {
|
|
922
|
+
const offer = normalizeOfferInput(rawOffer);
|
|
1055
923
|
const version = opts?.version ?? determineSpecVersionFromOffer(offer);
|
|
1056
|
-
if (version >= OpenId4VCIVersion.
|
|
924
|
+
if (version >= OpenId4VCIVersion.VER_1_0_15) {
|
|
1057
925
|
const orig = offer;
|
|
1058
926
|
return {
|
|
1059
927
|
...orig
|
|
1060
928
|
};
|
|
1061
929
|
}
|
|
1062
|
-
const grants = "grants" in offer ? offer.grants : {};
|
|
1063
|
-
let offerPayloadAsV8V9 = offer;
|
|
1064
|
-
if (isCredentialOfferVersion(offer, OpenId4VCIVersion.VER_1_0_08, OpenId4VCIVersion.VER_1_0_09)) {
|
|
1065
|
-
if (offerPayloadAsV8V9.op_state) {
|
|
1066
|
-
grants.authorization_code = {
|
|
1067
|
-
...grants.authorization_code,
|
|
1068
|
-
issuer_state: offerPayloadAsV8V9.op_state
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
let user_pin_required = false;
|
|
1072
|
-
if (typeof offerPayloadAsV8V9.user_pin_required === "string") {
|
|
1073
|
-
user_pin_required = offerPayloadAsV8V9.user_pin_required === "true" || offerPayloadAsV8V9.user_pin_required === "yes";
|
|
1074
|
-
} else if (offerPayloadAsV8V9.user_pin_required !== void 0) {
|
|
1075
|
-
user_pin_required = offerPayloadAsV8V9.user_pin_required;
|
|
1076
|
-
}
|
|
1077
|
-
if (offerPayloadAsV8V9[PRE_AUTH_CODE_LITERAL]) {
|
|
1078
|
-
grants[PRE_AUTH_GRANT_LITERAL] = {
|
|
1079
|
-
"pre-authorized_code": offerPayloadAsV8V9[PRE_AUTH_CODE_LITERAL],
|
|
1080
|
-
user_pin_required
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
const issuer = getIssuerFromCredentialOfferPayload(offer);
|
|
1085
|
-
if (version === OpenId4VCIVersion.VER_1_0_09) {
|
|
1086
|
-
offerPayloadAsV8V9 = offer;
|
|
1087
|
-
return {
|
|
1088
|
-
// credential_definition: getCredentialsSupported(never, offerPayloadAsV8V9.credentials).map(sup => {credentialSubject: sup.credentialSubject})[0],
|
|
1089
|
-
credential_issuer: issuer ?? offerPayloadAsV8V9.issuer,
|
|
1090
|
-
credentials: offerPayloadAsV8V9.credentials,
|
|
1091
|
-
grants
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
if (version === OpenId4VCIVersion.VER_1_0_08) {
|
|
1095
|
-
offerPayloadAsV8V9 = offer;
|
|
1096
|
-
return {
|
|
1097
|
-
credential_issuer: issuer ?? offerPayloadAsV8V9.issuer,
|
|
1098
|
-
credentials: Array.isArray(offerPayloadAsV8V9.credential_type) ? offerPayloadAsV8V9.credential_type : [
|
|
1099
|
-
offerPayloadAsV8V9.credential_type
|
|
1100
|
-
],
|
|
1101
|
-
grants
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
930
|
throw Error(`Could not create uniform payload for version ${version}`);
|
|
1105
931
|
}
|
|
1106
932
|
__name(toUniformCredentialOfferPayload, "toUniformCredentialOfferPayload");
|
|
@@ -1113,13 +939,11 @@ function determineFlowType(suppliedOffer, version) {
|
|
|
1113
939
|
if (payload.grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL]) {
|
|
1114
940
|
supportedFlows.push(AuthzFlowType.PRE_AUTHORIZED_CODE_FLOW);
|
|
1115
941
|
}
|
|
1116
|
-
if (supportedFlows.length === 0 && version < OpenId4VCIVersion.VER_1_0_09) {
|
|
1117
|
-
supportedFlows.push(AuthzFlowType.AUTHORIZATION_CODE_FLOW);
|
|
1118
|
-
}
|
|
1119
942
|
return supportedFlows;
|
|
1120
943
|
}
|
|
1121
944
|
__name(determineFlowType, "determineFlowType");
|
|
1122
945
|
function getCredentialOfferPayload(offer) {
|
|
946
|
+
offer = normalizeOfferInput(offer);
|
|
1123
947
|
let payload;
|
|
1124
948
|
if ("credential_offer" in offer && offer["credential_offer"]) {
|
|
1125
949
|
payload = offer.credential_offer;
|
|
@@ -1130,6 +954,7 @@ function getCredentialOfferPayload(offer) {
|
|
|
1130
954
|
}
|
|
1131
955
|
__name(getCredentialOfferPayload, "getCredentialOfferPayload");
|
|
1132
956
|
function determineGrantTypes(offer) {
|
|
957
|
+
offer = normalizeOfferInput(offer);
|
|
1133
958
|
let grants;
|
|
1134
959
|
if ("grants" in offer && offer.grants) {
|
|
1135
960
|
grants = offer.grants;
|
|
@@ -1148,13 +973,6 @@ function determineGrantTypes(offer) {
|
|
|
1148
973
|
return types;
|
|
1149
974
|
}
|
|
1150
975
|
__name(determineGrantTypes, "determineGrantTypes");
|
|
1151
|
-
function getVersionFromURIParam(credentialOfferURI, currentVersion, matchingVersion, param, allowUpgrade = true) {
|
|
1152
|
-
if (credentialOfferURI.includes(param)) {
|
|
1153
|
-
return recordVersion(currentVersion, matchingVersion, param, allowUpgrade);
|
|
1154
|
-
}
|
|
1155
|
-
return currentVersion;
|
|
1156
|
-
}
|
|
1157
|
-
__name(getVersionFromURIParam, "getVersionFromURIParam");
|
|
1158
976
|
function recordVersion(currentVersion, matchingVersion, key, allowUpgrade = true) {
|
|
1159
977
|
matchingVersion = matchingVersion.sort().reverse();
|
|
1160
978
|
if (currentVersion === OpenId4VCIVersion.VER_UNKNOWN) {
|
|
@@ -1168,40 +986,25 @@ function recordVersion(currentVersion, matchingVersion, key, allowUpgrade = true
|
|
|
1168
986
|
throw new Error(`Invalid param. Some keys have been used from version: ${currentVersion} version while '${key}' is used from version: ${JSON.stringify(matchingVersion)}`);
|
|
1169
987
|
}
|
|
1170
988
|
__name(recordVersion, "recordVersion");
|
|
1171
|
-
function
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
} else if (curr.format === "jwt_vc_json-ld" || curr.format === "ldp_vc") {
|
|
1179
|
-
return [
|
|
1180
|
-
...prev,
|
|
1181
|
-
...curr.credential_definition.types
|
|
1182
|
-
];
|
|
1183
|
-
} else if (curr.format === "jwt_vc_json" || curr.format === "jwt_vc") {
|
|
1184
|
-
return [
|
|
1185
|
-
...prev,
|
|
1186
|
-
...curr.types
|
|
1187
|
-
];
|
|
1188
|
-
} else if (curr.format === "vc+sd-jwt") {
|
|
1189
|
-
return [
|
|
1190
|
-
...prev,
|
|
1191
|
-
curr.vct
|
|
1192
|
-
];
|
|
1193
|
-
}
|
|
1194
|
-
return prev;
|
|
1195
|
-
}, []);
|
|
1196
|
-
if (!types || types.length === 0) {
|
|
1197
|
-
throw Error("Could not deduce types from credential offer");
|
|
989
|
+
function getCredentialConfigurationIdsFromOfferV1_0_15(offer) {
|
|
990
|
+
return offer.credential_configuration_ids ?? [];
|
|
991
|
+
}
|
|
992
|
+
__name(getCredentialConfigurationIdsFromOfferV1_0_15, "getCredentialConfigurationIdsFromOfferV1_0_15");
|
|
993
|
+
function normalizeOfferInput(input) {
|
|
994
|
+
if (typeof input !== "string") {
|
|
995
|
+
return input;
|
|
1198
996
|
}
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
997
|
+
if (import_ssi_types2.ObjectUtils.isString(input) && input.startsWith("ey")) {
|
|
998
|
+
const payload = (0, import_oid4vc_common.base64urlToString)(input);
|
|
999
|
+
return JSON.parse(payload);
|
|
1201
1000
|
}
|
|
1202
|
-
|
|
1001
|
+
try {
|
|
1002
|
+
return JSON.parse(input);
|
|
1003
|
+
} catch {
|
|
1004
|
+
}
|
|
1005
|
+
return input;
|
|
1203
1006
|
}
|
|
1204
|
-
__name(
|
|
1007
|
+
__name(normalizeOfferInput, "normalizeOfferInput");
|
|
1205
1008
|
|
|
1206
1009
|
// lib/functions/Encoding.ts
|
|
1207
1010
|
init_cjs_shims();
|
|
@@ -1215,7 +1018,7 @@ function convertJsonToURI(json, opts) {
|
|
|
1215
1018
|
}
|
|
1216
1019
|
__name(encodeAndStripWhitespace, "encodeAndStripWhitespace");
|
|
1217
1020
|
let components;
|
|
1218
|
-
if (opts?.
|
|
1021
|
+
if (opts?.mode === JsonURIMode.JSON_STRINGIFY) {
|
|
1219
1022
|
components = encodeAndStripWhitespace(JSON.stringify(json));
|
|
1220
1023
|
} else {
|
|
1221
1024
|
for (const [key, value] of Object.entries(json)) {
|
|
@@ -1374,35 +1177,6 @@ function getTypesFromObject(subject) {
|
|
|
1374
1177
|
return void 0;
|
|
1375
1178
|
}
|
|
1376
1179
|
__name(getTypesFromObject, "getTypesFromObject");
|
|
1377
|
-
function getTypesFromCredentialOffer(offer, opts) {
|
|
1378
|
-
const { configIdAsType = false } = {
|
|
1379
|
-
...opts
|
|
1380
|
-
};
|
|
1381
|
-
if ("credentials" in offer && Array.isArray(offer.credentials)) {
|
|
1382
|
-
return offer.credentials.map((cred) => getTypesFromObject(cred)).filter((cred) => cred !== void 0);
|
|
1383
|
-
} else if (configIdAsType && "credential_configuration_ids" in offer && Array.isArray(offer.credential_configuration_ids)) {
|
|
1384
|
-
return offer.credential_configuration_ids.map((id) => [
|
|
1385
|
-
id
|
|
1386
|
-
]);
|
|
1387
|
-
} else if ("credential_offer" in offer && offer.credential_offer) {
|
|
1388
|
-
return getTypesFromCredentialOffer(offer.credential_offer, opts);
|
|
1389
|
-
} else if ("credential_type" in offer && offer.credential_type) {
|
|
1390
|
-
if (typeof offer.credential_type === "string") {
|
|
1391
|
-
return [
|
|
1392
|
-
[
|
|
1393
|
-
offer.credential_type
|
|
1394
|
-
]
|
|
1395
|
-
];
|
|
1396
|
-
} else if (Array.isArray(offer.credential_type)) {
|
|
1397
|
-
return [
|
|
1398
|
-
offer.credential_type
|
|
1399
|
-
];
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
VCI_LOG_COMMON.warning("Could not deduce credential types from offer. Probably a failure down the line will happen!");
|
|
1403
|
-
return void 0;
|
|
1404
|
-
}
|
|
1405
|
-
__name(getTypesFromCredentialOffer, "getTypesFromCredentialOffer");
|
|
1406
1180
|
function getTypesFromAuthorizationDetails(authDetails, opts) {
|
|
1407
1181
|
const { configIdAsType = false } = {
|
|
1408
1182
|
...opts
|
|
@@ -1425,7 +1199,7 @@ function getTypesFromCredentialSupported(credentialSupported, opts) {
|
|
|
1425
1199
|
let types = [];
|
|
1426
1200
|
if (credentialSupported.format === "jwt_vc_json" || credentialSupported.format === "jwt_vc" || credentialSupported.format === "jwt_vc_json-ld" || credentialSupported.format === "ldp_vc") {
|
|
1427
1201
|
types = getTypesFromObject(credentialSupported) ?? [];
|
|
1428
|
-
} else if (credentialSupported.format === "vc+sd-jwt") {
|
|
1202
|
+
} else if (credentialSupported.format === "dc+sd-jwt" || credentialSupported.format === "vc+sd-jwt") {
|
|
1429
1203
|
types = [
|
|
1430
1204
|
credentialSupported.vct
|
|
1431
1205
|
];
|
|
@@ -1447,26 +1221,18 @@ __name(getTypesFromCredentialSupported, "getTypesFromCredentialSupported");
|
|
|
1447
1221
|
// lib/functions/IssuerMetadataUtils.ts
|
|
1448
1222
|
init_cjs_shims();
|
|
1449
1223
|
function getSupportedCredentials(opts) {
|
|
1450
|
-
const { version = OpenId4VCIVersion.
|
|
1224
|
+
const { version = OpenId4VCIVersion.VER_1_0_15, types } = opts ?? {};
|
|
1451
1225
|
if (types && Array.isArray(types)) {
|
|
1452
|
-
|
|
1453
|
-
return
|
|
1226
|
+
return types.map((typeSet) => {
|
|
1227
|
+
return getSupportedCredential({
|
|
1454
1228
|
...opts,
|
|
1455
1229
|
version,
|
|
1456
1230
|
types: typeSet
|
|
1457
|
-
})
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
version,
|
|
1463
|
-
types: typeSet
|
|
1464
|
-
});
|
|
1465
|
-
}).reduce((acc, result) => {
|
|
1466
|
-
Object.assign(acc, result);
|
|
1467
|
-
return acc;
|
|
1468
|
-
}, {});
|
|
1469
|
-
}
|
|
1231
|
+
});
|
|
1232
|
+
}).reduce((acc, result) => {
|
|
1233
|
+
Object.assign(acc, result);
|
|
1234
|
+
return acc;
|
|
1235
|
+
}, {});
|
|
1470
1236
|
}
|
|
1471
1237
|
return getSupportedCredential(opts ? {
|
|
1472
1238
|
...opts,
|
|
@@ -1476,21 +1242,8 @@ function getSupportedCredentials(opts) {
|
|
|
1476
1242
|
__name(getSupportedCredentials, "getSupportedCredentials");
|
|
1477
1243
|
function determineVersionsFromIssuerMetadata(issuerMetadata) {
|
|
1478
1244
|
const versions = /* @__PURE__ */ new Set();
|
|
1479
|
-
if ("
|
|
1480
|
-
versions.add(OpenId4VCIVersion.
|
|
1481
|
-
} else if ("authorization_servers" in issuerMetadata) {
|
|
1482
|
-
versions.add(OpenId4VCIVersion.VER_1_0_13);
|
|
1483
|
-
}
|
|
1484
|
-
if (versions.size === 0) {
|
|
1485
|
-
if ("credential_configurations_supported" in issuerMetadata) {
|
|
1486
|
-
versions.add(OpenId4VCIVersion.VER_1_0_13);
|
|
1487
|
-
} else if ("credentials_supported" in issuerMetadata) {
|
|
1488
|
-
if (typeof issuerMetadata.credentials_supported === "object") {
|
|
1489
|
-
versions.add(OpenId4VCIVersion.VER_1_0_08);
|
|
1490
|
-
} else {
|
|
1491
|
-
versions.add(OpenId4VCIVersion.VER_1_0_09).add(OpenId4VCIVersion.VER_1_0_11);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1245
|
+
if ("credential_configurations_supported" in issuerMetadata) {
|
|
1246
|
+
versions.add(OpenId4VCIVersion.VER_1_0_15);
|
|
1494
1247
|
}
|
|
1495
1248
|
if (versions.size === 0) {
|
|
1496
1249
|
versions.add(OpenId4VCIVersion.VER_UNKNOWN);
|
|
@@ -1499,27 +1252,18 @@ function determineVersionsFromIssuerMetadata(issuerMetadata) {
|
|
|
1499
1252
|
}
|
|
1500
1253
|
__name(determineVersionsFromIssuerMetadata, "determineVersionsFromIssuerMetadata");
|
|
1501
1254
|
function getSupportedCredential(opts) {
|
|
1502
|
-
const { issuerMetadata, types, format, version = OpenId4VCIVersion.
|
|
1503
|
-
let
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
if (issuerMetadata?.credentials_supported && !Array.isArray(issuerMetadata?.credentials_supported)) {
|
|
1507
|
-
credentialConfigurationsV11 = [];
|
|
1508
|
-
Object.entries(issuerMetadata.credentials_supported).forEach(([id, supported]) => {
|
|
1509
|
-
if (!supported.id) {
|
|
1510
|
-
supported.id = id;
|
|
1511
|
-
}
|
|
1512
|
-
credentialConfigurationsV11?.push(supported);
|
|
1513
|
-
});
|
|
1514
|
-
} else {
|
|
1515
|
-
credentialConfigurationsV11 = issuerMetadata?.credentials_supported ?? [];
|
|
1516
|
-
}
|
|
1517
|
-
} else {
|
|
1518
|
-
credentialConfigurationsV13 = issuerMetadata?.credential_configurations_supported ?? {};
|
|
1255
|
+
const { issuerMetadata, types, format, version = OpenId4VCIVersion.VER_1_0_15 } = opts ?? {};
|
|
1256
|
+
let credentialConfigurationsV15 = void 0;
|
|
1257
|
+
if (issuerMetadata?.credential_configurations_supported && version >= OpenId4VCIVersion.VER_1_0_15) {
|
|
1258
|
+
credentialConfigurationsV15 = issuerMetadata.credential_configurations_supported;
|
|
1519
1259
|
}
|
|
1520
1260
|
if (!issuerMetadata || !issuerMetadata.credential_configurations_supported && !issuerMetadata.credentials_supported) {
|
|
1521
|
-
VCI_LOG_COMMON.warning(`No credential issuer metadata or supported credentials found for issuer
|
|
1522
|
-
|
|
1261
|
+
VCI_LOG_COMMON.warning(`No credential issuer metadata or supported credentials found for issuer`);
|
|
1262
|
+
if (version >= OpenId4VCIVersion.VER_1_0_15) {
|
|
1263
|
+
return credentialConfigurationsV15 ?? {};
|
|
1264
|
+
} else {
|
|
1265
|
+
return [];
|
|
1266
|
+
}
|
|
1523
1267
|
}
|
|
1524
1268
|
const normalizedTypes = Array.isArray(types) ? types : types ? [
|
|
1525
1269
|
types
|
|
@@ -1536,12 +1280,14 @@ function getSupportedCredential(opts) {
|
|
|
1536
1280
|
} else if (types2) {
|
|
1537
1281
|
isTypeMatch = normalizedTypes.every((type) => types2.includes(type));
|
|
1538
1282
|
} else {
|
|
1539
|
-
|
|
1540
|
-
|
|
1283
|
+
const hasValidCredentialDefinition = isW3cCredentialSupported(config) && "credential_definition" in config && config.credential_definition && typeof config.credential_definition === "object" && "type" in config.credential_definition && Array.isArray(config.credential_definition.type);
|
|
1284
|
+
if (hasValidCredentialDefinition) {
|
|
1285
|
+
const credDef = config.credential_definition;
|
|
1286
|
+
isTypeMatch = normalizedTypes.every((type) => credDef.type.includes(type));
|
|
1541
1287
|
} else if (isW3cCredentialSupported(config) && "type" in config && Array.isArray(config.type)) {
|
|
1542
1288
|
isTypeMatch = normalizedTypes.every((type) => config.type.includes(type));
|
|
1543
|
-
} else if (isW3cCredentialSupported(config) && "types" in config) {
|
|
1544
|
-
isTypeMatch = normalizedTypes.every((type) => config.types
|
|
1289
|
+
} else if (isW3cCredentialSupported(config) && "types" in config && Array.isArray(config.types)) {
|
|
1290
|
+
isTypeMatch = normalizedTypes.every((type) => config.types.includes(type));
|
|
1545
1291
|
}
|
|
1546
1292
|
}
|
|
1547
1293
|
}
|
|
@@ -1549,8 +1295,8 @@ function getSupportedCredential(opts) {
|
|
|
1549
1295
|
return isTypeMatch && isFormatMatch ? config : void 0;
|
|
1550
1296
|
}
|
|
1551
1297
|
__name(filterMatchingConfig, "filterMatchingConfig");
|
|
1552
|
-
if (
|
|
1553
|
-
return Object.entries(
|
|
1298
|
+
if (credentialConfigurationsV15) {
|
|
1299
|
+
return Object.entries(credentialConfigurationsV15).reduce((filteredConfigs, [id, config]) => {
|
|
1554
1300
|
if (filterMatchingConfig(config)) {
|
|
1555
1301
|
filteredConfigs[id] = config;
|
|
1556
1302
|
if (!config.id) {
|
|
@@ -1559,41 +1305,13 @@ function getSupportedCredential(opts) {
|
|
|
1559
1305
|
}
|
|
1560
1306
|
return filteredConfigs;
|
|
1561
1307
|
}, {});
|
|
1562
|
-
} else if (credentialConfigurationsV11) {
|
|
1563
|
-
return credentialConfigurationsV11.filter((config) => filterMatchingConfig(config));
|
|
1564
1308
|
}
|
|
1565
|
-
|
|
1309
|
+
if (issuerMetadata.credentials_supported && Array.isArray(issuerMetadata.credentials_supported)) {
|
|
1310
|
+
return issuerMetadata.credentials_supported.filter(filterMatchingConfig);
|
|
1311
|
+
}
|
|
1312
|
+
return version >= OpenId4VCIVersion.VER_1_0_15 ? {} : [];
|
|
1566
1313
|
}
|
|
1567
1314
|
__name(getSupportedCredential, "getSupportedCredential");
|
|
1568
|
-
function credentialsSupportedV8ToV13(supportedV8) {
|
|
1569
|
-
const credentialConfigsSupported = {};
|
|
1570
|
-
Object.entries(supportedV8).flatMap((entry) => {
|
|
1571
|
-
const type = entry[0];
|
|
1572
|
-
const supportedV82 = entry[1];
|
|
1573
|
-
Object.assign(credentialConfigsSupported, credentialSupportedV8ToV13(type, supportedV82));
|
|
1574
|
-
});
|
|
1575
|
-
return credentialConfigsSupported;
|
|
1576
|
-
}
|
|
1577
|
-
__name(credentialsSupportedV8ToV13, "credentialsSupportedV8ToV13");
|
|
1578
|
-
function credentialSupportedV8ToV13(key, supportedV8) {
|
|
1579
|
-
const credentialConfigsSupported = {};
|
|
1580
|
-
Object.entries(supportedV8.formats).map((entry) => {
|
|
1581
|
-
const format = entry[0];
|
|
1582
|
-
const credentialSupportBrief = entry[1];
|
|
1583
|
-
if (typeof format !== "string") {
|
|
1584
|
-
throw Error(`Unknown format received ${JSON.stringify(format)}`);
|
|
1585
|
-
}
|
|
1586
|
-
const credentialConfigSupported = {
|
|
1587
|
-
format,
|
|
1588
|
-
display: supportedV8.display,
|
|
1589
|
-
...credentialSupportBrief,
|
|
1590
|
-
credentialSubject: supportedV8.claims
|
|
1591
|
-
};
|
|
1592
|
-
credentialConfigsSupported[key] = credentialConfigSupported;
|
|
1593
|
-
});
|
|
1594
|
-
return credentialConfigsSupported;
|
|
1595
|
-
}
|
|
1596
|
-
__name(credentialSupportedV8ToV13, "credentialSupportedV8ToV13");
|
|
1597
1315
|
function getIssuerDisplays(metadata, opts) {
|
|
1598
1316
|
const matchedDisplays = metadata.display?.filter((item) => !opts?.prefLocales || opts.prefLocales.length === 0 || item.locale && opts.prefLocales.includes(item.locale) || !item.locale) ?? [];
|
|
1599
1317
|
return matchedDisplays.sort((item) => item.locale ? opts?.prefLocales.indexOf(item.locale) ?? 1 : Number.MAX_VALUE);
|
|
@@ -1612,6 +1330,44 @@ function getIssuerName(url, credentialIssuerMetadata) {
|
|
|
1612
1330
|
}
|
|
1613
1331
|
__name(getIssuerName, "getIssuerName");
|
|
1614
1332
|
|
|
1333
|
+
// lib/functions/FormatUtils.ts
|
|
1334
|
+
init_cjs_shims();
|
|
1335
|
+
function isFormat(formatObject, format) {
|
|
1336
|
+
return formatObject.format === format;
|
|
1337
|
+
}
|
|
1338
|
+
__name(isFormat, "isFormat");
|
|
1339
|
+
function isNotFormat(formatObject, format) {
|
|
1340
|
+
return formatObject.format !== format;
|
|
1341
|
+
}
|
|
1342
|
+
__name(isNotFormat, "isNotFormat");
|
|
1343
|
+
var isUniformFormat = /* @__PURE__ */ __name((format) => {
|
|
1344
|
+
return [
|
|
1345
|
+
"jwt_vc_json",
|
|
1346
|
+
"jwt_vc_json-ld",
|
|
1347
|
+
"ldp_vc",
|
|
1348
|
+
"dc+sd-jwt",
|
|
1349
|
+
"mso_mdoc"
|
|
1350
|
+
].includes(format);
|
|
1351
|
+
}, "isUniformFormat");
|
|
1352
|
+
function getUniformFormat(format) {
|
|
1353
|
+
if (isUniformFormat(format)) {
|
|
1354
|
+
return format;
|
|
1355
|
+
}
|
|
1356
|
+
if (format.toLocaleLowerCase() === "jwt_vc" || format.toLocaleLowerCase() === "jwt") {
|
|
1357
|
+
return "jwt_vc";
|
|
1358
|
+
}
|
|
1359
|
+
if (format === "ldp_vc" || format === "ldp") {
|
|
1360
|
+
return "ldp_vc";
|
|
1361
|
+
}
|
|
1362
|
+
throw new Error(`Invalid format: ${format}`);
|
|
1363
|
+
}
|
|
1364
|
+
__name(getUniformFormat, "getUniformFormat");
|
|
1365
|
+
function getFormatForVersion(format, version) {
|
|
1366
|
+
const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
|
|
1367
|
+
return uniformFormat;
|
|
1368
|
+
}
|
|
1369
|
+
__name(getFormatForVersion, "getFormatForVersion");
|
|
1370
|
+
|
|
1615
1371
|
// lib/functions/ProofUtil.ts
|
|
1616
1372
|
init_cjs_shims();
|
|
1617
1373
|
var import_ssi_types3 = require("@sphereon/ssi-types");
|
|
@@ -1623,7 +1379,7 @@ var createProofOfPossession = /* @__PURE__ */ __name(async (popMode, callbacks,
|
|
|
1623
1379
|
throw new Error(BAD_PARAMS);
|
|
1624
1380
|
}
|
|
1625
1381
|
const jwtPayload = createJWT(popMode, jwtProps, existingJwt);
|
|
1626
|
-
const jwt = await callbacks.signCallback(jwtPayload, jwtPayload.header.kid);
|
|
1382
|
+
const jwt = await callbacks.signCallback(jwtPayload, jwtPayload.header.kid, popMode === "pop");
|
|
1627
1383
|
const proof = {
|
|
1628
1384
|
proof_type: "jwt",
|
|
1629
1385
|
jwt
|
|
@@ -1779,7 +1535,7 @@ var toAuthorizationResponsePayload = /* @__PURE__ */ __name((input) => {
|
|
|
1779
1535
|
|
|
1780
1536
|
// lib/functions/RandomUtils.ts
|
|
1781
1537
|
init_cjs_shims();
|
|
1782
|
-
var
|
|
1538
|
+
var import_oid4vc_common2 = require("@sphereon/oid4vc-common");
|
|
1783
1539
|
var u8a = __toESM(require("uint8arrays"), 1);
|
|
1784
1540
|
var import_randomBytes = __toESM(require_randomBytes(), 1);
|
|
1785
1541
|
var { toString } = u8a;
|
|
@@ -1800,7 +1556,7 @@ var createCodeChallenge = /* @__PURE__ */ __name((codeVerifier, codeChallengeMet
|
|
|
1800
1556
|
if (codeChallengeMethod === CodeChallengeMethod.plain) {
|
|
1801
1557
|
return codeVerifier;
|
|
1802
1558
|
} else if (!codeChallengeMethod || codeChallengeMethod === CodeChallengeMethod.S256) {
|
|
1803
|
-
return toString((0,
|
|
1559
|
+
return toString((0, import_oid4vc_common2.defaultHasher)(codeVerifier, "sha256"), "base64url");
|
|
1804
1560
|
} else {
|
|
1805
1561
|
throw Error(`code challenge method ${codeChallengeMethod} not implemented`);
|
|
1806
1562
|
}
|
|
@@ -1821,22 +1577,22 @@ var EXPERIMENTAL_SUBJECT_PROOF_MODE_ENABLED = process.env.EXPERIMENTAL_SUBJECT_P
|
|
|
1821
1577
|
// lib/events/index.ts
|
|
1822
1578
|
init_cjs_shims();
|
|
1823
1579
|
var import_ssi_types4 = require("@sphereon/ssi-types");
|
|
1824
|
-
var CredentialOfferEventNames = /* @__PURE__ */ function(CredentialOfferEventNames2) {
|
|
1580
|
+
var CredentialOfferEventNames = /* @__PURE__ */ (function(CredentialOfferEventNames2) {
|
|
1825
1581
|
CredentialOfferEventNames2["OID4VCI_OFFER_CREATED"] = "OID4VCI_OFFER_CREATED";
|
|
1826
1582
|
CredentialOfferEventNames2["OID4VCI_OFFER_EXPIRED"] = "OID4VCI_OFFER_EXPIRED";
|
|
1827
1583
|
CredentialOfferEventNames2["OID4VCI_OFFER_DELETED"] = "OID4VCI_OFFER_DELETED";
|
|
1828
1584
|
return CredentialOfferEventNames2;
|
|
1829
|
-
}({});
|
|
1830
|
-
var CredentialEventNames = /* @__PURE__ */ function(CredentialEventNames2) {
|
|
1585
|
+
})({});
|
|
1586
|
+
var CredentialEventNames = /* @__PURE__ */ (function(CredentialEventNames2) {
|
|
1831
1587
|
CredentialEventNames2["OID4VCI_CREDENTIAL_ISSUED"] = "OID4VCI_CREDENTIAL_ISSUED";
|
|
1832
1588
|
return CredentialEventNames2;
|
|
1833
|
-
}({});
|
|
1834
|
-
var NotificationStatusEventNames = /* @__PURE__ */ function(NotificationStatusEventNames2) {
|
|
1589
|
+
})({});
|
|
1590
|
+
var NotificationStatusEventNames = /* @__PURE__ */ (function(NotificationStatusEventNames2) {
|
|
1835
1591
|
NotificationStatusEventNames2["OID4VCI_NOTIFICATION_RECEIVED"] = "OID4VCI_NOTIFICATION_RECEIVED";
|
|
1836
1592
|
NotificationStatusEventNames2["OID4VCI_NOTIFICATION_PROCESSED"] = "OID4VCI_NOTIFICATION_PROCESSED";
|
|
1837
1593
|
NotificationStatusEventNames2["OID4VCI_NOTIFICATION_ERROR"] = "OID4VCI_NOTIFICATION_ERROR";
|
|
1838
1594
|
return NotificationStatusEventNames2;
|
|
1839
|
-
}({});
|
|
1595
|
+
})({});
|
|
1840
1596
|
var EVENTS = import_ssi_types4.EventManager.instance();
|
|
1841
1597
|
|
|
1842
1598
|
// lib/index.ts
|