@mattrglobal/verifier-sdk-web 1.1.1-unstable.170 → 1.1.1-unstable.172
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/dist/lib/verifier-js-no-deps.cjs.js +30 -6
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +55 -6
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +5 -5
- package/dist/verifier-js.development.js +54 -6
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +1 -1
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +1 -1
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +2 -2
|
@@ -263,7 +263,7 @@ var MessageEventDataType;
|
|
|
263
263
|
const OpenId4vpConfigSameDeviceOptionsValidator = v__namespace.object({
|
|
264
264
|
walletProviderId: v__namespace.optional(v__namespace.string()),
|
|
265
265
|
mode: v__namespace.literal(exports.Mode.SameDevice),
|
|
266
|
-
redirectUri: v__namespace.string()
|
|
266
|
+
redirectUri: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty("Must not be empty"), v__namespace.url())
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
const OpenId4vpConfigCrossDeviceOptionsValidator = v__namespace.object({
|
|
@@ -273,7 +273,7 @@ const OpenId4vpConfigCrossDeviceOptionsValidator = v__namespace.object({
|
|
|
273
273
|
|
|
274
274
|
const OpenId4vpConfigAutoDetectOptionsValidator = v__namespace.object({
|
|
275
275
|
walletProviderId: v__namespace.optional(v__namespace.string()),
|
|
276
|
-
redirectUri: v__namespace.string(),
|
|
276
|
+
redirectUri: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty("Must not be empty"), v__namespace.url()),
|
|
277
277
|
mode: v__namespace.optional(v__namespace.picklist([ exports.Mode.CrossDevice, exports.Mode.SameDevice ]))
|
|
278
278
|
});
|
|
279
279
|
|
|
@@ -318,7 +318,7 @@ var AbortSessionErrorMessage;
|
|
|
318
318
|
})(AbortSessionErrorMessage || (AbortSessionErrorMessage = {}));
|
|
319
319
|
|
|
320
320
|
const InitializeOptionsValidator = v__namespace.object({
|
|
321
|
-
apiBaseUrl: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty("Must not be empty")),
|
|
321
|
+
apiBaseUrl: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty("Must not be empty"), v__namespace.url()),
|
|
322
322
|
applicationId: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty("Must not be empty"))
|
|
323
323
|
});
|
|
324
324
|
|
|
@@ -343,10 +343,29 @@ const safeFetch = async (input, init) => {
|
|
|
343
343
|
const response = await fetch(input, Object.assign(Object.assign({}, init), {
|
|
344
344
|
headers: headers
|
|
345
345
|
}));
|
|
346
|
+
const defaultHttpErrorMessage = `HTTP error, status = ${response.status}`;
|
|
347
|
+
if (response.status >= 400 && response.status < 500) {
|
|
348
|
+
try {
|
|
349
|
+
const errorBody = await response.json();
|
|
350
|
+
if (typeof (errorBody === null || errorBody === void 0 ? void 0 : errorBody.message) === "string") {
|
|
351
|
+
return neverthrow.err({
|
|
352
|
+
type: SafeFetchErrorType.HttpError,
|
|
353
|
+
message: errorBody.message,
|
|
354
|
+
status: response.status
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
} catch (_a) {
|
|
358
|
+
return neverthrow.err({
|
|
359
|
+
type: SafeFetchErrorType.HttpError,
|
|
360
|
+
message: defaultHttpErrorMessage,
|
|
361
|
+
status: response.status
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
346
365
|
if (response.status > 299 || response.status < 200) {
|
|
347
366
|
return neverthrow.err({
|
|
348
367
|
type: SafeFetchErrorType.HttpError,
|
|
349
|
-
message:
|
|
368
|
+
message: defaultHttpErrorMessage,
|
|
350
369
|
status: response.status
|
|
351
370
|
});
|
|
352
371
|
}
|
|
@@ -370,7 +389,12 @@ var InitializeErrorMessage;
|
|
|
370
389
|
|
|
371
390
|
const initialize = options => {
|
|
372
391
|
assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
|
|
373
|
-
|
|
392
|
+
const {apiBaseUrl: apiBaseUrl} = options;
|
|
393
|
+
const trimmedApiBaseUrl = apiBaseUrl.trim();
|
|
394
|
+
initializeOptions = {
|
|
395
|
+
apiBaseUrl: trimmedApiBaseUrl,
|
|
396
|
+
applicationId: options.applicationId
|
|
397
|
+
};
|
|
374
398
|
};
|
|
375
399
|
|
|
376
400
|
const getInitializeOptions = () => initializeOptions;
|
|
@@ -994,7 +1018,7 @@ const deriveOpenId4vpRedirectUri = openid4vpConfiguration => {
|
|
|
994
1018
|
detectedMode = isMobileDetect(navigator.userAgent) ? exports.Mode.SameDevice : exports.Mode.CrossDevice;
|
|
995
1019
|
}
|
|
996
1020
|
if (detectedMode === exports.Mode.SameDevice && !isType(OpenId4vpConfigCrossDeviceOptionsValidator)(openid4vpConfiguration) && openid4vpConfiguration.redirectUri) {
|
|
997
|
-
return openid4vpConfiguration.redirectUri;
|
|
1021
|
+
return openid4vpConfiguration.redirectUri.trim();
|
|
998
1022
|
}
|
|
999
1023
|
return undefined;
|
|
1000
1024
|
};
|