@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 +6 -4
- package/dist/lib/verifier-js-no-deps.cjs.js +11 -8
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +11 -8
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +1 -0
- package/dist/typings/verifier/utils.d.ts +2 -1
- package/dist/verifier-js.development.js +11 -8
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +4 -4
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +4 -4
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +2 -2
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
|
|
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, //
|
|
117
|
-
enableDigitalCredentialsApiCrossDeviceFlow: false, //
|
|
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
|
|
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:
|
|
11
|
-
* Version: 2.0.0-preview-digital-credential-api.
|
|
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({
|