@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.5 → 2.0.1-unstable.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 +609 -353
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +912 -528
- 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 +140 -85
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +155 -272
- package/dist/typings/verifier/utils.d.ts +23 -37
- package/dist/verifier-js.development.js +868 -516
- 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, OpenIdvpConfiguration, 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, OpenIdvpConfiguration, 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,39 +139,9 @@ 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
|
-
export type DcqlCredentialQuery = {
|
|
99
|
-
credentials: {
|
|
100
|
-
id: string;
|
|
101
|
-
format: string;
|
|
102
|
-
meta?: unknown;
|
|
103
|
-
claims: {
|
|
104
|
-
path: string[];
|
|
105
|
-
}[];
|
|
106
|
-
}[];
|
|
107
|
-
credential_sets?: {
|
|
108
|
-
options: string[][];
|
|
109
|
-
required?: boolean;
|
|
110
|
-
purpose?: unknown;
|
|
111
|
-
}[];
|
|
112
|
-
};
|
|
113
|
-
export declare const DcqlCredentialQueryValidator: v.ObjectSchema<{
|
|
114
|
-
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
115
|
-
readonly id: v.StringSchema<undefined>;
|
|
116
|
-
readonly format: v.StringSchema<undefined>;
|
|
117
|
-
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
118
|
-
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
119
|
-
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
120
|
-
}, undefined>, undefined>;
|
|
121
|
-
}, undefined>, undefined>;
|
|
122
|
-
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
123
|
-
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
124
|
-
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
125
|
-
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
126
|
-
}, undefined>, undefined>, never>;
|
|
127
|
-
}, undefined>;
|
|
128
145
|
/**
|
|
129
146
|
* List of error types for presentation failure result
|
|
130
147
|
*/
|
|
@@ -212,9 +229,9 @@ export type Claim = {
|
|
|
212
229
|
readonly value: Array<ClaimData>;
|
|
213
230
|
};
|
|
214
231
|
export type MobileCredentialPresentationCredential = {
|
|
215
|
-
docType
|
|
216
|
-
validityInfo
|
|
217
|
-
issuerInfo
|
|
232
|
+
docType?: string;
|
|
233
|
+
validityInfo?: ValidityInfoRequest;
|
|
234
|
+
issuerInfo?: {
|
|
218
235
|
commonName: string;
|
|
219
236
|
trustedIssuerId: string;
|
|
220
237
|
};
|
|
@@ -229,7 +246,7 @@ export type MobileCredentialPresentationCredential = {
|
|
|
229
246
|
export type PresentationSuccessResult = {
|
|
230
247
|
sessionId: string;
|
|
231
248
|
challenge: string;
|
|
232
|
-
credentialQuery: CredentialQuery[]
|
|
249
|
+
credentialQuery: CredentialQuery[];
|
|
233
250
|
credentials?: MobileCredentialPresentationCredential[];
|
|
234
251
|
credentialErrors?: MobileCredentialError[];
|
|
235
252
|
};
|
|
@@ -243,24 +260,24 @@ export type PresentationResultRelax = {
|
|
|
243
260
|
};
|
|
244
261
|
export declare const PresentationResultRelaxValidator: v.ObjectSchema<{
|
|
245
262
|
readonly sessionId: v.StringSchema<undefined>;
|
|
246
|
-
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>,
|
|
247
|
-
/*** we not
|
|
248
|
-
readonly credentialQuery: v.OptionalSchema<v.UnknownSchema,
|
|
249
|
-
readonly credentials: v.OptionalSchema<v.UnknownSchema,
|
|
250
|
-
readonly credentialErrors: v.OptionalSchema<v.UnknownSchema,
|
|
251
|
-
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>;
|
|
252
269
|
}, undefined>;
|
|
253
270
|
export type PresentationFailureResult = {
|
|
254
271
|
sessionId: string;
|
|
255
272
|
challenge: string;
|
|
256
|
-
credentialQuery: CredentialQuery[]
|
|
273
|
+
credentialQuery: CredentialQuery[];
|
|
257
274
|
error: {
|
|
258
275
|
type: PresentationErrorType;
|
|
259
276
|
message: string;
|
|
260
277
|
};
|
|
261
278
|
};
|
|
262
279
|
/**
|
|
263
|
-
* 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
|
|
264
281
|
*/
|
|
265
282
|
export type PresentationHiddenResult = {
|
|
266
283
|
sessionId: string;
|
|
@@ -273,48 +290,86 @@ export type ExchangeSessionResultRequest = {
|
|
|
273
290
|
readonly challenge: string;
|
|
274
291
|
readonly responseCode: string;
|
|
275
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
|
+
}
|
|
276
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
|
+
};
|
|
277
328
|
export type CreateSessionRequest = v.InferOutput<typeof CreateSessionRequestValidator>;
|
|
278
329
|
export declare const CreateSessionRequestValidator: v.ObjectSchema<{
|
|
279
|
-
readonly credentialQuery: v.
|
|
330
|
+
readonly credentialQuery: v.ArraySchema<v.ObjectSchema<{
|
|
280
331
|
readonly profile: v.PicklistSchema<[OpenidPresentationCredentialProfileSupported], undefined>;
|
|
281
332
|
readonly docType: v.StringSchema<undefined>;
|
|
282
333
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
283
|
-
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>,
|
|
334
|
+
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
284
335
|
}, undefined>, undefined>, undefined>;
|
|
285
|
-
}, undefined>, undefined
|
|
286
|
-
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
287
|
-
readonly id: v.StringSchema<undefined>;
|
|
288
|
-
readonly format: v.StringSchema<undefined>;
|
|
289
|
-
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
290
|
-
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
291
|
-
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
292
|
-
}, undefined>, undefined>;
|
|
293
|
-
}, undefined>, undefined>;
|
|
294
|
-
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
295
|
-
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
296
|
-
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
297
|
-
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
298
|
-
}, undefined>, undefined>, never>;
|
|
299
|
-
}, undefined>], undefined>;
|
|
336
|
+
}, undefined>, undefined>;
|
|
300
337
|
readonly challenge: v.StringSchema<undefined>;
|
|
301
|
-
readonly redirectUri: v.OptionalSchema<v.StringSchema<undefined>,
|
|
302
|
-
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>;
|
|
303
341
|
}, undefined>;
|
|
304
|
-
export type CreateSessionResponse =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
};
|
|
308
|
-
export declare const CreateSessionResponseValidator: v.ObjectSchema<{
|
|
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>;
|
|
309
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>;
|
|
351
|
+
readonly sessionId: v.StringSchema<undefined>;
|
|
352
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
310
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>;
|
|
311
360
|
}, undefined>;
|
|
312
|
-
|
|
313
|
-
export
|
|
314
|
-
sessionId: string;
|
|
315
|
-
request: any;
|
|
316
|
-
};
|
|
317
|
-
export declare const CreateDigitalCredentialsApiSessionResponseValidator: v.ObjectSchema<{
|
|
361
|
+
export type GetSessionStatusRequest = v.InferOutput<typeof GetSessionStatusRequestValidator>;
|
|
362
|
+
export declare const GetSessionStatusRequestValidator: v.ObjectSchema<{
|
|
318
363
|
readonly sessionId: v.StringSchema<undefined>;
|
|
319
|
-
readonly
|
|
364
|
+
readonly sessionKey: v.StringSchema<undefined>;
|
|
320
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>;
|