@mattrglobal/verifier-sdk-web 1.1.1-unstable.91 → 1.1.1-unstable.94
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 +12 -17
- package/dist/lib/verifier-js-no-deps.cjs.js +279 -92
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +269 -111
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/common/safeFetch.d.ts +3 -1
- package/dist/typings/common/sleep.d.ts +1 -0
- package/dist/typings/index.d.ts +5 -6
- package/dist/typings/verifier/abortCredentialRequest.d.ts +6 -0
- package/dist/typings/verifier/handleRedirectCallback.d.ts +1 -1
- package/dist/typings/verifier/index.d.ts +1 -0
- package/dist/typings/verifier/instanceContext.d.ts +7 -0
- package/dist/typings/verifier/requestCredentialsCrossDevice.d.ts +3 -47
- package/dist/typings/verifier/requestCredentialsSameDevice.d.ts +1 -1
- package/dist/typings/verifier/types/credential-presentation.d.ts +31 -0
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +48 -58
- package/dist/typings/verifier/utils.d.ts +18 -2
- package/dist/verifier-js.development.js +245 -106
- 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
|
@@ -16,7 +16,9 @@ export declare enum SafeFetchErrorType {
|
|
|
16
16
|
*/
|
|
17
17
|
UnknownError = "UnknownError"
|
|
18
18
|
}
|
|
19
|
-
export type SafeFetchValidateRespondError = BaseError<SafeFetchErrorType | SafeFetchCommonRespondErrorType.UnexpectedRespond
|
|
19
|
+
export type SafeFetchValidateRespondError = BaseError<SafeFetchErrorType | SafeFetchCommonRespondErrorType.UnexpectedRespond> & {
|
|
20
|
+
status?: number;
|
|
21
|
+
};
|
|
20
22
|
export type SafeFetchError = BaseError<SafeFetchErrorType> & {
|
|
21
23
|
status?: number;
|
|
22
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { initialise, requestCredentials, handleRedirectCallback } from "./verifier";
|
|
1
|
+
import { initialise, requestCredentials, handleRedirectCallback, abortCredentialRequest } from "./verifier";
|
|
2
2
|
import { HandleRedirectCallbackError, HandleRedirectCallbackErrorType } from "./verifier/handleRedirectCallback";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export type { InitialiseOptions, RequestCredentialsOptions, RequestCredentialsSameDeviceOptions, RequestCredentialsCrossDeviceDeviceOptions, RequestCredentialsAutoDetectOptions, CredentialQuery, CredentialQueryClaim, RequestCredentialsResponse, SameDeviceRequestCredentialsResponse, CrossDeviceRequestCredentialsResponse, RequestCredentialsError, CrossDeviceCallbackError, Claim, ClaimData, HandleRedirectCallbackResponse, PresentationSessionResult, PresentationSuccessResult, PresentationFailureResult, PresentationHiddenResult, PresentationErrorType, MobileCredentialPresentationCredential, MobileCredentialError, ValidityInfoRequest, CredentialBranding, CredentialBrandingImage, CrossDeviceCallback, CrossDeviceCallbackOnCompleteResponse, MobileCredentialVerificationResult, HandleRedirectCallbackError, };
|
|
3
|
+
import { InitialiseOptions, RequestCredentialsOptions, RequestCredentialsSameDeviceOptions, RequestCredentialsCrossDeviceDeviceOptions, RequestCredentialsAutoDetectOptions, 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
|
+
export { Mode, OpenidPresentationCredentialProfileSupported, MobileCredentialVerificationReasonType, RequestCredentialsErrorType, AbortSessionErrorType, HandleRedirectCallbackErrorType, CredentialBrandingImageFormat, ClaimType, MobileCredentialResponseErrorCode, };
|
|
5
|
+
export type { InitialiseOptions, RequestCredentialsOptions, RequestCredentialsSameDeviceOptions, RequestCredentialsCrossDeviceDeviceOptions, RequestCredentialsAutoDetectOptions, CredentialQuery, CredentialQueryClaim, RequestCredentialsResponse, RequestCredentialsError, Claim, ClaimData, HandleRedirectCallbackResponse, PresentationSessionResult, PresentationSuccessResult, PresentationFailureResult, PresentationHiddenResult, PresentationErrorType, MobileCredentialPresentationCredential, MobileCredentialError, ValidityInfoRequest, CredentialBranding, CredentialBrandingImage, MobileCredentialVerificationResult, HandleRedirectCallbackError, };
|
|
7
6
|
declare const utils: {
|
|
8
7
|
generateChallenge: () => string;
|
|
9
8
|
unwrap: <T = unknown>(result: import("neverthrow").Result<T, unknown>, errMessage?: string) => T;
|
|
10
9
|
};
|
|
11
|
-
export { initialise, requestCredentials, handleRedirectCallback, utils };
|
|
10
|
+
export { initialise, requestCredentials, handleRedirectCallback, abortCredentialRequest, utils };
|
|
@@ -10,7 +10,7 @@ export declare enum HandleRedirectCallbackErrorType {
|
|
|
10
10
|
export declare enum HandleRedirectCallbackErrorMessage {
|
|
11
11
|
FailedToFindResponseCode = "Failed to find response code",
|
|
12
12
|
FailedToFindChallenge = "Failed to find challenge",
|
|
13
|
-
|
|
13
|
+
FailedToFindActiveSession = "Failed to find active session",
|
|
14
14
|
FailedToGetSessionResult = "Failed to get session result"
|
|
15
15
|
}
|
|
16
16
|
export type HandleRedirectCallbackError = BaseError<HandleRedirectCallbackErrorType>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { initialise } from "./initialise";
|
|
2
2
|
export { requestCredentials } from "./requestCredentials";
|
|
3
3
|
export { handleRedirectCallback } from "./handleRedirectCallback";
|
|
4
|
+
export { abortCredentialRequest } from "./abortCredentialRequest";
|
|
4
5
|
export * as types from "./types";
|
|
5
6
|
export * as utils from "./utils";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreatePresentationSession, StoredPresentationSession } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the currently active presentation session.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getActiveSession: () => StoredPresentationSession | undefined;
|
|
6
|
+
export declare const setActiveSession: (session: CreatePresentationSession) => AbortController;
|
|
7
|
+
export declare const removeActiveSession: () => void;
|
|
@@ -1,48 +1,4 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The error type for the cross device callback
|
|
6
|
-
*/
|
|
7
|
-
export declare enum CrossDeviceCallbackErrorType {
|
|
8
|
-
Timeout = "Timeout",
|
|
9
|
-
Abort = "Abort",
|
|
10
|
-
RequestCredentialsFailed = "RequestCredentialsFailed"
|
|
11
|
-
}
|
|
12
|
-
export declare enum CrossDeviceRequestCredentialsErrorMessage {
|
|
13
|
-
FailedToGetSessionResult = "Failed to get session result",
|
|
14
|
-
FailedToCreateSession = "Failed to create session",
|
|
15
|
-
Abort = "User aborted the session",
|
|
16
|
-
Timeout = "User session timeout"
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Cross device callback error
|
|
20
|
-
*/
|
|
21
|
-
export type CrossDeviceCallbackError = BaseError<CrossDeviceCallbackErrorType | RequestCredentialsErrorType>;
|
|
22
|
-
type ReceiveMessageHandlerOptions = {
|
|
23
|
-
crossDeviceCallback: CrossDeviceCallback;
|
|
24
|
-
sessionId: string;
|
|
25
|
-
container: HTMLDivElement;
|
|
26
|
-
apiBaseUrl: string;
|
|
27
|
-
challenge: string;
|
|
28
|
-
};
|
|
29
|
-
export declare let listener: (event: MessageEvent) => Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* usage from iframe:
|
|
32
|
-
* fetch("/v2/presentations/sessions/sessionId/status").then(function(response) {
|
|
33
|
-
* response.json().then(function(data) {
|
|
34
|
-
* if (data.status === "ResultReady") {
|
|
35
|
-
* const message = { type: "PresentationCompleted", responseCode: "123", sessionId: "sessionId" };
|
|
36
|
-
* const targetOrigin = "*"; // need to match front-end URL or "*"
|
|
37
|
-
* window.postMessage(message, targetOrigin);
|
|
38
|
-
*
|
|
39
|
-
* VII hosted session page in the iframe will notify result via window.postMessage with the following messages:
|
|
40
|
-
* PresentationCompleted = "PresentationCompleted", // { type: "PresentationCompleted", responseCode, sessionId }
|
|
41
|
-
* PresentationTimeout = "PresentationTimeout", // { type: "PresentationTimeout", sessionId }
|
|
42
|
-
* PresentationAbort = "PresentationAbort", // { type: "PresentationAbort", sessionId }
|
|
43
|
-
*
|
|
44
|
-
* @param options -
|
|
45
|
-
*/
|
|
46
|
-
export declare const receiveMessageHandler: (options: ReceiveMessageHandlerOptions) => (event: MessageEvent) => Promise<void>;
|
|
47
|
-
export declare const requestCredentialsCrossDevice: (options: CrossDeviceRequestCredentialsOptions) => Promise<Result<CrossDeviceRequestCredentialsResponse, RequestCredentialsError>>;
|
|
48
|
-
export {};
|
|
2
|
+
import { CrossDeviceRequestCredentialsOptions, MessageEvent, RequestCredentialsError, RequestCredentialsResponse } from "./types";
|
|
3
|
+
export declare let listener: ((event: MessageEvent) => Promise<void>) | undefined;
|
|
4
|
+
export declare const requestCredentialsCrossDevice: (options: CrossDeviceRequestCredentialsOptions) => Promise<Result<RequestCredentialsResponse, RequestCredentialsError>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
|
-
import { RequestCredentialsError,
|
|
2
|
+
import { RequestCredentialsError, SameDeviceRequestCredentialsOptions, RequestCredentialsResponse } from "./types";
|
|
3
3
|
export declare enum SameDeviceRequestCredentialsErrorMessage {
|
|
4
4
|
FailedToStoreChallenge = "Failed to store challenge",
|
|
5
5
|
FailedToCreateSession = "Failed to create session"
|
|
@@ -38,6 +38,15 @@ export type MobileCredentialError = {
|
|
|
38
38
|
export declare enum OpenidPresentationCredentialProfileSupported {
|
|
39
39
|
MOBILE = "mobile"
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* A subset of status code for presentation session
|
|
43
|
+
*/
|
|
44
|
+
export declare enum PresentationStatusCode {
|
|
45
|
+
AwaitingRequestRetrieval = "AwaitingRequestRetrieval",
|
|
46
|
+
AwaitingResponse = "AwaitingResponse",
|
|
47
|
+
ResponseSubmitted = "ResponseSubmitted",
|
|
48
|
+
ResultReady = "ResultReady"
|
|
49
|
+
}
|
|
41
50
|
export type CredentialQueryClaim = {
|
|
42
51
|
/**
|
|
43
52
|
* `intentToRetain` (Optional): When set to `true`, the holder will be indicated that the verifier intends to retain this claim beyond the verification workflow. Defaults to `false` when not specified.
|
|
@@ -259,9 +268,31 @@ export declare const CreateSessionRequestValidator: v.ObjectSchema<{
|
|
|
259
268
|
}, undefined>;
|
|
260
269
|
export type CreateSessionResponse = {
|
|
261
270
|
sessionId: string;
|
|
271
|
+
sessionKey: string;
|
|
262
272
|
sessionUrl: string;
|
|
263
273
|
};
|
|
264
274
|
export declare const CreateSessionResponseValidator: v.ObjectSchema<{
|
|
265
275
|
readonly sessionId: v.StringSchema<undefined>;
|
|
276
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
266
277
|
readonly sessionUrl: v.StringSchema<undefined>;
|
|
267
278
|
}, undefined>;
|
|
279
|
+
export type AbortSessionRequest = v.InferOutput<typeof AbortSessionRequestValidator>;
|
|
280
|
+
export declare const AbortSessionRequestValidator: v.ObjectSchema<{
|
|
281
|
+
readonly sessionId: v.StringSchema<undefined>;
|
|
282
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
283
|
+
}, undefined>;
|
|
284
|
+
export type GetSessionStatusRequest = v.InferOutput<typeof GetSessionStatusRequestValidator>;
|
|
285
|
+
export declare const GetSessionStatusRequestValidator: v.ObjectSchema<{
|
|
286
|
+
readonly sessionId: v.StringSchema<undefined>;
|
|
287
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
288
|
+
}, undefined>;
|
|
289
|
+
export type GetSessionStatusResponse = {
|
|
290
|
+
status: string;
|
|
291
|
+
responseCode?: string;
|
|
292
|
+
};
|
|
293
|
+
export declare const GetSessionStatusResponseValidator: v.UnionSchema<[v.ObjectSchema<{
|
|
294
|
+
readonly status: v.PicklistSchema<[PresentationStatusCode.ResultReady], undefined>;
|
|
295
|
+
readonly responseCode: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
296
|
+
}, undefined>, v.ObjectSchema<{
|
|
297
|
+
readonly status: v.StringSchema<undefined>;
|
|
298
|
+
}, undefined>], undefined>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { BaseError } from "../../common";
|
|
3
|
-
import { CrossDeviceCallbackError } from "../requestCredentialsCrossDevice";
|
|
4
3
|
import { CredentialQuery, PresentationSessionResult } from "./credential-presentation";
|
|
5
4
|
export declare enum LocalStorageKey {
|
|
6
5
|
challenge = "mattr_chg",
|
|
@@ -32,30 +31,8 @@ export type SameDeviceRequestCredentialsOptions = {
|
|
|
32
31
|
walletProviderId?: string;
|
|
33
32
|
initialiseOptions: InitialiseOptions;
|
|
34
33
|
};
|
|
35
|
-
export type CrossDeviceCallbackOnCompleteResponse = {
|
|
36
|
-
/**
|
|
37
|
-
* Contains the result of the presentation session if result is configured to be available in the front channel
|
|
38
|
-
*/
|
|
39
|
-
result: PresentationSessionResult | {
|
|
40
|
-
sessionId: string;
|
|
41
|
-
};
|
|
42
|
-
sessionId: string;
|
|
43
|
-
};
|
|
44
|
-
export type CrossDeviceCallback = {
|
|
45
|
-
/**
|
|
46
|
-
* The function to be executed on completion of the credential request.
|
|
47
|
-
* @param result
|
|
48
|
-
*/
|
|
49
|
-
onComplete: (result: CrossDeviceCallbackOnCompleteResponse) => void;
|
|
50
|
-
/**
|
|
51
|
-
* The function to be executed on failure of the credential request.
|
|
52
|
-
* @param error
|
|
53
|
-
*/
|
|
54
|
-
onFailure: (error: CrossDeviceCallbackError) => void;
|
|
55
|
-
};
|
|
56
34
|
export type CrossDeviceRequestCredentialsOptions = {
|
|
57
35
|
credentialQuery: CredentialQuery[];
|
|
58
|
-
crossDeviceCallback: CrossDeviceCallback;
|
|
59
36
|
challenge: string;
|
|
60
37
|
walletProviderId?: string;
|
|
61
38
|
mode: Mode.crossDevice;
|
|
@@ -118,10 +95,6 @@ export type RequestCredentialsCrossDeviceDeviceOptions = {
|
|
|
118
95
|
* An array of CredentialQuery objects that specify the credentials to be requested.
|
|
119
96
|
*/
|
|
120
97
|
credentialQuery: CredentialQuery[];
|
|
121
|
-
/**
|
|
122
|
-
* The callback functions to be executed on success or failure of the credential request in cross device mode.
|
|
123
|
-
*/
|
|
124
|
-
crossDeviceCallback: CrossDeviceCallback;
|
|
125
98
|
/**
|
|
126
99
|
* An optional challenge string that is used to ensure the security and integrity of the credential request. If not provided, a challenge will be generated by default.
|
|
127
100
|
*/
|
|
@@ -154,10 +127,6 @@ export declare const RequestCredentialsCrossDeviceOptionsValidator: v.ObjectSche
|
|
|
154
127
|
};
|
|
155
128
|
docType: string;
|
|
156
129
|
}[], undefined>]>;
|
|
157
|
-
readonly crossDeviceCallback: v.ObjectSchema<{
|
|
158
|
-
readonly onComplete: v.FunctionSchema<undefined>;
|
|
159
|
-
readonly onFailure: v.FunctionSchema<undefined>;
|
|
160
|
-
}, undefined>;
|
|
161
130
|
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
162
131
|
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
163
132
|
readonly mode: v.PicklistSchema<[Mode.crossDevice], undefined>;
|
|
@@ -170,10 +139,6 @@ export type RequestCredentialsAutoDetectOptions = {
|
|
|
170
139
|
* An array of CredentialQuery objects that specify the credentials to be requested.
|
|
171
140
|
*/
|
|
172
141
|
credentialQuery: CredentialQuery[];
|
|
173
|
-
/**
|
|
174
|
-
* The callback functions to be executed on success or failure of the credential request in cross device mode.
|
|
175
|
-
*/
|
|
176
|
-
crossDeviceCallback: CrossDeviceCallback;
|
|
177
142
|
/**
|
|
178
143
|
* The URI to which the user will be redirected after the credential request is completed.
|
|
179
144
|
*/
|
|
@@ -237,20 +202,10 @@ export declare const RequestCredentialsOptionsValidator: v.UnionSchema<[v.Object
|
|
|
237
202
|
};
|
|
238
203
|
docType: string;
|
|
239
204
|
}[], undefined>]>;
|
|
240
|
-
readonly crossDeviceCallback: v.ObjectSchema<{
|
|
241
|
-
readonly onComplete: v.FunctionSchema<undefined>;
|
|
242
|
-
readonly onFailure: v.FunctionSchema<undefined>;
|
|
243
|
-
}, undefined>;
|
|
244
205
|
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
245
206
|
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
246
207
|
readonly mode: v.PicklistSchema<[Mode.crossDevice], undefined>;
|
|
247
208
|
}, undefined>, v.GenericSchema<RequestCredentialsAutoDetectOptions, RequestCredentialsAutoDetectOptions, v.BaseIssue<unknown>>], undefined>;
|
|
248
|
-
/**
|
|
249
|
-
* The response from the same device requestCredentials function
|
|
250
|
-
*/
|
|
251
|
-
export type SameDeviceRequestCredentialsResponse = {
|
|
252
|
-
sessionId: string;
|
|
253
|
-
};
|
|
254
209
|
export type MessageEvent = {
|
|
255
210
|
data: {
|
|
256
211
|
type: MessageEventDataType;
|
|
@@ -260,25 +215,48 @@ export type MessageEvent = {
|
|
|
260
215
|
origin: string;
|
|
261
216
|
};
|
|
262
217
|
/**
|
|
263
|
-
* The response from the
|
|
218
|
+
* The response from the requestCredentials function
|
|
264
219
|
*/
|
|
265
|
-
export type
|
|
220
|
+
export type RequestCredentialsResponse = {
|
|
221
|
+
/**
|
|
222
|
+
* Contains the result of the presentation session if result is configured to be available in the front channel
|
|
223
|
+
*/
|
|
224
|
+
result?: PresentationSessionResult;
|
|
266
225
|
sessionId: string;
|
|
226
|
+
sessionCompletedInRedirect: boolean;
|
|
267
227
|
};
|
|
268
|
-
/**
|
|
269
|
-
* The response from the requestCredentials function
|
|
270
|
-
*/
|
|
271
|
-
export type RequestCredentialsResponse = SameDeviceRequestCredentialsResponse | CrossDeviceRequestCredentialsResponse;
|
|
272
228
|
/**
|
|
273
229
|
* The error type for the requestCredentials function
|
|
274
230
|
*/
|
|
275
231
|
export declare enum RequestCredentialsErrorType {
|
|
276
|
-
RequestCredentialsFailed = "RequestCredentialsFailed"
|
|
232
|
+
RequestCredentialsFailed = "RequestCredentialsFailed",
|
|
233
|
+
Timeout = "Timeout",
|
|
234
|
+
Abort = "Abort"
|
|
235
|
+
}
|
|
236
|
+
export declare enum RequestCredentialsErrorMessage {
|
|
237
|
+
FailedToGetSessionResult = "Failed to get session result",
|
|
238
|
+
FailedToGetSessionStatus = "Failed to get session status",
|
|
239
|
+
FailedToCreateSession = "Failed to create session",
|
|
240
|
+
Abort = "User aborted the session",
|
|
241
|
+
Timeout = "User session timeout"
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The error type for the `abortCredentialRequest` function
|
|
245
|
+
*/
|
|
246
|
+
export declare enum AbortSessionErrorType {
|
|
247
|
+
AbortSessionFailed = "AbortSessionFailed"
|
|
248
|
+
}
|
|
249
|
+
export declare enum AbortSessionErrorMessage {
|
|
250
|
+
FailedToAbortSession = "Failed to abort session"
|
|
277
251
|
}
|
|
278
252
|
/**
|
|
279
253
|
* The error response from the requestCredentials function
|
|
280
254
|
*/
|
|
281
255
|
export type RequestCredentialsError = BaseError<RequestCredentialsErrorType>;
|
|
256
|
+
/**
|
|
257
|
+
* The error response from the requestCredentials function
|
|
258
|
+
*/
|
|
259
|
+
export type AbortSessionError = BaseError<AbortSessionErrorType>;
|
|
282
260
|
/**
|
|
283
261
|
* The response from the handleRedirectCallback function
|
|
284
262
|
*/
|
|
@@ -286,9 +264,7 @@ export type HandleRedirectCallbackResponse = {
|
|
|
286
264
|
/**
|
|
287
265
|
* Contains the result of the presentation session if result is configured to be available in the front channel
|
|
288
266
|
*/
|
|
289
|
-
result
|
|
290
|
-
sessionId: string;
|
|
291
|
-
};
|
|
267
|
+
result?: PresentationSessionResult;
|
|
292
268
|
sessionId: string;
|
|
293
269
|
};
|
|
294
270
|
/**
|
|
@@ -296,9 +272,23 @@ export type HandleRedirectCallbackResponse = {
|
|
|
296
272
|
*/
|
|
297
273
|
export type InitialiseOptions = {
|
|
298
274
|
apiBaseUrl: string;
|
|
299
|
-
applicationId
|
|
275
|
+
applicationId: string;
|
|
300
276
|
};
|
|
301
277
|
export declare const InitialiseOptionsValidator: v.ObjectSchema<{
|
|
302
|
-
readonly apiBaseUrl: v.StringSchema<undefined>;
|
|
303
|
-
readonly applicationId: v.
|
|
278
|
+
readonly apiBaseUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
|
|
279
|
+
readonly applicationId: v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, "Must not be empty">]>;
|
|
304
280
|
}, undefined>;
|
|
281
|
+
/**
|
|
282
|
+
* Struct for a presentation session
|
|
283
|
+
*/
|
|
284
|
+
export type CreatePresentationSession = {
|
|
285
|
+
readonly sessionId: string;
|
|
286
|
+
readonly sessionKey: string;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Struct for a stored presentation session
|
|
290
|
+
*/
|
|
291
|
+
export type StoredPresentationSession = {
|
|
292
|
+
readonly sessionId: string;
|
|
293
|
+
readonly sessionKey?: string;
|
|
294
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { SafeFetchValidateRespondError } from "../common/safeFetch";
|
|
3
|
-
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, InitialiseOptions } from "./types";
|
|
3
|
+
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, GetSessionStatusRequest, GetSessionStatusResponse, AbortSessionRequest, InitialiseOptions } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Generates a challenge string using the window.crypto API.
|
|
6
6
|
*
|
|
@@ -22,11 +22,27 @@ export declare const getHashParamValue: (hash: string, param: string) => string
|
|
|
22
22
|
* @param challenge - The challenge for the session.
|
|
23
23
|
* @param redirectUri - The redirect URI for the session.
|
|
24
24
|
* @param apiBaseUrl - The base URL of the API.
|
|
25
|
-
* @param applicationId -
|
|
25
|
+
* @param applicationId - The ID of the verifier application.
|
|
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
29
|
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, applicationId, walletProviderId, }: CreateSessionRequest & InitialiseOptions) => Promise<Result<CreateSessionResponse, SafeFetchValidateRespondError>>;
|
|
30
|
+
/**
|
|
31
|
+
* Abort a session with the provided parameters.
|
|
32
|
+
*
|
|
33
|
+
* @param sessionId - The unique identifier for the session.
|
|
34
|
+
* @param sessionKey - The authorization key for performing operations for the session.
|
|
35
|
+
* @returns A promise that resolves to a ok result when succeed or an error.
|
|
36
|
+
*/
|
|
37
|
+
export declare const abortSession: ({ apiBaseUrl, sessionId, sessionKey, }: AbortSessionRequest & InitialiseOptions) => Promise<Result<void, SafeFetchValidateRespondError>>;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieve the status for a session with the provided parameters.
|
|
40
|
+
*
|
|
41
|
+
* @param sessionId - The unique identifier for the session.
|
|
42
|
+
* @param sessionKey - The authorization key for performing operations for the session.
|
|
43
|
+
* @returns A promise that resolves to a result containing either the session status response or an error.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getSessionStatus: ({ apiBaseUrl, sessionId, sessionKey, }: GetSessionStatusRequest & InitialiseOptions) => Promise<Result<GetSessionStatusResponse, SafeFetchValidateRespondError>>;
|
|
30
46
|
/**
|
|
31
47
|
* Exchange the result of a session using the provided parameters.
|
|
32
48
|
*
|