@mattrglobal/verifier-sdk-web 1.1.1-unstable.153 → 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 +75 -65
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +75 -65
- 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 +2 -1
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +5 -3
- package/dist/typings/verifier/utils.d.ts +3 -3
- package/dist/verifier-js.development.js +73 -64
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +2 -2
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +2 -2
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +2 -2
- package/dist/typings/verifier/initialise.d.ts +0 -12
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { initialize, requestCredentials, handleRedirectCallback, abortCredentialRequest, isDigitalCredentialsApiSupported } from "./verifier";
|
|
2
2
|
import { HandleRedirectCallbackError, HandleRedirectCallbackErrorType } from "./verifier/handleRedirectCallback";
|
|
3
|
-
import {
|
|
3
|
+
import { InitializeOptions, RequestCredentialsOptions, OpenId4vpConfigurationSameDeviceOptions, OpenId4vpConfigurationCrossDeviceOptions, OpenId4vpConfigurationAutoDetectOptions, RequestCredentialsError, RequestCredentialsErrorType, CredentialQuery, CredentialQueryClaim, OpenidPresentationCredentialProfileSupported, Mode, RequestCredentialsResponse, AbortSessionErrorType, HandleRedirectCallbackResponse, Claim, ClaimData, ClaimType, PresentationSessionResult, PresentationSuccessResult, PresentationFailureResult, PresentationHiddenResult, PresentationErrorType, MobileCredentialPresentationCredential, MobileCredentialError, MobileCredentialResponseErrorCode, ValidityInfoRequest, CredentialBranding, CredentialBrandingImage, MobileCredentialVerificationResult, MobileCredentialVerificationReasonType, CredentialBrandingImageFormat } from "./verifier/types";
|
|
4
4
|
export { Mode, OpenidPresentationCredentialProfileSupported, MobileCredentialVerificationReasonType, RequestCredentialsErrorType, AbortSessionErrorType, HandleRedirectCallbackErrorType, CredentialBrandingImageFormat, ClaimType, MobileCredentialResponseErrorCode, };
|
|
5
|
-
export type {
|
|
5
|
+
export type { InitializeOptions, RequestCredentialsOptions, OpenId4vpConfigurationSameDeviceOptions, OpenId4vpConfigurationCrossDeviceOptions, OpenId4vpConfigurationAutoDetectOptions, CredentialQuery, CredentialQueryClaim, RequestCredentialsResponse, RequestCredentialsError, Claim, ClaimData, HandleRedirectCallbackResponse, PresentationSessionResult, PresentationSuccessResult, PresentationFailureResult, PresentationHiddenResult, PresentationErrorType, MobileCredentialPresentationCredential, MobileCredentialError, ValidityInfoRequest, CredentialBranding, CredentialBrandingImage, MobileCredentialVerificationResult, HandleRedirectCallbackError, };
|
|
6
6
|
declare const utils: {
|
|
7
7
|
generateChallenge: () => string;
|
|
8
8
|
getVersion: () => string;
|
|
9
9
|
unwrap: <T = unknown>(result: import("neverthrow").Result<T, unknown>, errMessage?: string) => T;
|
|
10
10
|
};
|
|
11
|
-
export {
|
|
11
|
+
export { initialize, requestCredentials, handleRedirectCallback, abortCredentialRequest, isDigitalCredentialsApiSupported, utils, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { initialize } from "./initialize";
|
|
2
2
|
export { requestCredentials } from "./requestCredentials";
|
|
3
3
|
export { handleRedirectCallback } from "./handleRedirectCallback";
|
|
4
4
|
export { abortCredentialRequest } from "./abortCredentialRequest";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InitializeOptions } from "./types";
|
|
2
|
+
export declare enum InitializeErrorMessage {
|
|
3
|
+
SdkNotInitialized = "SDK not initialized"
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Initializes the SDK with the provided options.
|
|
7
|
+
*
|
|
8
|
+
* @param options - The options to initialize the SDK with.
|
|
9
|
+
*/
|
|
10
|
+
export declare const initialize: (options: InitializeOptions) => void;
|
|
11
|
+
export declare const getInitializeOptions: () => InitializeOptions | undefined;
|
|
12
|
+
export declare const clearInitializeOptions: () => void;
|
|
@@ -120,7 +120,7 @@ export type CredentialQuery = {
|
|
|
120
120
|
profile: OpenidPresentationCredentialProfileSupported;
|
|
121
121
|
/**
|
|
122
122
|
* the mDL’s type. Confirm with the certificate issuer for what docType they are issuing. Some common examples include:
|
|
123
|
-
* * Mobile Driver
|
|
123
|
+
* * Mobile Driver License (`org.iso.18013.5.1.mDL`).
|
|
124
124
|
* * PhotoID (`org.iso.23220.photoid.1`).
|
|
125
125
|
* * Mobile Vehicle Registration Card (`org.iso.7367.1.mVRC`).
|
|
126
126
|
* * Health certificate (`org.micov.vtr.1`).
|
|
@@ -321,6 +321,7 @@ export type RequestCredentialsWithDcApiOptions = {
|
|
|
321
321
|
apiBaseUrl: string;
|
|
322
322
|
sessionId: string;
|
|
323
323
|
sessionKey: string;
|
|
324
|
+
sessionTtl: number;
|
|
324
325
|
challenge: string;
|
|
325
326
|
request: Record<string, unknown>;
|
|
326
327
|
};
|
|
@@ -219,13 +219,13 @@ export type HandleRedirectCallbackResponse = {
|
|
|
219
219
|
sessionId: string;
|
|
220
220
|
};
|
|
221
221
|
/**
|
|
222
|
-
* Options for the
|
|
222
|
+
* Options for the initialize function
|
|
223
223
|
*/
|
|
224
|
-
export type
|
|
224
|
+
export type InitializeOptions = {
|
|
225
225
|
apiBaseUrl: string;
|
|
226
226
|
applicationId: string;
|
|
227
227
|
};
|
|
228
|
-
export declare const
|
|
228
|
+
export declare const InitializeOptionsValidator: v.ObjectSchema<{
|
|
229
229
|
readonly apiBaseUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
|
|
230
230
|
readonly applicationId: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
|
|
231
231
|
}, undefined>;
|
|
@@ -235,6 +235,7 @@ export declare const InitialiseOptionsValidator: v.ObjectSchema<{
|
|
|
235
235
|
export type CreatePresentationSession = {
|
|
236
236
|
readonly sessionId: string;
|
|
237
237
|
readonly sessionKey: string;
|
|
238
|
+
readonly sessionTimeoutId?: number;
|
|
238
239
|
};
|
|
239
240
|
/**
|
|
240
241
|
* Struct for a stored presentation session
|
|
@@ -242,4 +243,5 @@ export type CreatePresentationSession = {
|
|
|
242
243
|
export type StoredPresentationSession = {
|
|
243
244
|
readonly sessionId: string;
|
|
244
245
|
readonly sessionKey?: string;
|
|
246
|
+
readonly sessionTimeoutId?: number;
|
|
245
247
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { SafeFetchValidateResponseError } from "../common/safeFetch";
|
|
3
|
-
import { CreateSessionRequest, ExchangeSessionResultResponse, GetSessionStatusRequest, GetSessionStatusResponse, AbortSessionRequest,
|
|
3
|
+
import { CreateSessionRequest, ExchangeSessionResultResponse, GetSessionStatusRequest, GetSessionStatusResponse, AbortSessionRequest, InitializeOptions, CreateSessionResponse } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Generates a challenge string using the window.crypto API.
|
|
6
6
|
*
|
|
@@ -26,7 +26,7 @@ export declare const getHashParamValue: (hash: string, param: string) => string
|
|
|
26
26
|
* @param walletProviderId - optional, The ID of the wallet provider, if not provided the default wallet provider will be used.
|
|
27
27
|
* @returns A promise that resolves to a result containing either the created session response or an error.
|
|
28
28
|
*/
|
|
29
|
-
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, walletProviderId, dcApiSupported, applicationId, }: CreateSessionRequest &
|
|
29
|
+
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, walletProviderId, dcApiSupported, applicationId, }: CreateSessionRequest & InitializeOptions) => Promise<Result<CreateSessionResponse, SafeFetchValidateResponseError>>;
|
|
30
30
|
/**
|
|
31
31
|
* Abort a session with the provided parameters.
|
|
32
32
|
*
|
|
@@ -42,7 +42,7 @@ export declare const abortSession: ({ apiBaseUrl, sessionId, sessionKey, }: Abor
|
|
|
42
42
|
* @param sessionKey - The authorization key for performing operations for the session.
|
|
43
43
|
* @returns A promise that resolves to a result containing either the session status response or an error.
|
|
44
44
|
*/
|
|
45
|
-
export declare const getSessionStatus: ({ apiBaseUrl, sessionId, sessionKey, }: GetSessionStatusRequest &
|
|
45
|
+
export declare const getSessionStatus: ({ apiBaseUrl, sessionId, sessionKey, }: GetSessionStatusRequest & InitializeOptions) => Promise<Result<GetSessionStatusResponse, SafeFetchValidateResponseError>>;
|
|
46
46
|
/**
|
|
47
47
|
* Exchange the result of a session using the provided parameters.
|
|
48
48
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Do Not Translate or Localize
|
|
8
8
|
*
|
|
9
9
|
* Bundle of @mattrglobal/verifier-sdk-web
|
|
10
|
-
* Generated: 2025-05-
|
|
10
|
+
* Generated: 2025-05-18
|
|
11
11
|
* Version: 1.1.0
|
|
12
12
|
* Dependencies:
|
|
13
13
|
*
|
|
@@ -1427,7 +1427,7 @@
|
|
|
1427
1427
|
(function(AbortSessionErrorMessage) {
|
|
1428
1428
|
AbortSessionErrorMessage["FailedToAbortSession"] = "Failed to abort session";
|
|
1429
1429
|
})(AbortSessionErrorMessage || (AbortSessionErrorMessage = {}));
|
|
1430
|
-
const
|
|
1430
|
+
const InitializeOptionsValidator = object({
|
|
1431
1431
|
apiBaseUrl: pipe(string(), nonEmpty("Must not be empty")),
|
|
1432
1432
|
applicationId: pipe(string(), nonEmpty("Must not be empty"))
|
|
1433
1433
|
});
|
|
@@ -1464,43 +1464,51 @@
|
|
|
1464
1464
|
});
|
|
1465
1465
|
}
|
|
1466
1466
|
};
|
|
1467
|
-
let
|
|
1468
|
-
var
|
|
1469
|
-
(function(
|
|
1470
|
-
|
|
1471
|
-
})(
|
|
1472
|
-
const
|
|
1473
|
-
assertType(
|
|
1474
|
-
|
|
1467
|
+
let initializeOptions = undefined;
|
|
1468
|
+
var InitializeErrorMessage;
|
|
1469
|
+
(function(InitializeErrorMessage) {
|
|
1470
|
+
InitializeErrorMessage["SdkNotInitialized"] = "SDK not initialized";
|
|
1471
|
+
})(InitializeErrorMessage || (InitializeErrorMessage = {}));
|
|
1472
|
+
const initialize = options => {
|
|
1473
|
+
assertType(InitializeOptionsValidator, "Invalid initialize options")(options);
|
|
1474
|
+
initializeOptions = options;
|
|
1475
1475
|
};
|
|
1476
|
-
const
|
|
1476
|
+
const getInitializeOptions = () => initializeOptions;
|
|
1477
1477
|
let sessionAbortController = undefined;
|
|
1478
1478
|
let _sessionId = undefined;
|
|
1479
1479
|
let _sessionKey = undefined;
|
|
1480
|
+
let _sessionTimeoutId = undefined;
|
|
1480
1481
|
const getActiveSession = () => {
|
|
1481
1482
|
const sessionId = _sessionId;
|
|
1482
1483
|
const sessionKey = _sessionKey;
|
|
1484
|
+
const sessionTimeoutId = _sessionTimeoutId;
|
|
1483
1485
|
if (sessionId) {
|
|
1484
1486
|
return {
|
|
1485
1487
|
sessionId: sessionId,
|
|
1486
|
-
sessionKey: sessionKey
|
|
1488
|
+
sessionKey: sessionKey,
|
|
1489
|
+
sessionTimeoutId: sessionTimeoutId
|
|
1487
1490
|
};
|
|
1488
1491
|
}
|
|
1489
1492
|
return undefined;
|
|
1490
1493
|
};
|
|
1491
1494
|
const setActiveSession = session => {
|
|
1492
|
-
const {sessionId: sessionId, sessionKey: sessionKey} = session;
|
|
1495
|
+
const {sessionId: sessionId, sessionKey: sessionKey, sessionTimeoutId: sessionTimeoutId} = session;
|
|
1493
1496
|
_sessionId = sessionId;
|
|
1494
1497
|
_sessionKey = sessionKey;
|
|
1498
|
+
_sessionTimeoutId = sessionTimeoutId;
|
|
1495
1499
|
const abortController = new AbortController;
|
|
1496
1500
|
sessionAbortController = abortController;
|
|
1497
1501
|
return abortController;
|
|
1498
1502
|
};
|
|
1499
1503
|
const removeActiveSession = () => {
|
|
1500
1504
|
sessionAbortController === null || sessionAbortController === void 0 ? void 0 : sessionAbortController.abort();
|
|
1505
|
+
if (_sessionTimeoutId) {
|
|
1506
|
+
window.clearTimeout(_sessionTimeoutId);
|
|
1507
|
+
}
|
|
1501
1508
|
sessionAbortController = undefined;
|
|
1502
1509
|
_sessionKey = undefined;
|
|
1503
1510
|
_sessionId = undefined;
|
|
1511
|
+
_sessionTimeoutId = undefined;
|
|
1504
1512
|
};
|
|
1505
1513
|
var isMobile_1 = isMobile;
|
|
1506
1514
|
var isMobile_2 = isMobile;
|
|
@@ -1782,25 +1790,49 @@
|
|
|
1782
1790
|
window.addEventListener(WindowEventListenerType.message, listener, false);
|
|
1783
1791
|
}));
|
|
1784
1792
|
};
|
|
1793
|
+
const abortCredentialRequest = async () => {
|
|
1794
|
+
const initializeOptions = getInitializeOptions();
|
|
1795
|
+
if (!initializeOptions) {
|
|
1796
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
1797
|
+
}
|
|
1798
|
+
const {apiBaseUrl: apiBaseUrl} = initializeOptions;
|
|
1799
|
+
const session = getActiveSession();
|
|
1800
|
+
if (!session || !session.sessionKey) {
|
|
1801
|
+
return ok(undefined);
|
|
1802
|
+
}
|
|
1803
|
+
const {sessionId: sessionId, sessionKey: sessionKey} = session;
|
|
1804
|
+
removeActiveSession();
|
|
1805
|
+
const abortSessionResult = await abortSession({
|
|
1806
|
+
apiBaseUrl: apiBaseUrl,
|
|
1807
|
+
sessionId: sessionId,
|
|
1808
|
+
sessionKey: sessionKey
|
|
1809
|
+
});
|
|
1810
|
+
if (abortSessionResult.isErr()) {
|
|
1811
|
+
return err({
|
|
1812
|
+
type: exports.AbortSessionErrorType.AbortSessionFailed,
|
|
1813
|
+
message: AbortSessionErrorMessage.FailedToAbortSession,
|
|
1814
|
+
cause: abortSessionResult.error
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
return ok(undefined);
|
|
1818
|
+
};
|
|
1785
1819
|
const requestCredentialsWithDigitalCredentialsApi = async options => {
|
|
1786
|
-
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge, request: request} = options;
|
|
1787
|
-
const
|
|
1820
|
+
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge, request: request, sessionTtl: sessionTtl} = options;
|
|
1821
|
+
const sessionTimeoutId = window.setTimeout((() => removeActiveSession()), sessionTtl * 1e3);
|
|
1822
|
+
const abortController = setActiveSession({
|
|
1823
|
+
sessionId: sessionId,
|
|
1824
|
+
sessionKey: sessionKey,
|
|
1825
|
+
sessionTimeoutId: sessionTimeoutId
|
|
1826
|
+
});
|
|
1827
|
+
const credentialResponseResult = await getCredentials(request, abortController);
|
|
1788
1828
|
if (credentialResponseResult.isErr()) {
|
|
1789
|
-
await
|
|
1790
|
-
apiBaseUrl: apiBaseUrl,
|
|
1791
|
-
sessionId: sessionId,
|
|
1792
|
-
sessionKey: sessionKey
|
|
1793
|
-
});
|
|
1829
|
+
await abortCredentialRequest();
|
|
1794
1830
|
return err(credentialResponseResult.error);
|
|
1795
1831
|
}
|
|
1796
1832
|
const credentialResponse = credentialResponseResult.value;
|
|
1797
1833
|
const parsedCredentialResponseResult = parseCredentialResponse(credentialResponse);
|
|
1798
1834
|
if (parsedCredentialResponseResult.isErr()) {
|
|
1799
|
-
await
|
|
1800
|
-
apiBaseUrl: apiBaseUrl,
|
|
1801
|
-
sessionId: sessionId,
|
|
1802
|
-
sessionKey: sessionKey
|
|
1803
|
-
});
|
|
1835
|
+
await abortCredentialRequest();
|
|
1804
1836
|
return err(parsedCredentialResponseResult.error);
|
|
1805
1837
|
}
|
|
1806
1838
|
const parsedCredentialResponse = parsedCredentialResponseResult.value;
|
|
@@ -1821,9 +1853,11 @@
|
|
|
1821
1853
|
}
|
|
1822
1854
|
return ok(credentialVerificationResult.value);
|
|
1823
1855
|
};
|
|
1824
|
-
const getCredentials = async request => {
|
|
1856
|
+
const getCredentials = async (request, abortController) => {
|
|
1825
1857
|
try {
|
|
1826
|
-
const credentialResponse = await navigator.credentials.get(request)
|
|
1858
|
+
const credentialResponse = await navigator.credentials.get(Object.assign(Object.assign({}, request), {
|
|
1859
|
+
signal: abortController.signal
|
|
1860
|
+
}));
|
|
1827
1861
|
return ok(credentialResponse);
|
|
1828
1862
|
} catch (exception) {
|
|
1829
1863
|
return err({
|
|
@@ -1962,12 +1996,12 @@
|
|
|
1962
1996
|
};
|
|
1963
1997
|
const requestCredentials = async options => {
|
|
1964
1998
|
var _a;
|
|
1965
|
-
const
|
|
1966
|
-
if (!
|
|
1967
|
-
throw new Exception(
|
|
1999
|
+
const initializeOptions = getInitializeOptions();
|
|
2000
|
+
if (!initializeOptions) {
|
|
2001
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
1968
2002
|
}
|
|
1969
2003
|
assertType(RequestCredentialsOptionsValidator, "Invalid request credential options")(options);
|
|
1970
|
-
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} =
|
|
2004
|
+
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initializeOptions;
|
|
1971
2005
|
const {challenge: challenge = generateChallenge(), credentialQuery: credentialQuery, openid4vpConfiguration: openid4vpConfiguration} = options;
|
|
1972
2006
|
const dcApiSupported = isDigitalCredentialsApiSupported();
|
|
1973
2007
|
const openId4VpRedirectUri = deriveOpenId4vpRedirectUri(openid4vpConfiguration);
|
|
@@ -1990,13 +2024,14 @@
|
|
|
1990
2024
|
const session = createSessionResult.value;
|
|
1991
2025
|
const {sessionKey: sessionKey, sessionId: sessionId} = session;
|
|
1992
2026
|
if (session.type === SessionType.DigitalCredentialsApi) {
|
|
1993
|
-
const {request: request} = session;
|
|
2027
|
+
const {request: request, sessionTtl: sessionTtl} = session;
|
|
1994
2028
|
return await requestCredentialsWithDigitalCredentialsApi({
|
|
1995
2029
|
apiBaseUrl: apiBaseUrl,
|
|
1996
2030
|
request: request,
|
|
1997
2031
|
sessionId: sessionId,
|
|
1998
2032
|
sessionKey: sessionKey,
|
|
1999
|
-
challenge: challenge
|
|
2033
|
+
challenge: challenge,
|
|
2034
|
+
sessionTtl: sessionTtl
|
|
2000
2035
|
});
|
|
2001
2036
|
}
|
|
2002
2037
|
if (!openid4vpConfiguration) {
|
|
@@ -2051,11 +2086,11 @@
|
|
|
2051
2086
|
HandleRedirectCallbackErrorMessage["FailedToGetSessionResult"] = "Failed to get session result";
|
|
2052
2087
|
})(HandleRedirectCallbackErrorMessage || (HandleRedirectCallbackErrorMessage = {}));
|
|
2053
2088
|
const handleRedirectCallback = async () => {
|
|
2054
|
-
const
|
|
2055
|
-
if (!
|
|
2056
|
-
throw new Exception(
|
|
2089
|
+
const initializeOptions = getInitializeOptions();
|
|
2090
|
+
if (!initializeOptions) {
|
|
2091
|
+
throw new Exception(InitializeErrorMessage.SdkNotInitialized);
|
|
2057
2092
|
}
|
|
2058
|
-
const {apiBaseUrl: apiBaseUrl} =
|
|
2093
|
+
const {apiBaseUrl: apiBaseUrl} = initializeOptions;
|
|
2059
2094
|
const responseCode = getHashParamValue(window.location.hash, "response_code");
|
|
2060
2095
|
if (!responseCode) {
|
|
2061
2096
|
return err({
|
|
@@ -2089,32 +2124,6 @@
|
|
|
2089
2124
|
sessionId: result.value.sessionId
|
|
2090
2125
|
});
|
|
2091
2126
|
};
|
|
2092
|
-
const abortCredentialRequest = async () => {
|
|
2093
|
-
const initialiseOptions = getInitialiseOptions();
|
|
2094
|
-
if (!initialiseOptions) {
|
|
2095
|
-
throw new Exception(InitialiseErrorMessage.SdkNotInitialised);
|
|
2096
|
-
}
|
|
2097
|
-
const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
|
|
2098
|
-
const session = getActiveSession();
|
|
2099
|
-
if (!session || !session.sessionKey) {
|
|
2100
|
-
return ok(undefined);
|
|
2101
|
-
}
|
|
2102
|
-
const {sessionId: sessionId, sessionKey: sessionKey} = session;
|
|
2103
|
-
removeActiveSession();
|
|
2104
|
-
const abortSessionResult = await abortSession({
|
|
2105
|
-
apiBaseUrl: apiBaseUrl,
|
|
2106
|
-
sessionId: sessionId,
|
|
2107
|
-
sessionKey: sessionKey
|
|
2108
|
-
});
|
|
2109
|
-
if (abortSessionResult.isErr()) {
|
|
2110
|
-
return err({
|
|
2111
|
-
type: exports.AbortSessionErrorType.AbortSessionFailed,
|
|
2112
|
-
message: AbortSessionErrorMessage.FailedToAbortSession,
|
|
2113
|
-
cause: abortSessionResult.error
|
|
2114
|
-
});
|
|
2115
|
-
}
|
|
2116
|
-
return ok(undefined);
|
|
2117
|
-
};
|
|
2118
2127
|
const utils = {
|
|
2119
2128
|
generateChallenge: generateChallenge,
|
|
2120
2129
|
getVersion: getVersion,
|
|
@@ -2122,7 +2131,7 @@
|
|
|
2122
2131
|
};
|
|
2123
2132
|
exports.abortCredentialRequest = abortCredentialRequest;
|
|
2124
2133
|
exports.handleRedirectCallback = handleRedirectCallback;
|
|
2125
|
-
exports.
|
|
2134
|
+
exports.initialize = initialize;
|
|
2126
2135
|
exports.isDigitalCredentialsApiSupported = isDigitalCredentialsApiSupported;
|
|
2127
2136
|
exports.requestCredentials = requestCredentials;
|
|
2128
2137
|
exports.utils = utils;
|