@mattrglobal/verifier-sdk-web 1.1.1-unstable.170 → 1.1.1-unstable.171

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.
@@ -705,6 +705,31 @@ function nonEmpty(message2) {
705
705
  };
706
706
  }
707
707
 
708
+ function url(message2) {
709
+ return {
710
+ kind: "validation",
711
+ type: "url",
712
+ reference: url,
713
+ async: false,
714
+ expects: null,
715
+ requirement: function requirement(input) {
716
+ try {
717
+ new URL(input);
718
+ return true;
719
+ } catch (_unused) {
720
+ return false;
721
+ }
722
+ },
723
+ message: message2,
724
+ "~run": function run(dataset, config2) {
725
+ if (dataset.typed && !this.requirement(dataset.value)) {
726
+ _addIssue(this, "URL", dataset, config2);
727
+ }
728
+ return dataset;
729
+ }
730
+ };
731
+ }
732
+
708
733
  function getFallback(schema, dataset, config2) {
709
734
  return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
710
735
  }
@@ -1573,7 +1598,7 @@ var MessageEventDataType;
1573
1598
  const OpenId4vpConfigSameDeviceOptionsValidator = object({
1574
1599
  walletProviderId: optional(string()),
1575
1600
  mode: literal(exports.Mode.SameDevice),
1576
- redirectUri: string()
1601
+ redirectUri: pipe(string(), nonEmpty("Must not be empty"), url())
1577
1602
  });
1578
1603
 
1579
1604
  const OpenId4vpConfigCrossDeviceOptionsValidator = object({
@@ -1583,7 +1608,7 @@ const OpenId4vpConfigCrossDeviceOptionsValidator = object({
1583
1608
 
1584
1609
  const OpenId4vpConfigAutoDetectOptionsValidator = object({
1585
1610
  walletProviderId: optional(string()),
1586
- redirectUri: string(),
1611
+ redirectUri: pipe(string(), nonEmpty("Must not be empty"), url()),
1587
1612
  mode: optional(picklist([ exports.Mode.CrossDevice, exports.Mode.SameDevice ]))
1588
1613
  });
1589
1614
 
@@ -1628,7 +1653,7 @@ var AbortSessionErrorMessage;
1628
1653
  })(AbortSessionErrorMessage || (AbortSessionErrorMessage = {}));
1629
1654
 
1630
1655
  const InitializeOptionsValidator = object({
1631
- apiBaseUrl: pipe(string(), nonEmpty("Must not be empty")),
1656
+ apiBaseUrl: pipe(string(), nonEmpty("Must not be empty"), url()),
1632
1657
  applicationId: pipe(string(), nonEmpty("Must not be empty"))
1633
1658
  });
1634
1659
 
@@ -1680,7 +1705,12 @@ var InitializeErrorMessage;
1680
1705
 
1681
1706
  const initialize = options => {
1682
1707
  assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
1683
- initializeOptions = options;
1708
+ const {apiBaseUrl: apiBaseUrl} = options;
1709
+ const trimmedApiBaseUrl = apiBaseUrl.trim();
1710
+ initializeOptions = {
1711
+ apiBaseUrl: trimmedApiBaseUrl,
1712
+ applicationId: options.applicationId
1713
+ };
1684
1714
  };
1685
1715
 
1686
1716
  const getInitializeOptions = () => initializeOptions;
@@ -2335,7 +2365,7 @@ const deriveOpenId4vpRedirectUri = openid4vpConfiguration => {
2335
2365
  detectedMode = isMobileDetect(navigator.userAgent) ? exports.Mode.SameDevice : exports.Mode.CrossDevice;
2336
2366
  }
2337
2367
  if (detectedMode === exports.Mode.SameDevice && !isType(OpenId4vpConfigCrossDeviceOptionsValidator)(openid4vpConfiguration) && openid4vpConfiguration.redirectUri) {
2338
- return openid4vpConfiguration.redirectUri;
2368
+ return openid4vpConfiguration.redirectUri.trim();
2339
2369
  }
2340
2370
  return undefined;
2341
2371
  };