@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.3 → 2.0.0-preview-digital-credential-api.4

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.
@@ -7,8 +7,8 @@
7
7
  * Do Not Translate or Localize
8
8
  *
9
9
  * Bundle of @mattrglobal/verifier-sdk-web
10
- * Generated: 2025-02-18
11
- * Version: 2.0.0-preview-digital-credential-api.3
10
+ * Generated: 2025-03-25
11
+ * Version: 2.0.0-preview-digital-credential-api.4
12
12
  * Dependencies:
13
13
  *
14
14
  * neverthrow -- 4.3.0
@@ -446,148 +446,137 @@ ResultAsync.fromPromise;
446
446
 
447
447
  ResultAsync.fromSafePromise;
448
448
 
449
- function ownKeys(e, r) {
450
- var t = Object.keys(e);
451
- if (Object.getOwnPropertySymbols) {
452
- var o = Object.getOwnPropertySymbols(e);
453
- r && (o = o.filter((function(r) {
454
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
455
- }))), t.push.apply(t, o);
456
- }
457
- return t;
458
- }
459
-
460
- function _objectSpread2(e) {
461
- for (var r = 1; r < arguments.length; r++) {
462
- var t = null != arguments[r] ? arguments[r] : {};
463
- r % 2 ? ownKeys(Object(t), !0).forEach((function(r) {
464
- _defineProperty(e, r, t[r]);
465
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach((function(r) {
466
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
467
- }));
468
- }
469
- return e;
470
- }
471
-
472
- function _typeof(o) {
473
- "@babel/helpers - typeof";
474
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
475
- return typeof o;
476
- } : function(o) {
477
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
478
- }, _typeof(o);
449
+ function _arrayLikeToArray(r, a) {
450
+ (null == a || a > r.length) && (a = r.length);
451
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
452
+ return n;
479
453
  }
480
454
 
481
- function _defineProperty(obj, key, value) {
482
- key = _toPropertyKey(key);
483
- if (key in obj) {
484
- Object.defineProperty(obj, key, {
485
- value: value,
486
- enumerable: true,
487
- configurable: true,
488
- writable: true
489
- });
490
- } else {
491
- obj[key] = value;
492
- }
493
- return obj;
494
- }
495
-
496
- function _toConsumableArray(arr) {
497
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
455
+ function _arrayWithoutHoles(r) {
456
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
498
457
  }
499
458
 
500
- function _arrayWithoutHoles(arr) {
501
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
502
- }
503
-
504
- function _iterableToArray(iter) {
505
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
506
- }
507
-
508
- function _unsupportedIterableToArray(o, minLen) {
509
- if (!o) return;
510
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
511
- var n = Object.prototype.toString.call(o).slice(8, -1);
512
- if (n === "Object" && o.constructor) n = o.constructor.name;
513
- if (n === "Map" || n === "Set") return Array.from(o);
514
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
515
- }
516
-
517
- function _arrayLikeToArray(arr, len) {
518
- if (len == null || len > arr.length) len = arr.length;
519
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
520
- return arr2;
521
- }
522
-
523
- function _nonIterableSpread() {
524
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
525
- }
526
-
527
- function _createForOfIteratorHelper(o, allowArrayLike) {
528
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
529
- if (!it) {
530
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
531
- if (it) o = it;
532
- var i = 0;
533
- var F = function() {};
459
+ function _createForOfIteratorHelper(r, e) {
460
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
461
+ if (!t) {
462
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
463
+ t && (r = t);
464
+ var n = 0, F = function() {};
534
465
  return {
535
466
  s: F,
536
467
  n: function() {
537
- if (i >= o.length) return {
538
- done: true
539
- };
540
- return {
541
- done: false,
542
- value: o[i++]
468
+ return n >= r.length ? {
469
+ done: !0
470
+ } : {
471
+ done: !1,
472
+ value: r[n++]
543
473
  };
544
474
  },
545
- e: function(e) {
546
- throw e;
475
+ e: function(r) {
476
+ throw r;
547
477
  },
548
478
  f: F
549
479
  };
550
480
  }
551
481
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
552
482
  }
553
- var normalCompletion = true, didErr = false, err;
483
+ var o, a = !0, u = !1;
554
484
  return {
555
485
  s: function() {
556
- it = it.call(o);
486
+ t = t.call(r);
557
487
  },
558
488
  n: function() {
559
- var step = it.next();
560
- normalCompletion = step.done;
561
- return step;
489
+ var r = t.next();
490
+ return a = r.done, r;
562
491
  },
563
- e: function(e) {
564
- didErr = true;
565
- err = e;
492
+ e: function(r) {
493
+ u = !0, o = r;
566
494
  },
567
495
  f: function() {
568
496
  try {
569
- if (!normalCompletion && it.return != null) it.return();
497
+ a || null == t.return || t.return();
570
498
  } finally {
571
- if (didErr) throw err;
499
+ if (u) throw o;
572
500
  }
573
501
  }
574
502
  };
575
503
  }
576
504
 
577
- function _toPrimitive(input, hint) {
578
- if (typeof input !== "object" || input === null) return input;
579
- var prim = input[Symbol.toPrimitive];
580
- if (prim !== undefined) {
581
- var res = prim.call(input, hint || "default");
582
- if (typeof res !== "object") return res;
505
+ function _defineProperty(e, r, t) {
506
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
507
+ value: t,
508
+ enumerable: !0,
509
+ configurable: !0,
510
+ writable: !0
511
+ }) : e[r] = t, e;
512
+ }
513
+
514
+ function _iterableToArray(r) {
515
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
516
+ }
517
+
518
+ function _nonIterableSpread() {
519
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
520
+ }
521
+
522
+ function ownKeys(e, r) {
523
+ var t = Object.keys(e);
524
+ if (Object.getOwnPropertySymbols) {
525
+ var o = Object.getOwnPropertySymbols(e);
526
+ r && (o = o.filter((function(r) {
527
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
528
+ }))), t.push.apply(t, o);
529
+ }
530
+ return t;
531
+ }
532
+
533
+ function _objectSpread2(e) {
534
+ for (var r = 1; r < arguments.length; r++) {
535
+ var t = null != arguments[r] ? arguments[r] : {};
536
+ r % 2 ? ownKeys(Object(t), !0).forEach((function(r) {
537
+ _defineProperty(e, r, t[r]);
538
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach((function(r) {
539
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
540
+ }));
541
+ }
542
+ return e;
543
+ }
544
+
545
+ function _toConsumableArray(r) {
546
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
547
+ }
548
+
549
+ function _toPrimitive(t, r) {
550
+ if ("object" != typeof t || !t) return t;
551
+ var e = t[Symbol.toPrimitive];
552
+ if (void 0 !== e) {
553
+ var i = e.call(t, r || "default");
554
+ if ("object" != typeof i) return i;
583
555
  throw new TypeError("@@toPrimitive must return a primitive value.");
584
556
  }
585
- return (hint === "string" ? String : Number)(input);
557
+ return ("string" === r ? String : Number)(t);
558
+ }
559
+
560
+ function _toPropertyKey(t) {
561
+ var i = _toPrimitive(t, "string");
562
+ return "symbol" == typeof i ? i : i + "";
563
+ }
564
+
565
+ function _typeof(o) {
566
+ "@babel/helpers - typeof";
567
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
568
+ return typeof o;
569
+ } : function(o) {
570
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
571
+ }, _typeof(o);
586
572
  }
587
573
 
588
- function _toPropertyKey(arg) {
589
- var key = _toPrimitive(arg, "string");
590
- return typeof key === "symbol" ? key : String(key);
574
+ function _unsupportedIterableToArray(r, a) {
575
+ if (r) {
576
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
577
+ var t = {}.toString.call(r).slice(8, -1);
578
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
579
+ }
591
580
  }
592
581
 
593
582
  var store;
@@ -1345,6 +1334,9 @@ exports.MobileCredentialVerificationReasonType = void 0;
1345
1334
  (function(MobileCredentialVerificationReasonType) {
1346
1335
  MobileCredentialVerificationReasonType["Expired"] = "expired";
1347
1336
  MobileCredentialVerificationReasonType["Inactive"] = "inactive";
1337
+ MobileCredentialVerificationReasonType["StatusRevoked"] = "invalid";
1338
+ MobileCredentialVerificationReasonType["StatusSuspended"] = "suspended";
1339
+ MobileCredentialVerificationReasonType["StatusUnknown"] = "unknown";
1348
1340
  })(exports.MobileCredentialVerificationReasonType || (exports.MobileCredentialVerificationReasonType = {}));
1349
1341
 
1350
1342
  exports.ClaimType = void 0;
@@ -1486,6 +1478,7 @@ exports.RequestCredentialsErrorType = void 0;
1486
1478
 
1487
1479
  const InitialiseOptionsValidator = object({
1488
1480
  apiBaseUrl: string(),
1481
+ applicationId: optional(string()),
1489
1482
  enableDigitalCredentialsApiSameDeviceFlow: optional(_boolean()),
1490
1483
  enableDigitalCredentialsApiCrossDeviceFlow: optional(_boolean())
1491
1484
  });
@@ -1568,12 +1561,14 @@ const getHashParamValue = (hash, param) => {
1568
1561
  return urlParams.get(param);
1569
1562
  };
1570
1563
 
1571
- const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, walletProviderId: walletProviderId}) => {
1572
- const postData = Object.assign(Object.assign({
1564
+ const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, applicationId: applicationId, walletProviderId: walletProviderId}) => {
1565
+ const postData = Object.assign(Object.assign(Object.assign({
1573
1566
  credentialQuery: credentialQuery,
1574
1567
  challenge: challenge
1575
1568
  }, redirectUri ? {
1576
1569
  redirectUri: redirectUri
1570
+ } : {}), applicationId ? {
1571
+ applicationId: applicationId
1577
1572
  } : {}), walletProviderId ? {
1578
1573
  walletProviderId: walletProviderId
1579
1574
  } : {});
@@ -1650,7 +1645,7 @@ const createDigitalCredentialsApiSession = async ({credentialQuery: credentialQu
1650
1645
  }, protocol && {
1651
1646
  protocol: protocol
1652
1647
  });
1653
- const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/browserApi/request`, {
1648
+ const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/web/request`, {
1654
1649
  method: "POST",
1655
1650
  headers: {
1656
1651
  "Content-Type": "application/json"
@@ -1670,13 +1665,14 @@ const createDigitalCredentialsApiSession = async ({credentialQuery: credentialQu
1670
1665
  return ok(data);
1671
1666
  };
1672
1667
 
1673
- const getDigitalCredentialsApiSessionResult = async ({challenge: challenge, sessionId: sessionId, response: response, apiBaseUrl: apiBaseUrl}) => {
1668
+ const getDigitalCredentialsApiSessionResult = async ({challenge: challenge, sessionId: sessionId, response: response, apiBaseUrl: apiBaseUrl, protocol: protocol}) => {
1674
1669
  const postData = {
1675
1670
  challenge: challenge,
1676
1671
  sessionId: sessionId,
1677
- response: response
1672
+ response: response,
1673
+ protocol: protocol
1678
1674
  };
1679
- const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/browserApi/response`, {
1675
+ const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/web/response`, {
1680
1676
  method: "POST",
1681
1677
  headers: {
1682
1678
  "Content-Type": "application/json"
@@ -1797,17 +1793,19 @@ const openCrossDeviceModal = options => {
1797
1793
  modalContainer.appendChild(style);
1798
1794
  modalContainer.appendChild(iframe);
1799
1795
  document.body.appendChild(modalContainer);
1800
- modalContainer.setAttribute("style", "background: rgba(0, 0, 0, 0.5) !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;");
1796
+ modalContainer.setAttribute("style", "background: rgba(0, 0, 0, 0.5) !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; z-index: 999;");
1797
+ modalContainer.setAttribute("class", "mattr-verifier-modal-container");
1801
1798
  return modalContainer;
1802
1799
  };
1803
1800
 
1804
1801
  const requestCredentialsCrossDevice = async options => {
1805
1802
  const {challenge: challenge, walletProviderId: walletProviderId, credentialQuery: credentialQuery, crossDeviceCallback: crossDeviceCallback, initialiseOptions: initialiseOptions} = options;
1806
- const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
1803
+ const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initialiseOptions;
1807
1804
  const createSessionResult = await createSession({
1808
1805
  credentialQuery: credentialQuery,
1809
1806
  challenge: challenge,
1810
1807
  apiBaseUrl: apiBaseUrl,
1808
+ applicationId: applicationId,
1811
1809
  walletProviderId: walletProviderId
1812
1810
  });
1813
1811
  if (createSessionResult.isErr()) {
@@ -1844,7 +1842,7 @@ var SameDeviceRequestCredentialsErrorMessage$1;
1844
1842
 
1845
1843
  const requestCredentialsSameDevice = async options => {
1846
1844
  const {challenge: challenge, credentialQuery: credentialQuery, redirectUri: redirectUri, walletProviderId: walletProviderId, initialiseOptions: initialiseOptions} = options;
1847
- const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
1845
+ const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initialiseOptions;
1848
1846
  window.localStorage.setItem(LocalStorageKey.challenge, challenge);
1849
1847
  const storedChallenge = window.localStorage.getItem(LocalStorageKey.challenge);
1850
1848
  if (!storedChallenge) {
@@ -1858,6 +1856,7 @@ const requestCredentialsSameDevice = async options => {
1858
1856
  challenge: storedChallenge,
1859
1857
  redirectUri: redirectUri,
1860
1858
  apiBaseUrl: apiBaseUrl,
1859
+ applicationId: applicationId,
1861
1860
  walletProviderId: walletProviderId
1862
1861
  });
1863
1862
  if (createSessionResult.isErr()) {
@@ -1927,7 +1926,8 @@ const requestCredentialsDigitalCredentialsApi = async options => {
1927
1926
  challenge: challenge,
1928
1927
  sessionId: sessionId,
1929
1928
  response: response,
1930
- apiBaseUrl: apiBaseUrl
1929
+ apiBaseUrl: apiBaseUrl,
1930
+ protocol: digitalCredentialsApiProtocol !== null && digitalCredentialsApiProtocol !== void 0 ? digitalCredentialsApiProtocol : "preview"
1931
1931
  });
1932
1932
  if (result.isOk()) {
1933
1933
  return ok({