@mattrglobal/verifier-sdk-web 1.1.1-unstable.154 → 1.1.1-unstable.155
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/README.md +13 -13
- package/dist/lib/verifier-js-no-deps.cjs.js +23 -23
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +23 -23
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/index.d.ts +4 -4
- package/dist/typings/verifier/index.d.ts +1 -1
- package/dist/typings/verifier/initialize.d.ts +12 -0
- package/dist/typings/verifier/types/credential-presentation.d.ts +1 -1
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +3 -3
- package/dist/typings/verifier/utils.d.ts +3 -3
- package/dist/verifier-js.development.js +23 -23
- 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
- package/dist/typings/verifier/initialise.d.ts +0 -12
|
@@ -1537,7 +1537,7 @@ var AbortSessionErrorMessage;
|
|
|
1537
1537
|
AbortSessionErrorMessage["FailedToAbortSession"] = "Failed to abort session";
|
|
1538
1538
|
})(AbortSessionErrorMessage || (AbortSessionErrorMessage = {}));
|
|
1539
1539
|
|
|
1540
|
-
const
|
|
1540
|
+
const InitializeOptionsValidator = object({
|
|
1541
1541
|
apiBaseUrl: pipe(string(), nonEmpty("Must not be empty")),
|
|
1542
1542
|
applicationId: pipe(string(), nonEmpty("Must not be empty"))
|
|
1543
1543
|
});
|
|
@@ -1580,20 +1580,20 @@ const safeFetch = async (input, init) => {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
};
|
|
1582
1582
|
|
|
1583
|
-
let
|
|
1583
|
+
let initializeOptions = undefined;
|
|
1584
1584
|
|
|
1585
|
-
var
|
|
1585
|
+
var InitializeErrorMessage;
|
|
1586
1586
|
|
|
1587
|
-
(function(
|
|
1588
|
-
|
|
1589
|
-
})(
|
|
1587
|
+
(function(InitializeErrorMessage) {
|
|
1588
|
+
InitializeErrorMessage["SdkNotInitialized"] = "SDK not initialized";
|
|
1589
|
+
})(InitializeErrorMessage || (InitializeErrorMessage = {}));
|
|
1590
1590
|
|
|
1591
|
-
const
|
|
1592
|
-
assertType(
|
|
1593
|
-
|
|
1591
|
+
const initialize = options => {
|
|
1592
|
+
assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
|
|
1593
|
+
initializeOptions = options;
|
|
1594
1594
|
};
|
|
1595
1595
|
|
|
1596
|
-
const
|
|
1596
|
+
const getInitializeOptions = () => initializeOptions;
|
|
1597
1597
|
|
|
1598
1598
|
let sessionAbortController = undefined;
|
|
1599
1599
|
|
|
@@ -1948,11 +1948,11 @@ const requestCredentialsWithCrossDevice = async options => {
|
|
|
1948
1948
|
};
|
|
1949
1949
|
|
|
1950
1950
|
const abortCredentialRequest = async () => {
|
|
1951
|
-
const
|
|
1952
|
-
if (!
|
|
1953
|
-
throw new Exception(
|
|
1951
|
+
const initializeOptions = getInitializeOptions();
|
|
1952
|
+
if (!initializeOptions) {
|
|
1953
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
1954
1954
|
}
|
|
1955
|
-
const {apiBaseUrl: apiBaseUrl} =
|
|
1955
|
+
const {apiBaseUrl: apiBaseUrl} = initializeOptions;
|
|
1956
1956
|
const session = getActiveSession();
|
|
1957
1957
|
if (!session || !session.sessionKey) {
|
|
1958
1958
|
return ok(undefined);
|
|
@@ -2166,12 +2166,12 @@ const requestCredentialsSameDevice = async options => {
|
|
|
2166
2166
|
|
|
2167
2167
|
const requestCredentials = async options => {
|
|
2168
2168
|
var _a;
|
|
2169
|
-
const
|
|
2170
|
-
if (!
|
|
2171
|
-
throw new Exception(
|
|
2169
|
+
const initializeOptions = getInitializeOptions();
|
|
2170
|
+
if (!initializeOptions) {
|
|
2171
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
2172
2172
|
}
|
|
2173
2173
|
assertType(RequestCredentialsOptionsValidator, "Invalid request credential options")(options);
|
|
2174
|
-
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} =
|
|
2174
|
+
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initializeOptions;
|
|
2175
2175
|
const {challenge: challenge = generateChallenge(), credentialQuery: credentialQuery, openid4vpConfiguration: openid4vpConfiguration} = options;
|
|
2176
2176
|
const dcApiSupported = isDigitalCredentialsApiSupported();
|
|
2177
2177
|
const openId4VpRedirectUri = deriveOpenId4vpRedirectUri(openid4vpConfiguration);
|
|
@@ -2262,11 +2262,11 @@ var HandleRedirectCallbackErrorMessage;
|
|
|
2262
2262
|
})(HandleRedirectCallbackErrorMessage || (HandleRedirectCallbackErrorMessage = {}));
|
|
2263
2263
|
|
|
2264
2264
|
const handleRedirectCallback = async () => {
|
|
2265
|
-
const
|
|
2266
|
-
if (!
|
|
2267
|
-
throw new Exception(
|
|
2265
|
+
const initializeOptions = getInitializeOptions();
|
|
2266
|
+
if (!initializeOptions) {
|
|
2267
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
2268
2268
|
}
|
|
2269
|
-
const {apiBaseUrl: apiBaseUrl} =
|
|
2269
|
+
const {apiBaseUrl: apiBaseUrl} = initializeOptions;
|
|
2270
2270
|
const responseCode = getHashParamValue(window.location.hash, "response_code");
|
|
2271
2271
|
if (!responseCode) {
|
|
2272
2272
|
return err({
|
|
@@ -2311,7 +2311,7 @@ exports.abortCredentialRequest = abortCredentialRequest;
|
|
|
2311
2311
|
|
|
2312
2312
|
exports.handleRedirectCallback = handleRedirectCallback;
|
|
2313
2313
|
|
|
2314
|
-
exports.
|
|
2314
|
+
exports.initialize = initialize;
|
|
2315
2315
|
|
|
2316
2316
|
exports.isDigitalCredentialsApiSupported = isDigitalCredentialsApiSupported;
|
|
2317
2317
|
|