@sphereon/oid4vci-client 0.20.1-next.5 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -425,6 +425,7 @@ var MetadataClientV1_0_15 = class _MetadataClientV1_0_15 {
425
425
  let credential_endpoint;
426
426
  let nonce_endpoint;
427
427
  let deferred_credential_endpoint;
428
+ let notification_endpoint;
428
429
  let authorization_endpoint;
429
430
  let authorization_challenge_endpoint;
430
431
  let authorizationServerType = "OID4VCI";
@@ -441,6 +442,7 @@ ${JSON.stringify(credentialIssuerMetadata)}`);
441
442
  credential_endpoint = credentialIssuerMetadata.credential_endpoint;
442
443
  nonce_endpoint = credentialIssuerMetadata.nonce_endpoint;
443
444
  deferred_credential_endpoint = credentialIssuerMetadata.deferred_credential_endpoint;
445
+ notification_endpoint = credentialIssuerMetadata.notification_endpoint;
444
446
  if (credentialIssuerMetadata.token_endpoint) {
445
447
  token_endpoint = credentialIssuerMetadata.token_endpoint;
446
448
  }
@@ -498,6 +500,13 @@ ${JSON.stringify(credentialIssuerMetadata)}`);
498
500
  deferred_credential_endpoint = authMetadata.deferred_credential_endpoint;
499
501
  }
500
502
  }
503
+ if (authMetadata.notification_endpoint) {
504
+ if (notification_endpoint && authMetadata.notification_endpoint !== notification_endpoint) {
505
+ logger2.debug(`Credential issuer has a different notification_endpoint (${notification_endpoint}) from the Authorization Server (${authMetadata.notification_endpoint}). Will use the issuer value`);
506
+ } else {
507
+ notification_endpoint = authMetadata.notification_endpoint;
508
+ }
509
+ }
501
510
  }
502
511
  if (!authorization_endpoint) {
503
512
  logger2.debug(`Issuer ${issuer} does not expose authorization_endpoint, so only pre-auth will be supported`);
@@ -534,6 +543,9 @@ ${JSON.stringify(credentialIssuerMetadata)}`);
534
543
  },
535
544
  ...deferred_credential_endpoint && {
536
545
  deferred_credential_endpoint
546
+ },
547
+ ...notification_endpoint && {
548
+ notification_endpoint
537
549
  }
538
550
  };
539
551
  logger2.debug(`Issuer ${issuer} token endpoint ${token_endpoint}, credential endpoint ${credential_endpoint}`);
@@ -542,6 +554,7 @@ ${JSON.stringify(credentialIssuerMetadata)}`);
542
554
  token_endpoint,
543
555
  credential_endpoint,
544
556
  authorization_challenge_endpoint,
557
+ notification_endpoint,
545
558
  authorizationServerType,
546
559
  credentialIssuerMetadata: v15CredentialIssuerMetadata,
547
560
  authorizationServerMetadata: authMetadata
@@ -1463,6 +1476,11 @@ var CredentialRequestClient = class {
1463
1476
  });
1464
1477
  }
1465
1478
  response.access_token = requestToken;
1479
+ if (uniformRequest.credential_subject_issuance && response.successBody || response.successBody?.credential_subject_issuance) {
1480
+ if (JSON.stringify(uniformRequest.credential_subject_issuance) !== JSON.stringify(response.successBody?.credential_subject_issuance)) {
1481
+ throw Error("Subject signing was requested, but issuer did not provide the options in its response");
1482
+ }
1483
+ }
1466
1484
  logger5.debug(`Credential endpoint ${credentialEndpoint} response:\r
1467
1485
  ${JSON.stringify(response, null, 2)}`);
1468
1486
  return {