@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.4 → 2.0.0
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 +71 -86
- package/dist/lib/verifier-js-no-deps.cjs.js +608 -336
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +911 -511
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/common/safeFetch.d.ts +6 -3
- package/dist/typings/common/sleep.d.ts +1 -0
- package/dist/typings/index.d.ts +6 -7
- 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 +3 -1
- package/dist/typings/verifier/initialize.d.ts +12 -0
- package/dist/typings/verifier/instanceContext.d.ts +7 -0
- package/dist/typings/verifier/requestCredentials.d.ts +2 -2
- package/dist/typings/verifier/requestCredentialsCrossDevice.d.ts +3 -47
- package/dist/typings/verifier/requestCredentialsDigitalCredentialsApi.d.ts +17 -0
- package/dist/typings/verifier/requestCredentialsSameDevice.d.ts +1 -1
- package/dist/typings/verifier/types/credential-presentation.d.ts +136 -37
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +153 -214
- package/dist/typings/verifier/utils.d.ts +23 -37
- package/dist/verifier-js.development.js +866 -499
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +4 -4
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +4 -4
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +3 -3
- package/dist/typings/verifier/initialise.d.ts +0 -12
- package/dist/typings/verifier/requestCredentialsViaDigitalCredentialsApi.d.ts +0 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { BaseError } from "./error";
|
|
3
|
-
export declare enum
|
|
3
|
+
export declare enum SafeFetchCommonResponseErrorType {
|
|
4
4
|
/**
|
|
5
5
|
* Unexpected response from the remote server
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
UnexpectedResponse = "UnexpectedResponse"
|
|
8
8
|
}
|
|
9
9
|
export declare enum SafeFetchErrorType {
|
|
10
10
|
/**
|
|
@@ -16,11 +16,14 @@ export declare enum SafeFetchErrorType {
|
|
|
16
16
|
*/
|
|
17
17
|
UnknownError = "UnknownError"
|
|
18
18
|
}
|
|
19
|
-
export type
|
|
19
|
+
export type SafeFetchValidateResponseError = BaseError<SafeFetchErrorType | SafeFetchCommonResponseErrorType.UnexpectedResponse> & {
|
|
20
|
+
status?: number;
|
|
21
|
+
};
|
|
20
22
|
export type SafeFetchError = BaseError<SafeFetchErrorType> & {
|
|
21
23
|
status?: number;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* Safe fetch function that wraps the fetch function and returns a Result type
|
|
27
|
+
* injects the package version number into the x-mattr-sdk-version header to help support backwards compatibility
|
|
25
28
|
*/
|
|
26
29
|
export declare const safeFetch: (input: RequestInfo, init?: RequestInit) => Promise<Result<Response, SafeFetchError>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { initialize, requestCredentials, handleRedirectCallback, abortCredentialRequest, isDigitalCredentialsApiSupported } 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 { 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
|
+
export { Mode, OpenidPresentationCredentialProfileSupported, MobileCredentialVerificationReasonType, RequestCredentialsErrorType, AbortSessionErrorType, HandleRedirectCallbackErrorType, CredentialBrandingImageFormat, ClaimType, MobileCredentialResponseErrorCode, };
|
|
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, };
|
|
7
6
|
declare const utils: {
|
|
8
7
|
generateChallenge: () => string;
|
|
8
|
+
getVersion: () => string;
|
|
9
9
|
unwrap: <T = unknown>(result: import("neverthrow").Result<T, unknown>, errMessage?: string) => T;
|
|
10
|
-
isDigitalCredentialsApiSupported: () => boolean;
|
|
11
10
|
};
|
|
12
|
-
export {
|
|
11
|
+
export { initialize, requestCredentials, handleRedirectCallback, abortCredentialRequest, isDigitalCredentialsApiSupported, 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,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { initialize } from "./initialize";
|
|
2
2
|
export { requestCredentials } from "./requestCredentials";
|
|
3
3
|
export { handleRedirectCallback } from "./handleRedirectCallback";
|
|
4
|
+
export { abortCredentialRequest } from "./abortCredentialRequest";
|
|
5
|
+
export { isDigitalCredentialsApiSupported } from "./requestCredentialsDigitalCredentialsApi";
|
|
4
6
|
export * as types from "./types";
|
|
5
7
|
export * as utils from "./utils";
|
|
@@ -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 {@link InitializeOptions | 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;
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@ import { RequestCredentialsError, RequestCredentialsOptions, RequestCredentialsR
|
|
|
3
3
|
/**
|
|
4
4
|
* Requests credentials based on the provided options.
|
|
5
5
|
*
|
|
6
|
-
* @param options - The options to request credentials with.
|
|
7
|
-
* @returns A promise that resolves to a result containing either the requested credentials or an error.
|
|
6
|
+
* @param options - The options to request credentials with {@link RequestCredentialsOptions}.
|
|
7
|
+
* @returns A promise that resolves to a result containing either the {@link RequestCredentialsResponse | requested credentials} or an {@link RequestCredentialsError | error}.
|
|
8
8
|
*/
|
|
9
9
|
export declare const requestCredentials: (options: RequestCredentialsOptions) => Promise<Result<RequestCredentialsResponse, RequestCredentialsError>>;
|
|
@@ -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 requestCredentialsWithCrossDevice: (options: CrossDeviceRequestCredentialsOptions) => Promise<Result<RequestCredentialsResponse, RequestCredentialsError>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Result } from "neverthrow";
|
|
2
|
+
import { BaseError } from "../common";
|
|
3
|
+
import { RequestCredentialsErrorType, RequestCredentialsResponse, RequestCredentialsWithDcApiOptions } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Request credentials for the Digital Credentials API
|
|
6
|
+
*
|
|
7
|
+
* @param options - {@link RequestCredentialsWithDcApiOptions}
|
|
8
|
+
* @ignore - Dark release
|
|
9
|
+
*/
|
|
10
|
+
export declare const requestCredentialsWithDigitalCredentialsApi: (options: RequestCredentialsWithDcApiOptions) => Promise<Result<RequestCredentialsResponse, BaseError<RequestCredentialsErrorType.RequestCredentialsFailed>>>;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if Digital Credentials API feature is supported for the current browser.
|
|
13
|
+
* @ignore - Dark release
|
|
14
|
+
*
|
|
15
|
+
* @returns boolean.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isDigitalCredentialsApiSupported: () => boolean;
|
|
@@ -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"
|
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
export declare enum MobileCredentialVerificationReasonType {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Trusted issuer certificate expired.
|
|
5
|
+
*/
|
|
6
|
+
TrustedIssuerCertificateExpired = "TrustedIssuerCertificateExpired",
|
|
7
|
+
/**
|
|
8
|
+
* Trusted issuer certificate not yet valid.
|
|
9
|
+
*/
|
|
10
|
+
TrustedIssuerCertificateNotYetValid = "TrustedIssuerCertificateNotYetValid",
|
|
11
|
+
/**
|
|
12
|
+
* Credential was issued by a certificate other than the ones on the trusted issuer list.
|
|
13
|
+
*/
|
|
14
|
+
IssuerNotTrusted = "IssuerNotTrusted",
|
|
15
|
+
/**
|
|
16
|
+
* Mobile credential is not valid.
|
|
17
|
+
*/
|
|
18
|
+
MobileCredentialInvalid = "MobileCredentialInvalid",
|
|
19
|
+
/**
|
|
20
|
+
* Mobile credential expired.
|
|
21
|
+
*/
|
|
22
|
+
MobileCredentialExpired = "MobileCredentialExpired",
|
|
23
|
+
/**
|
|
24
|
+
* Mobile credential not yet valid.
|
|
25
|
+
*/
|
|
26
|
+
MobileCredentialNotYetValid = "MobileCredentialNotYetValid",
|
|
27
|
+
/**
|
|
28
|
+
* Invalid signer certificate.
|
|
29
|
+
*/
|
|
30
|
+
InvalidSignerCertificate = "InvalidSignerCertificate",
|
|
31
|
+
/**
|
|
32
|
+
* Device key is not valid.
|
|
33
|
+
*/
|
|
34
|
+
DeviceKeyInvalid = "DeviceKeyInvalid",
|
|
35
|
+
/**
|
|
36
|
+
* Mobile credential object contains unsupported curve.
|
|
37
|
+
*/
|
|
38
|
+
UnsupportedCurve = "UnsupportedCurve",
|
|
39
|
+
/**
|
|
40
|
+
* Mobile credential has been revoked.
|
|
41
|
+
*/
|
|
42
|
+
StatusRevoked = "StatusRevoked",
|
|
43
|
+
/**
|
|
44
|
+
* Mobile credential has been suspended.
|
|
45
|
+
*/
|
|
46
|
+
StatusSuspended = "StatusSuspended",
|
|
47
|
+
/**
|
|
48
|
+
* Mobile credential status is unknown and could not be determined.
|
|
49
|
+
*/
|
|
50
|
+
StatusUnknown = "StatusUnknown"
|
|
13
51
|
}
|
|
14
52
|
export declare enum ClaimType {
|
|
15
53
|
Boolean = "boolean",
|
|
@@ -38,6 +76,15 @@ export type MobileCredentialError = {
|
|
|
38
76
|
export declare enum OpenidPresentationCredentialProfileSupported {
|
|
39
77
|
MOBILE = "mobile"
|
|
40
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* A subset of status code for presentation session
|
|
81
|
+
*/
|
|
82
|
+
export declare enum PresentationStatusCode {
|
|
83
|
+
AwaitingRequestRetrieval = "AwaitingRequestRetrieval",
|
|
84
|
+
AwaitingResponse = "AwaitingResponse",
|
|
85
|
+
ResponseSubmitted = "ResponseSubmitted",
|
|
86
|
+
ResultReady = "ResultReady"
|
|
87
|
+
}
|
|
41
88
|
export type CredentialQueryClaim = {
|
|
42
89
|
/**
|
|
43
90
|
* `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.
|
|
@@ -73,7 +120,7 @@ export type CredentialQuery = {
|
|
|
73
120
|
profile: OpenidPresentationCredentialProfileSupported;
|
|
74
121
|
/**
|
|
75
122
|
* the mDL’s type. Confirm with the certificate issuer for what docType they are issuing. Some common examples include:
|
|
76
|
-
* * Mobile Driver
|
|
123
|
+
* * Mobile Driver License (`org.iso.18013.5.1.mDL`).
|
|
77
124
|
* * PhotoID (`org.iso.23220.photoid.1`).
|
|
78
125
|
* * Mobile Vehicle Registration Card (`org.iso.7367.1.mVRC`).
|
|
79
126
|
* * Health certificate (`org.micov.vtr.1`).
|
|
@@ -92,7 +139,7 @@ export declare const CredentialQueryValidator: v.ObjectSchema<{
|
|
|
92
139
|
readonly profile: v.PicklistSchema<[OpenidPresentationCredentialProfileSupported], undefined>;
|
|
93
140
|
readonly docType: v.StringSchema<undefined>;
|
|
94
141
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
95
|
-
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>,
|
|
142
|
+
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
96
143
|
}, undefined>, undefined>, undefined>;
|
|
97
144
|
}, undefined>;
|
|
98
145
|
/**
|
|
@@ -182,9 +229,9 @@ export type Claim = {
|
|
|
182
229
|
readonly value: Array<ClaimData>;
|
|
183
230
|
};
|
|
184
231
|
export type MobileCredentialPresentationCredential = {
|
|
185
|
-
docType
|
|
186
|
-
validityInfo
|
|
187
|
-
issuerInfo
|
|
232
|
+
docType?: string;
|
|
233
|
+
validityInfo?: ValidityInfoRequest;
|
|
234
|
+
issuerInfo?: {
|
|
188
235
|
commonName: string;
|
|
189
236
|
trustedIssuerId: string;
|
|
190
237
|
};
|
|
@@ -213,12 +260,12 @@ export type PresentationResultRelax = {
|
|
|
213
260
|
};
|
|
214
261
|
export declare const PresentationResultRelaxValidator: v.ObjectSchema<{
|
|
215
262
|
readonly sessionId: v.StringSchema<undefined>;
|
|
216
|
-
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>,
|
|
217
|
-
/*** we not
|
|
218
|
-
readonly credentialQuery: v.OptionalSchema<v.UnknownSchema,
|
|
219
|
-
readonly credentials: v.OptionalSchema<v.UnknownSchema,
|
|
220
|
-
readonly credentialErrors: v.OptionalSchema<v.UnknownSchema,
|
|
221
|
-
readonly error: v.OptionalSchema<v.UnknownSchema,
|
|
263
|
+
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
264
|
+
/*** we do not validate these types at runtime ***/
|
|
265
|
+
readonly credentialQuery: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
266
|
+
readonly credentials: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
267
|
+
readonly credentialErrors: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
268
|
+
readonly error: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
222
269
|
}, undefined>;
|
|
223
270
|
export type PresentationFailureResult = {
|
|
224
271
|
sessionId: string;
|
|
@@ -230,7 +277,7 @@ export type PresentationFailureResult = {
|
|
|
230
277
|
};
|
|
231
278
|
};
|
|
232
279
|
/**
|
|
233
|
-
* The result of a hidden credential presentation request,
|
|
280
|
+
* The result of a hidden credential presentation request, retured when `resultAvailableInFrontChannel` is set to false in verifier's configuration
|
|
234
281
|
*/
|
|
235
282
|
export type PresentationHiddenResult = {
|
|
236
283
|
sessionId: string;
|
|
@@ -243,34 +290,86 @@ export type ExchangeSessionResultRequest = {
|
|
|
243
290
|
readonly challenge: string;
|
|
244
291
|
readonly responseCode: string;
|
|
245
292
|
};
|
|
293
|
+
/**
|
|
294
|
+
* The mode in which the credentials are requested
|
|
295
|
+
*/
|
|
296
|
+
export declare enum Mode {
|
|
297
|
+
/**
|
|
298
|
+
* The credentials are requested on the same device
|
|
299
|
+
*/
|
|
300
|
+
SameDevice = "sameDevice",
|
|
301
|
+
/**
|
|
302
|
+
* The credentials are requested on a different device
|
|
303
|
+
*/
|
|
304
|
+
CrossDevice = "crossDevice"
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The type of presentation flow type to proceed with, defined by MATTR VII
|
|
308
|
+
*/
|
|
309
|
+
export declare enum SessionType {
|
|
310
|
+
/**
|
|
311
|
+
* SDK should proceed with presentation flow via Digital Credentials API
|
|
312
|
+
*/
|
|
313
|
+
DigitalCredentialsApi = "digital-credentials-api",
|
|
314
|
+
/**
|
|
315
|
+
* SDK should proceed with presentation flow via openId4vci
|
|
316
|
+
*/
|
|
317
|
+
Openid4vp = "openid4vp"
|
|
318
|
+
}
|
|
246
319
|
export type ExchangeSessionResultResponse = PresentationSessionResult | PresentationHiddenResult;
|
|
320
|
+
export type RequestCredentialsWithDcApiOptions = {
|
|
321
|
+
apiBaseUrl: string;
|
|
322
|
+
sessionId: string;
|
|
323
|
+
sessionKey: string;
|
|
324
|
+
sessionTtl: number;
|
|
325
|
+
challenge: string;
|
|
326
|
+
request: Record<string, unknown>;
|
|
327
|
+
};
|
|
247
328
|
export type CreateSessionRequest = v.InferOutput<typeof CreateSessionRequestValidator>;
|
|
248
329
|
export declare const CreateSessionRequestValidator: v.ObjectSchema<{
|
|
249
330
|
readonly credentialQuery: v.ArraySchema<v.ObjectSchema<{
|
|
250
331
|
readonly profile: v.PicklistSchema<[OpenidPresentationCredentialProfileSupported], undefined>;
|
|
251
332
|
readonly docType: v.StringSchema<undefined>;
|
|
252
333
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
253
|
-
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>,
|
|
334
|
+
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
254
335
|
}, undefined>, undefined>, undefined>;
|
|
255
336
|
}, undefined>, undefined>;
|
|
256
337
|
readonly challenge: v.StringSchema<undefined>;
|
|
257
|
-
readonly redirectUri: v.OptionalSchema<v.StringSchema<undefined>,
|
|
258
|
-
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>,
|
|
338
|
+
readonly redirectUri: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
339
|
+
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
340
|
+
readonly dcApiSupported: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
259
341
|
}, undefined>;
|
|
260
|
-
export type CreateSessionResponse =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
342
|
+
export type CreateSessionResponse = v.InferOutput<typeof CreateSessionResponseValidator>;
|
|
343
|
+
export declare const CreateSessionResponseValidator: v.UnionSchema<[v.ObjectSchema<{
|
|
344
|
+
readonly type: v.LiteralSchema<SessionType.DigitalCredentialsApi, undefined>;
|
|
345
|
+
readonly sessionId: v.StringSchema<undefined>;
|
|
346
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
347
|
+
readonly sessionTtl: v.NumberSchema<undefined>;
|
|
348
|
+
readonly request: v.RecordSchema<v.StringSchema<undefined>, v.AnySchema, undefined>;
|
|
349
|
+
}, undefined>, v.ObjectSchema<{
|
|
350
|
+
readonly type: v.OptionalSchema<v.LiteralSchema<SessionType.Openid4vp, undefined>, undefined>;
|
|
265
351
|
readonly sessionId: v.StringSchema<undefined>;
|
|
352
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
266
353
|
readonly sessionUrl: v.StringSchema<undefined>;
|
|
354
|
+
}, undefined>], undefined>;
|
|
355
|
+
export type AbortSessionRequest = v.InferOutput<typeof AbortSessionRequestValidator>;
|
|
356
|
+
export declare const AbortSessionRequestValidator: v.ObjectSchema<{
|
|
357
|
+
readonly sessionId: v.StringSchema<undefined>;
|
|
358
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
359
|
+
readonly apiBaseUrl: v.StringSchema<undefined>;
|
|
267
360
|
}, undefined>;
|
|
268
|
-
|
|
269
|
-
export
|
|
270
|
-
sessionId: string;
|
|
271
|
-
request: any;
|
|
272
|
-
};
|
|
273
|
-
export declare const CreateDigitalCredentialsApiSessionResponseValidator: v.ObjectSchema<{
|
|
361
|
+
export type GetSessionStatusRequest = v.InferOutput<typeof GetSessionStatusRequestValidator>;
|
|
362
|
+
export declare const GetSessionStatusRequestValidator: v.ObjectSchema<{
|
|
274
363
|
readonly sessionId: v.StringSchema<undefined>;
|
|
275
|
-
readonly
|
|
364
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
276
365
|
}, undefined>;
|
|
366
|
+
export type GetSessionStatusResponse = {
|
|
367
|
+
status: string;
|
|
368
|
+
responseCode?: string;
|
|
369
|
+
};
|
|
370
|
+
export declare const GetSessionStatusResponseValidator: v.UnionSchema<[v.ObjectSchema<{
|
|
371
|
+
readonly status: v.PicklistSchema<[PresentationStatusCode.ResultReady], undefined>;
|
|
372
|
+
readonly responseCode: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
373
|
+
}, undefined>, v.ObjectSchema<{
|
|
374
|
+
readonly status: v.StringSchema<undefined>;
|
|
375
|
+
}, undefined>], undefined>;
|