@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
|
@@ -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;
|
|
@@ -1536,10 +1560,29 @@
|
|
|
1536
1560
|
const response = await fetch(input, Object.assign(Object.assign({}, init), {
|
|
1537
1561
|
headers: headers
|
|
1538
1562
|
}));
|
|
1563
|
+
const defaultHttpErrorMessage = `HTTP error, status = ${response.status}`;
|
|
1564
|
+
if (response.status >= 400 && response.status < 500) {
|
|
1565
|
+
try {
|
|
1566
|
+
const errorBody = await response.json();
|
|
1567
|
+
if (typeof (errorBody === null || errorBody === void 0 ? void 0 : errorBody.message) === "string") {
|
|
1568
|
+
return err({
|
|
1569
|
+
type: SafeFetchErrorType.HttpError,
|
|
1570
|
+
message: errorBody.message,
|
|
1571
|
+
status: response.status
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
} catch (_a) {
|
|
1575
|
+
return err({
|
|
1576
|
+
type: SafeFetchErrorType.HttpError,
|
|
1577
|
+
message: defaultHttpErrorMessage,
|
|
1578
|
+
status: response.status
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1539
1582
|
if (response.status > 299 || response.status < 200) {
|
|
1540
1583
|
return err({
|
|
1541
1584
|
type: SafeFetchErrorType.HttpError,
|
|
1542
|
-
message:
|
|
1585
|
+
message: defaultHttpErrorMessage,
|
|
1543
1586
|
status: response.status
|
|
1544
1587
|
});
|
|
1545
1588
|
}
|
|
@@ -1559,7 +1602,12 @@
|
|
|
1559
1602
|
})(InitializeErrorMessage || (InitializeErrorMessage = {}));
|
|
1560
1603
|
const initialize = options => {
|
|
1561
1604
|
assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
|
|
1562
|
-
|
|
1605
|
+
const {apiBaseUrl: apiBaseUrl} = options;
|
|
1606
|
+
const trimmedApiBaseUrl = apiBaseUrl.trim();
|
|
1607
|
+
initializeOptions = {
|
|
1608
|
+
apiBaseUrl: trimmedApiBaseUrl,
|
|
1609
|
+
applicationId: options.applicationId
|
|
1610
|
+
};
|
|
1563
1611
|
};
|
|
1564
1612
|
const getInitializeOptions = () => initializeOptions;
|
|
1565
1613
|
let sessionAbortController = undefined;
|
|
@@ -2162,7 +2210,7 @@
|
|
|
2162
2210
|
detectedMode = isMobileDetect(navigator.userAgent) ? exports.Mode.SameDevice : exports.Mode.CrossDevice;
|
|
2163
2211
|
}
|
|
2164
2212
|
if (detectedMode === exports.Mode.SameDevice && !isType(OpenId4vpConfigCrossDeviceOptionsValidator)(openid4vpConfiguration) && openid4vpConfiguration.redirectUri) {
|
|
2165
|
-
return openid4vpConfiguration.redirectUri;
|
|
2213
|
+
return openid4vpConfiguration.redirectUri.trim();
|
|
2166
2214
|
}
|
|
2167
2215
|
return undefined;
|
|
2168
2216
|
};
|