@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.3 → 2.0.0-preview-digital-credential-api.5
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 +43 -35
- package/dist/lib/verifier-js-no-deps.cjs.js +43 -16
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +141 -125
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/credential-presentation.d.ts +94 -39
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +73 -15
- package/dist/typings/verifier/utils.d.ts +6 -6
- package/dist/verifier-js.development.js +131 -116
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +3 -3
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +3 -3
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
/*** mobile-credential-framework https://github.com/mattrinternal/opencore/tree/master/packages/mobile-credential-framework/src/types ***/
|
|
3
2
|
export declare enum MobileCredentialVerificationReasonType {
|
|
3
|
+
/** Credential has expired */
|
|
4
4
|
Expired = "expired",
|
|
5
|
-
|
|
5
|
+
/** Credential is not yet active */
|
|
6
|
+
Inactive = "inactive",
|
|
7
|
+
/** Credential has been revoked permanently and a new credential must be issued */
|
|
8
|
+
StatusRevoked = "invalid",
|
|
9
|
+
/** Credential has been suspended and must be re-activated before use */
|
|
10
|
+
StatusSuspended = "suspended",
|
|
11
|
+
/** The Credentials status could not be resolved or verified */
|
|
12
|
+
StatusUnknown = "unknown"
|
|
6
13
|
}
|
|
7
14
|
export declare enum ClaimType {
|
|
8
15
|
Boolean = "boolean",
|
|
@@ -28,43 +35,53 @@ export type MobileCredentialError = {
|
|
|
28
35
|
readonly docType: string;
|
|
29
36
|
readonly errorCode: MobileCredentialResponseErrorCode;
|
|
30
37
|
};
|
|
31
|
-
/*** mobile-credential-framework end ***/
|
|
32
|
-
/*** credential-presentation https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation ***/
|
|
33
38
|
export declare enum OpenidPresentationCredentialProfileSupported {
|
|
34
39
|
MOBILE = "mobile"
|
|
35
40
|
}
|
|
36
41
|
export type CredentialQueryClaim = {
|
|
42
|
+
/**
|
|
43
|
+
* `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.
|
|
44
|
+
*/
|
|
37
45
|
intentToRetain?: boolean;
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
40
48
|
* Credential query
|
|
41
49
|
* @example
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* "
|
|
45
|
-
* "
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* // The following example credential query will request the `birthdate` and `portrait` claims from a `mobile` credential `profile` with `org.iso.18013.5.1.mDL` as a `docType`:
|
|
51
|
+
* {
|
|
52
|
+
* "profile": "mobile",
|
|
53
|
+
* "docType": "org.iso.18013.5.1.mDL",
|
|
54
|
+
* "nameSpaces": {
|
|
55
|
+
* "org.iso.18013.5.1": {
|
|
56
|
+
* "birthdate": {
|
|
57
|
+
"intentToRetain": false
|
|
58
|
+
* },
|
|
59
|
+
* "portrait": {
|
|
60
|
+
* "intentToRetain": false
|
|
52
61
|
* },
|
|
53
|
-
* "resident_postal_code":{
|
|
54
|
-
* "intentToRetain":
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* "intentToRetain":true
|
|
60
|
-
* }
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
* }
|
|
62
|
+
* "resident_postal_code": {
|
|
63
|
+
* "intentToRetain": false
|
|
64
|
+
* }
|
|
65
|
+
* },
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
64
68
|
*/
|
|
65
69
|
export type CredentialQuery = {
|
|
70
|
+
/**
|
|
71
|
+
* Credential format of the credential that will be verified. Currently only mobile (mDocs) is supported.
|
|
72
|
+
*/
|
|
66
73
|
profile: OpenidPresentationCredentialProfileSupported;
|
|
74
|
+
/**
|
|
75
|
+
* the mDL’s type. Confirm with the certificate issuer for what docType they are issuing. Some common examples include:
|
|
76
|
+
* * Mobile Driver Licence (`org.iso.18013.5.1.mDL`).
|
|
77
|
+
* * PhotoID (`org.iso.23220.photoid.1`).
|
|
78
|
+
* * Mobile Vehicle Registration Card (`org.iso.7367.1.mVRC`).
|
|
79
|
+
* * Health certificate (`org.micov.vtr.1`).
|
|
80
|
+
*/
|
|
67
81
|
docType: string;
|
|
82
|
+
/**
|
|
83
|
+
* Each namespace corresponds to a group of claims included in the credential. These can be claims that are part of a specific standard, jurisdiction or any other reference. The namespace would usually correspond to the requested `docType`.
|
|
84
|
+
*/
|
|
68
85
|
nameSpaces: {
|
|
69
86
|
[nameSpace: string]: {
|
|
70
87
|
[claim: string]: CredentialQueryClaim;
|
|
@@ -78,6 +95,36 @@ export declare const CredentialQueryValidator: v.ObjectSchema<{
|
|
|
78
95
|
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
79
96
|
}, undefined>, undefined>, undefined>;
|
|
80
97
|
}, 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>;
|
|
81
128
|
/**
|
|
82
129
|
* List of error types for presentation failure result
|
|
83
130
|
*/
|
|
@@ -104,8 +151,6 @@ export declare enum PresentationErrorType {
|
|
|
104
151
|
*/
|
|
105
152
|
Unknown = "Unknown"
|
|
106
153
|
}
|
|
107
|
-
/*** credential-presentation end ***/
|
|
108
|
-
/*** mobile-credential https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/mobile-credential ***/
|
|
109
154
|
export type ValidityInfoRequest = {
|
|
110
155
|
signed: string;
|
|
111
156
|
validFrom: string;
|
|
@@ -169,24 +214,22 @@ export type Claim = {
|
|
|
169
214
|
export type MobileCredentialPresentationCredential = {
|
|
170
215
|
docType: string;
|
|
171
216
|
validityInfo: ValidityInfoRequest;
|
|
172
|
-
branding?: CredentialBranding;
|
|
173
|
-
claims?: Record<string, Record<string, Claim>>;
|
|
174
|
-
claimErrors?: Record<string, Record<string, MobileCredentialResponseErrorCode>>;
|
|
175
|
-
verificationResult: MobileCredentialVerificationResult;
|
|
176
217
|
issuerInfo: {
|
|
177
218
|
commonName: string;
|
|
178
219
|
trustedIssuerId: string;
|
|
179
220
|
};
|
|
221
|
+
verificationResult: MobileCredentialVerificationResult;
|
|
222
|
+
branding?: CredentialBranding;
|
|
223
|
+
claims?: Record<string, Record<string, Claim>>;
|
|
224
|
+
claimErrors?: Record<string, Record<string, MobileCredentialResponseErrorCode>>;
|
|
180
225
|
};
|
|
181
|
-
/*** mobile-credential end ***/
|
|
182
|
-
/*** session result https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation/sessionResult.ts ***/
|
|
183
226
|
/**
|
|
184
227
|
* The result of a credential presentation request, default response or set `resultAvailableInFrontChannel: true` as verifier's configuration
|
|
185
228
|
*/
|
|
186
229
|
export type PresentationSuccessResult = {
|
|
187
230
|
sessionId: string;
|
|
188
231
|
challenge: string;
|
|
189
|
-
credentialQuery: CredentialQuery[];
|
|
232
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
190
233
|
credentials?: MobileCredentialPresentationCredential[];
|
|
191
234
|
credentialErrors?: MobileCredentialError[];
|
|
192
235
|
};
|
|
@@ -210,7 +253,7 @@ export declare const PresentationResultRelaxValidator: v.ObjectSchema<{
|
|
|
210
253
|
export type PresentationFailureResult = {
|
|
211
254
|
sessionId: string;
|
|
212
255
|
challenge: string;
|
|
213
|
-
credentialQuery: CredentialQuery[];
|
|
256
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
214
257
|
error: {
|
|
215
258
|
type: PresentationErrorType;
|
|
216
259
|
message: string;
|
|
@@ -231,17 +274,29 @@ export type ExchangeSessionResultRequest = {
|
|
|
231
274
|
readonly responseCode: string;
|
|
232
275
|
};
|
|
233
276
|
export type ExchangeSessionResultResponse = PresentationSessionResult | PresentationHiddenResult;
|
|
234
|
-
/*** session result end ***/
|
|
235
|
-
/*** session https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation/session.ts ***/
|
|
236
277
|
export type CreateSessionRequest = v.InferOutput<typeof CreateSessionRequestValidator>;
|
|
237
278
|
export declare const CreateSessionRequestValidator: v.ObjectSchema<{
|
|
238
|
-
readonly credentialQuery: v.ArraySchema<v.ObjectSchema<{
|
|
279
|
+
readonly credentialQuery: v.UnionSchema<[v.ArraySchema<v.ObjectSchema<{
|
|
239
280
|
readonly profile: v.PicklistSchema<[OpenidPresentationCredentialProfileSupported], undefined>;
|
|
240
281
|
readonly docType: v.StringSchema<undefined>;
|
|
241
282
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
242
283
|
readonly intentToRetain: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
243
284
|
}, undefined>, undefined>, undefined>;
|
|
244
|
-
}, undefined>, undefined
|
|
285
|
+
}, undefined>, undefined>, v.ObjectSchema<{
|
|
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>;
|
|
245
300
|
readonly challenge: v.StringSchema<undefined>;
|
|
246
301
|
readonly redirectUri: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
247
302
|
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { BaseError } from "../../common";
|
|
3
3
|
import { CrossDeviceCallbackError } from "../requestCredentialsCrossDevice";
|
|
4
|
-
import { CredentialQuery, PresentationSessionResult } from "./credential-presentation";
|
|
4
|
+
import { CredentialQuery, DcqlCredentialQuery, PresentationSessionResult } from "./credential-presentation";
|
|
5
5
|
export declare enum LocalStorageKey {
|
|
6
6
|
challenge = "mattr_chg",
|
|
7
7
|
sessionId = "mattr_sid"
|
|
@@ -25,7 +25,7 @@ export declare enum MessageEventDataType {
|
|
|
25
25
|
PresentationAbort = "PresentationAbort"
|
|
26
26
|
}
|
|
27
27
|
export type SameDeviceRequestCredentialsOptions = {
|
|
28
|
-
credentialQuery: CredentialQuery[];
|
|
28
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
29
29
|
redirectUri: string;
|
|
30
30
|
challenge: string;
|
|
31
31
|
mode: Mode.sameDevice;
|
|
@@ -54,7 +54,7 @@ export type CrossDeviceCallback = {
|
|
|
54
54
|
onFailure: (error: CrossDeviceCallbackError) => void;
|
|
55
55
|
};
|
|
56
56
|
export type CrossDeviceRequestCredentialsOptions = {
|
|
57
|
-
credentialQuery: CredentialQuery[];
|
|
57
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
58
58
|
crossDeviceCallback: CrossDeviceCallback;
|
|
59
59
|
challenge: string;
|
|
60
60
|
walletProviderId?: string;
|
|
@@ -62,7 +62,7 @@ export type CrossDeviceRequestCredentialsOptions = {
|
|
|
62
62
|
initialiseOptions: InitialiseOptions;
|
|
63
63
|
};
|
|
64
64
|
export type DigitalCredentialsApiRequestOptions = {
|
|
65
|
-
credentialQuery: CredentialQuery[];
|
|
65
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
66
66
|
challenge: string;
|
|
67
67
|
initialiseOptions: InitialiseOptions;
|
|
68
68
|
};
|
|
@@ -73,7 +73,7 @@ export type RequestCredentialsSameDeviceOptions = {
|
|
|
73
73
|
/**
|
|
74
74
|
* An array of CredentialQuery objects that specify the credentials to be requested.
|
|
75
75
|
*/
|
|
76
|
-
credentialQuery: CredentialQuery[];
|
|
76
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
77
77
|
/**
|
|
78
78
|
* The URI to which the user will be redirected after the credential request is completed.
|
|
79
79
|
*/
|
|
@@ -93,7 +93,7 @@ export type RequestCredentialsSameDeviceOptions = {
|
|
|
93
93
|
mode: Mode.sameDevice;
|
|
94
94
|
};
|
|
95
95
|
export declare const RequestCredentialsSameDeviceOptionsValidator: v.ObjectSchema<{
|
|
96
|
-
readonly credentialQuery: v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
96
|
+
readonly credentialQuery: v.UnionSchema<[v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
97
97
|
readonly profile: v.PicklistSchema<[import("./credential-presentation").OpenidPresentationCredentialProfileSupported], undefined>;
|
|
98
98
|
readonly docType: v.StringSchema<undefined>;
|
|
99
99
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
@@ -109,7 +109,21 @@ export declare const RequestCredentialsSameDeviceOptionsValidator: v.ObjectSchem
|
|
|
109
109
|
};
|
|
110
110
|
};
|
|
111
111
|
docType: string;
|
|
112
|
-
}[], undefined>]
|
|
112
|
+
}[], undefined>]>, v.ObjectSchema<{
|
|
113
|
+
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
114
|
+
readonly id: v.StringSchema<undefined>;
|
|
115
|
+
readonly format: v.StringSchema<undefined>;
|
|
116
|
+
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
117
|
+
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
118
|
+
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
119
|
+
}, undefined>, undefined>;
|
|
120
|
+
}, undefined>, undefined>;
|
|
121
|
+
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
122
|
+
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
123
|
+
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
124
|
+
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
125
|
+
}, undefined>, undefined>, never>;
|
|
126
|
+
}, undefined>], undefined>;
|
|
113
127
|
readonly redirectUri: v.StringSchema<undefined>;
|
|
114
128
|
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
115
129
|
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
@@ -122,7 +136,7 @@ export type RequestCredentialsCrossDeviceDeviceOptions = {
|
|
|
122
136
|
/**
|
|
123
137
|
* An array of CredentialQuery objects that specify the credentials to be requested.
|
|
124
138
|
*/
|
|
125
|
-
credentialQuery: CredentialQuery[];
|
|
139
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
126
140
|
/**
|
|
127
141
|
* The callback functions to be executed on success or failure of the credential request in cross device mode.
|
|
128
142
|
*/
|
|
@@ -142,7 +156,7 @@ export type RequestCredentialsCrossDeviceDeviceOptions = {
|
|
|
142
156
|
mode: Mode.crossDevice;
|
|
143
157
|
};
|
|
144
158
|
export declare const RequestCredentialsCrossDeviceOptionsValidator: v.ObjectSchema<{
|
|
145
|
-
readonly credentialQuery: v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
159
|
+
readonly credentialQuery: v.UnionSchema<[v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
146
160
|
readonly profile: v.PicklistSchema<[import("./credential-presentation").OpenidPresentationCredentialProfileSupported], undefined>;
|
|
147
161
|
readonly docType: v.StringSchema<undefined>;
|
|
148
162
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
@@ -158,7 +172,21 @@ export declare const RequestCredentialsCrossDeviceOptionsValidator: v.ObjectSche
|
|
|
158
172
|
};
|
|
159
173
|
};
|
|
160
174
|
docType: string;
|
|
161
|
-
}[], undefined>]
|
|
175
|
+
}[], undefined>]>, v.ObjectSchema<{
|
|
176
|
+
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
177
|
+
readonly id: v.StringSchema<undefined>;
|
|
178
|
+
readonly format: v.StringSchema<undefined>;
|
|
179
|
+
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
180
|
+
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
181
|
+
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
182
|
+
}, undefined>, undefined>;
|
|
183
|
+
}, undefined>, undefined>;
|
|
184
|
+
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
185
|
+
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
186
|
+
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
187
|
+
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
188
|
+
}, undefined>, undefined>, never>;
|
|
189
|
+
}, undefined>], undefined>;
|
|
162
190
|
readonly crossDeviceCallback: v.ObjectSchema<{
|
|
163
191
|
readonly onComplete: v.FunctionSchema<undefined>;
|
|
164
192
|
readonly onFailure: v.FunctionSchema<undefined>;
|
|
@@ -174,7 +202,7 @@ export type RequestCredentialsAutoDetectOptions = {
|
|
|
174
202
|
/**
|
|
175
203
|
* An array of CredentialQuery objects that specify the credentials to be requested.
|
|
176
204
|
*/
|
|
177
|
-
credentialQuery: CredentialQuery[];
|
|
205
|
+
credentialQuery: CredentialQuery[] | DcqlCredentialQuery;
|
|
178
206
|
/**
|
|
179
207
|
* The callback functions to be executed on success or failure of the credential request in cross device mode.
|
|
180
208
|
*/
|
|
@@ -203,7 +231,7 @@ export declare const RequestCredentialsAutoDetectDeviceOptionsValidator: v.Gener
|
|
|
203
231
|
*/
|
|
204
232
|
export type RequestCredentialsOptions = RequestCredentialsSameDeviceOptions | RequestCredentialsCrossDeviceDeviceOptions | RequestCredentialsAutoDetectOptions;
|
|
205
233
|
export declare const RequestCredentialsOptionsValidator: v.UnionSchema<[v.ObjectSchema<{
|
|
206
|
-
readonly credentialQuery: v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
234
|
+
readonly credentialQuery: v.UnionSchema<[v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
207
235
|
readonly profile: v.PicklistSchema<[import("./credential-presentation").OpenidPresentationCredentialProfileSupported], undefined>;
|
|
208
236
|
readonly docType: v.StringSchema<undefined>;
|
|
209
237
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
@@ -219,13 +247,27 @@ export declare const RequestCredentialsOptionsValidator: v.UnionSchema<[v.Object
|
|
|
219
247
|
};
|
|
220
248
|
};
|
|
221
249
|
docType: string;
|
|
222
|
-
}[], undefined>]
|
|
250
|
+
}[], undefined>]>, v.ObjectSchema<{
|
|
251
|
+
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
252
|
+
readonly id: v.StringSchema<undefined>;
|
|
253
|
+
readonly format: v.StringSchema<undefined>;
|
|
254
|
+
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
255
|
+
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
256
|
+
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
257
|
+
}, undefined>, undefined>;
|
|
258
|
+
}, undefined>, undefined>;
|
|
259
|
+
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
260
|
+
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
261
|
+
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
262
|
+
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
263
|
+
}, undefined>, undefined>, never>;
|
|
264
|
+
}, undefined>], undefined>;
|
|
223
265
|
readonly redirectUri: v.StringSchema<undefined>;
|
|
224
266
|
readonly challenge: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
225
267
|
readonly walletProviderId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
226
268
|
readonly mode: v.PicklistSchema<[Mode.sameDevice], undefined>;
|
|
227
269
|
}, undefined>, v.ObjectSchema<{
|
|
228
|
-
readonly credentialQuery: v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
270
|
+
readonly credentialQuery: v.UnionSchema<[v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
229
271
|
readonly profile: v.PicklistSchema<[import("./credential-presentation").OpenidPresentationCredentialProfileSupported], undefined>;
|
|
230
272
|
readonly docType: v.StringSchema<undefined>;
|
|
231
273
|
readonly nameSpaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
|
|
@@ -241,7 +283,21 @@ export declare const RequestCredentialsOptionsValidator: v.UnionSchema<[v.Object
|
|
|
241
283
|
};
|
|
242
284
|
};
|
|
243
285
|
docType: string;
|
|
244
|
-
}[], undefined>]
|
|
286
|
+
}[], undefined>]>, v.ObjectSchema<{
|
|
287
|
+
readonly credentials: v.ArraySchema<v.ObjectSchema<{
|
|
288
|
+
readonly id: v.StringSchema<undefined>;
|
|
289
|
+
readonly format: v.StringSchema<undefined>;
|
|
290
|
+
readonly meta: v.OptionalSchema<v.UnknownSchema, never>;
|
|
291
|
+
readonly claims: v.ArraySchema<v.ObjectSchema<{
|
|
292
|
+
readonly path: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
293
|
+
}, undefined>, undefined>;
|
|
294
|
+
}, undefined>, undefined>;
|
|
295
|
+
readonly credential_sets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
296
|
+
readonly options: v.ArraySchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
297
|
+
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
298
|
+
readonly purpose: v.OptionalSchema<v.UnknownSchema, never>;
|
|
299
|
+
}, undefined>, undefined>, never>;
|
|
300
|
+
}, undefined>], undefined>;
|
|
245
301
|
readonly crossDeviceCallback: v.ObjectSchema<{
|
|
246
302
|
readonly onComplete: v.FunctionSchema<undefined>;
|
|
247
303
|
readonly onFailure: v.FunctionSchema<undefined>;
|
|
@@ -308,12 +364,14 @@ export type HandleRedirectCallbackResponse = {
|
|
|
308
364
|
*/
|
|
309
365
|
export type InitialiseOptions = {
|
|
310
366
|
apiBaseUrl: string;
|
|
367
|
+
applicationId?: string;
|
|
311
368
|
digitalCredentialsApiProtocol?: string;
|
|
312
369
|
enableDigitalCredentialsApiSameDeviceFlow?: boolean;
|
|
313
370
|
enableDigitalCredentialsApiCrossDeviceFlow?: boolean;
|
|
314
371
|
};
|
|
315
372
|
export declare const InitialiseOptionsValidator: v.ObjectSchema<{
|
|
316
373
|
readonly apiBaseUrl: v.StringSchema<undefined>;
|
|
374
|
+
readonly applicationId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
317
375
|
readonly enableDigitalCredentialsApiSameDeviceFlow: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
318
376
|
readonly enableDigitalCredentialsApiCrossDeviceFlow: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
319
377
|
}, undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { SafeFetchValidateRespondError } from "../common/safeFetch";
|
|
3
|
-
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, CreateDigitalCredentialsApiSessionResponse } from "./types";
|
|
3
|
+
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, InitialiseOptions, CreateDigitalCredentialsApiSessionResponse } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Generates a challenge string using the window.crypto API.
|
|
6
6
|
*
|
|
@@ -22,12 +22,11 @@ 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
|
|
25
|
+
* @param applicationId - optional, The ID of the verifier application, if not provided the default application ID will be used.
|
|
26
|
+
* @param walletProviderId - optional, The ID of the wallet provider, if not provided the default wallet provider will be used.
|
|
26
27
|
* @returns A promise that resolves to a result containing either the created session response or an error.
|
|
27
28
|
*/
|
|
28
|
-
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, walletProviderId, }: CreateSessionRequest &
|
|
29
|
-
apiBaseUrl: string;
|
|
30
|
-
}) => Promise<Result<CreateSessionResponse, SafeFetchValidateRespondError>>;
|
|
29
|
+
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, applicationId, walletProviderId, }: CreateSessionRequest & InitialiseOptions) => Promise<Result<CreateSessionResponse, SafeFetchValidateRespondError>>;
|
|
31
30
|
/**
|
|
32
31
|
* Exchange the result of a session using the provided parameters.
|
|
33
32
|
*
|
|
@@ -77,9 +76,10 @@ export declare const createDigitalCredentialsApiSession: ({ credentialQuery, cha
|
|
|
77
76
|
* @param apiBaseUrl - The base URL of the API.
|
|
78
77
|
* @returns A promise that resolves to a result containing either the session result response or an error.
|
|
79
78
|
*/
|
|
80
|
-
export declare const getDigitalCredentialsApiSessionResult: ({ challenge, sessionId, response, apiBaseUrl, }: {
|
|
79
|
+
export declare const getDigitalCredentialsApiSessionResult: ({ challenge, sessionId, response, apiBaseUrl, protocol, }: {
|
|
81
80
|
challenge: string;
|
|
82
81
|
sessionId: string;
|
|
83
82
|
response: any;
|
|
84
83
|
apiBaseUrl: string;
|
|
84
|
+
protocol: string;
|
|
85
85
|
}) => Promise<Result<any, SafeFetchValidateRespondError>>;
|