@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.2 → 2.0.0-preview-digital-credential-api.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/README.md CHANGED
@@ -101,8 +101,10 @@ The SDK can make a request to create a presentation session with a configured MA
101
101
 
102
102
  ## Support for Digital Credential API (Tech Preview)
103
103
 
104
- This also SDK supports the experimental Web Platform Digital Credential API. If the SDK detects the Digital Credential API is available in the current web browser and the feature has been enabled via parameters passed to the initialise function, it will attempt to use it ahead of executing the request based on OpenID4VP (ISO 18013-7).
105
-
104
+ This SDK supports the experimental Web Platform Digital Credential API and will automatically attempt to use the Digital Credential API (ahead of executing the request based on OpenID4VP as per ISO 18013-7) when the following conditions are met:
105
+ - The SDK detects the Digital Credential API is available in the current web browser.
106
+ - The feature has been enabled when the SDK was [initialised]((#initialise-the-sdk).
107
+
106
108
  ## Initialise the SDK
107
109
 
108
110
  You must initialise the SDK before you can use any of its functions and methods.
@@ -113,8 +115,8 @@ MATTRVerifierSDK.initialise({
113
115
  /**
114
116
  * Configurations when Digital Credential Api is available
115
117
  **/
116
- enableDigitalCredentialsApiSameDeviceFlow: true, // indicate if SDK will request credential via Digital Credential Api in a same device flow
117
- enableDigitalCredentialsApiCrossDeviceFlow: false, // indicate if SDK request credential via Digital Credential Api in a cross device flow
118
+ enableDigitalCredentialsApiSameDeviceFlow: true, // indicates whether the SDK will use the Digital Credential API in same-device flows.
119
+ enableDigitalCredentialsApiCrossDeviceFlow: false, // indicates whether the SDK will use the Digital Credential API in cross-device flows.
118
120
  });
119
121
  ```
120
122
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright 2024 - MATTR Limited
2
+ * Copyright 2025 - MATTR Limited
3
3
  * All rights reserved
4
4
  * Confidential and proprietary
5
5
  *
@@ -7,8 +7,8 @@
7
7
  * Do Not Translate or Localize
8
8
  *
9
9
  * Bundle of @mattrglobal/verifier-sdk-web
10
- * Generated: 2024-10-21
11
- * Version: 2.0.0-preview-digital-credential-api.2
10
+ * Generated: 2025-02-18
11
+ * Version: 2.0.0-preview-digital-credential-api.3
12
12
  * Dependencies:
13
13
  */
14
14
 
@@ -394,11 +394,13 @@ const isDigitalCredentialsApiSupported = () => {
394
394
  }
395
395
  };
396
396
 
397
- const createDigitalCredentialsApiSession = async ({credentialQuery: credentialQuery, challenge: challenge, apiBaseUrl: apiBaseUrl}) => {
398
- const postData = {
397
+ const createDigitalCredentialsApiSession = async ({credentialQuery: credentialQuery, challenge: challenge, apiBaseUrl: apiBaseUrl, protocol: protocol}) => {
398
+ const postData = Object.assign({
399
399
  credentialQuery: credentialQuery,
400
400
  challenge: challenge
401
- };
401
+ }, protocol && {
402
+ protocol: protocol
403
+ });
402
404
  const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/browserApi/request`, {
403
405
  method: "POST",
404
406
  headers: {
@@ -633,7 +635,7 @@ var SameDeviceRequestCredentialsErrorMessage;
633
635
 
634
636
  const requestCredentialsDigitalCredentialsApi = async options => {
635
637
  const {challenge: challenge, credentialQuery: credentialQuery, initialiseOptions: initialiseOptions} = options;
636
- const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
638
+ const {apiBaseUrl: apiBaseUrl, digitalCredentialsApiProtocol: digitalCredentialsApiProtocol} = initialiseOptions;
637
639
  window.localStorage.setItem(LocalStorageKey.challenge, challenge);
638
640
  const storedChallenge = window.localStorage.getItem(LocalStorageKey.challenge);
639
641
  if (!storedChallenge) {
@@ -645,7 +647,8 @@ const requestCredentialsDigitalCredentialsApi = async options => {
645
647
  const createSessionResult = await createDigitalCredentialsApiSession({
646
648
  credentialQuery: credentialQuery,
647
649
  challenge: storedChallenge,
648
- apiBaseUrl: apiBaseUrl
650
+ apiBaseUrl: apiBaseUrl,
651
+ protocol: digitalCredentialsApiProtocol
649
652
  });
650
653
  if (createSessionResult.isErr()) {
651
654
  return neverthrow.err({