@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.
@@ -63,7 +63,7 @@ export type OpenId4vpConfigurationSameDeviceOptions = {
63
63
  export declare const OpenId4vpConfigSameDeviceOptionsValidator: v.ObjectSchema<{
64
64
  readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
65
65
  readonly mode: v.LiteralSchema<Mode.SameDevice, undefined>;
66
- readonly redirectUri: v.StringSchema<undefined>;
66
+ readonly redirectUri: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">, v.UrlAction<string, undefined>]>;
67
67
  }, undefined>;
68
68
  /**
69
69
  * Options for openid4vpConfiguration to request credentials with cross device
@@ -103,7 +103,7 @@ export type OpenId4vpConfigurationAutoDetectOptions = {
103
103
  };
104
104
  export declare const OpenId4vpConfigAutoDetectOptionsValidator: v.ObjectSchema<{
105
105
  readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
106
- readonly redirectUri: v.StringSchema<undefined>;
106
+ readonly redirectUri: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">, v.UrlAction<string, undefined>]>;
107
107
  readonly mode: v.OptionalSchema<v.PicklistSchema<[Mode.CrossDevice, Mode.SameDevice], undefined>, undefined>;
108
108
  }, undefined>;
109
109
  /**
@@ -137,13 +137,13 @@ export declare const RequestCredentialsOptionsValidator: v.ObjectSchema<{
137
137
  readonly openid4vpConfiguration: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
138
138
  readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
139
139
  readonly mode: v.LiteralSchema<Mode.SameDevice, undefined>;
140
- readonly redirectUri: v.StringSchema<undefined>;
140
+ readonly redirectUri: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">, v.UrlAction<string, undefined>]>;
141
141
  }, undefined>, v.ObjectSchema<{
142
142
  readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
143
143
  readonly mode: v.LiteralSchema<Mode.CrossDevice, undefined>;
144
144
  }, undefined>, v.ObjectSchema<{
145
145
  readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
146
- readonly redirectUri: v.StringSchema<undefined>;
146
+ readonly redirectUri: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">, v.UrlAction<string, undefined>]>;
147
147
  readonly mode: v.OptionalSchema<v.PicklistSchema<[Mode.CrossDevice, Mode.SameDevice], undefined>, undefined>;
148
148
  }, undefined>], undefined>, undefined>;
149
149
  }, undefined>;
@@ -226,7 +226,7 @@ export type InitializeOptions = {
226
226
  applicationId: string;
227
227
  };
228
228
  export declare const InitializeOptionsValidator: v.ObjectSchema<{
229
- readonly apiBaseUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
229
+ readonly apiBaseUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">, v.UrlAction<string, undefined>]>;
230
230
  readonly applicationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
231
231
  }, undefined>;
232
232
  /**
@@ -658,6 +658,30 @@
658
658
  }
659
659
  };
660
660
  }
661
+ function url(message2) {
662
+ return {
663
+ kind: "validation",
664
+ type: "url",
665
+ reference: url,
666
+ async: false,
667
+ expects: null,
668
+ requirement: function requirement(input) {
669
+ try {
670
+ new URL(input);
671
+ return true;
672
+ } catch (_unused) {
673
+ return false;
674
+ }
675
+ },
676
+ message: message2,
677
+ "~run": function run(dataset, config2) {
678
+ if (dataset.typed && !this.requirement(dataset.value)) {
679
+ _addIssue(this, "URL", dataset, config2);
680
+ }
681
+ return dataset;
682
+ }
683
+ };
684
+ }
661
685
  function getFallback(schema, dataset, config2) {
662
686
  return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
663
687
  }
@@ -1473,7 +1497,7 @@
1473
1497
  const OpenId4vpConfigSameDeviceOptionsValidator = object({
1474
1498
  walletProviderId: optional(string()),
1475
1499
  mode: literal(exports.Mode.SameDevice),
1476
- redirectUri: string()
1500
+ redirectUri: pipe(string(), nonEmpty("Must not be empty"), url())
1477
1501
  });
1478
1502
  const OpenId4vpConfigCrossDeviceOptionsValidator = object({
1479
1503
  walletProviderId: optional(string()),
@@ -1481,7 +1505,7 @@
1481
1505
  });
1482
1506
  const OpenId4vpConfigAutoDetectOptionsValidator = object({
1483
1507
  walletProviderId: optional(string()),
1484
- redirectUri: string(),
1508
+ redirectUri: pipe(string(), nonEmpty("Must not be empty"), url()),
1485
1509
  mode: optional(picklist([ exports.Mode.CrossDevice, exports.Mode.SameDevice ]))
1486
1510
  });
1487
1511
  const RequestCredentialsOptionsValidator = object({
@@ -1516,7 +1540,7 @@
1516
1540
  AbortSessionErrorMessage["FailedToAbortSession"] = "Failed to abort session";
1517
1541
  })(AbortSessionErrorMessage || (AbortSessionErrorMessage = {}));
1518
1542
  const InitializeOptionsValidator = object({
1519
- apiBaseUrl: pipe(string(), nonEmpty("Must not be empty")),
1543
+ apiBaseUrl: pipe(string(), nonEmpty("Must not be empty"), url()),
1520
1544
  applicationId: pipe(string(), nonEmpty("Must not be empty"))
1521
1545
  });
1522
1546
  var SafeFetchCommonResponseErrorType;
@@ -1559,7 +1583,12 @@
1559
1583
  })(InitializeErrorMessage || (InitializeErrorMessage = {}));
1560
1584
  const initialize = options => {
1561
1585
  assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
1562
- initializeOptions = options;
1586
+ const {apiBaseUrl: apiBaseUrl} = options;
1587
+ const trimmedApiBaseUrl = apiBaseUrl.trim();
1588
+ initializeOptions = {
1589
+ apiBaseUrl: trimmedApiBaseUrl,
1590
+ applicationId: options.applicationId
1591
+ };
1563
1592
  };
1564
1593
  const getInitializeOptions = () => initializeOptions;
1565
1594
  let sessionAbortController = undefined;
@@ -2162,7 +2191,7 @@
2162
2191
  detectedMode = isMobileDetect(navigator.userAgent) ? exports.Mode.SameDevice : exports.Mode.CrossDevice;
2163
2192
  }
2164
2193
  if (detectedMode === exports.Mode.SameDevice && !isType(OpenId4vpConfigCrossDeviceOptionsValidator)(openid4vpConfiguration) && openid4vpConfiguration.redirectUri) {
2165
- return openid4vpConfiguration.redirectUri;
2194
+ return openid4vpConfiguration.redirectUri.trim();
2166
2195
  }
2167
2196
  return undefined;
2168
2197
  };