@loginid/websdk3 3.1.0 → 3.2.2
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 +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2118 -1804
- package/dist/index.global.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -36
- package/dist/index.d.cts +0 -1927
package/dist/index.d.ts
CHANGED
|
@@ -1,1927 +1,2241 @@
|
|
|
1
|
-
|
|
2
|
-
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
-
readonly url: string;
|
|
4
|
-
readonly path?: Record<string, any>;
|
|
5
|
-
readonly cookies?: Record<string, any>;
|
|
6
|
-
readonly headers?: Record<string, any>;
|
|
7
|
-
readonly query?: Record<string, any>;
|
|
8
|
-
readonly formData?: Record<string, any>;
|
|
9
|
-
readonly body?: any;
|
|
10
|
-
readonly mediaType?: string;
|
|
11
|
-
readonly responseHeader?: string;
|
|
12
|
-
readonly errors?: Record<number, string>;
|
|
13
|
-
};
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
14
2
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
3
|
+
type DeviceInfo = {
|
|
4
|
+
/**
|
|
5
|
+
* Client name
|
|
6
|
+
*/
|
|
7
|
+
clientName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Client type.
|
|
10
|
+
*/
|
|
11
|
+
clientType?: "browser" | "other";
|
|
12
|
+
/**
|
|
13
|
+
* Client version
|
|
14
|
+
*/
|
|
15
|
+
clientVersion?: string;
|
|
16
|
+
/**
|
|
17
|
+
* An unique device identifier
|
|
18
|
+
*/
|
|
19
|
+
deviceId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Last use timestamp in rfc3339 format
|
|
22
|
+
*/
|
|
23
|
+
lastUsedAt?: string;
|
|
24
|
+
/**
|
|
25
|
+
* OS architecture
|
|
26
|
+
*/
|
|
27
|
+
osArch?: string;
|
|
28
|
+
/**
|
|
29
|
+
* OS name
|
|
30
|
+
*/
|
|
31
|
+
osName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* OS version
|
|
34
|
+
*/
|
|
35
|
+
osVersion?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Screen height in pixels
|
|
38
|
+
*/
|
|
39
|
+
screenHeight?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Screen width in pixels
|
|
42
|
+
*/
|
|
43
|
+
screenWidth?: number;
|
|
48
44
|
};
|
|
49
|
-
declare const OpenAPI: OpenAPIConfig;
|
|
50
|
-
|
|
51
|
-
declare abstract class BaseHttpRequest {
|
|
52
|
-
readonly config: OpenAPIConfig;
|
|
53
|
-
constructor(config: OpenAPIConfig);
|
|
54
|
-
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
45
|
/**
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
* Checks if platform authenticator available
|
|
47
|
+
* */
|
|
48
|
+
export declare const isPlatformAuthenticatorAvailable: () => Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if conditional UI is available
|
|
51
|
+
* */
|
|
52
|
+
export declare const isConditionalUIAvailable: () => Promise<boolean>;
|
|
53
|
+
type PubKeyCredentialDescriptor = {
|
|
54
|
+
/**
|
|
55
|
+
* Base64 encoded byte array of the public key identifier.
|
|
56
|
+
*/
|
|
57
|
+
id: string;
|
|
58
|
+
transports?: Array<"usb" | "nfc" | "ble" | "internal" | "hybrid" | "cable" | "smart-card">;
|
|
59
|
+
/**
|
|
60
|
+
* The valid credential types.
|
|
61
|
+
*/
|
|
62
|
+
type: "public-key";
|
|
69
63
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
type PublicKeyCredentialRequestOptions = {
|
|
65
|
+
/**
|
|
66
|
+
* A list of PublicKeyCredentialDescriptor objects representing public key
|
|
67
|
+
* credentials acceptable to the caller, in descending order of the caller’s
|
|
68
|
+
* preference (the first item in the list is the most preferred credential,
|
|
69
|
+
* and so on down the list).
|
|
70
|
+
*/
|
|
71
|
+
allowCredentials?: Array<PubKeyCredentialDescriptor>;
|
|
72
|
+
/**
|
|
73
|
+
* This base64 encoded byte array represents a challenge that the selected
|
|
74
|
+
* authenticator signs, along with other data, when producing an authentication
|
|
75
|
+
* assertion.
|
|
76
|
+
*/
|
|
77
|
+
challenge: string;
|
|
78
|
+
/**
|
|
79
|
+
* Additional parameters requesting additional processing by the client and
|
|
80
|
+
* authenticator. For example, if transaction confirmation is sought from the
|
|
81
|
+
* user, then the prompt string might be included as an extension.
|
|
82
|
+
*/
|
|
83
|
+
extensions?: Record<string, any>;
|
|
84
|
+
/**
|
|
85
|
+
* The relying party identifier claimed by the caller. If omitted, its value will
|
|
86
|
+
* be the CredentialsContainer object’s relevant settings object's origin's
|
|
87
|
+
* effective domain.
|
|
88
|
+
*/
|
|
89
|
+
rpId?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Specifies a time, in milliseconds, that the caller is willing
|
|
92
|
+
* to wait for the call to complete. The value is treated as a
|
|
93
|
+
* hint, and MAY be overridden by the client.
|
|
94
|
+
*/
|
|
95
|
+
timeout?: number;
|
|
96
|
+
/**
|
|
97
|
+
* User verification requirement
|
|
98
|
+
*/
|
|
99
|
+
userVerification?: "required" | "preferred" | "discouraged";
|
|
80
100
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
type AuthenticatorSelectionCriteria = {
|
|
102
|
+
/**
|
|
103
|
+
* Authenticator attachment modality
|
|
104
|
+
*/
|
|
105
|
+
authenticatorAttachment?: "platform" | "cross-platform";
|
|
106
|
+
/**
|
|
107
|
+
* Resident key requirement
|
|
108
|
+
*/
|
|
109
|
+
requireResidentKey?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Resident key requirement
|
|
112
|
+
*/
|
|
113
|
+
residentKey?: "discouraged" | "preferred" | "required";
|
|
114
|
+
/**
|
|
115
|
+
* User verification requirement
|
|
116
|
+
*/
|
|
117
|
+
userVerification?: "required" | "preferred" | "discouraged";
|
|
84
118
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
119
|
+
type PublicKeyCredentialParameters = {
|
|
120
|
+
/**
|
|
121
|
+
* A cryptographic signature algorithm with which the newly generated credential
|
|
122
|
+
* will be used, and thus also the type of asymmetric key pair to be generated,
|
|
123
|
+
* e.g., RSA or Elliptic Curve.
|
|
124
|
+
*/
|
|
125
|
+
alg?: -7 | -35 | -36 | -257 | -8;
|
|
126
|
+
/**
|
|
127
|
+
* The valid credential types.
|
|
128
|
+
*/
|
|
129
|
+
type?: "public-key";
|
|
130
|
+
};
|
|
131
|
+
type PublicKeyCredentialUserEntity = {
|
|
132
|
+
displayName: string;
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
};
|
|
136
|
+
type PublicKeyCredentialRpEntity = {
|
|
137
|
+
/**
|
|
138
|
+
* A unique identifier for the Relying Party entity, which sets the RP ID.
|
|
139
|
+
*/
|
|
140
|
+
id?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Relaying party name
|
|
143
|
+
*/
|
|
144
|
+
name: string;
|
|
145
|
+
};
|
|
146
|
+
type PublicKeyCredentialCreationOptions = {
|
|
147
|
+
attestation?: "none" | "indirect" | "direct" | "enterprise";
|
|
148
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
149
|
+
/**
|
|
150
|
+
* This base64 encoded byte array represents a challenge that
|
|
151
|
+
* the selected authenticator signs, along with other data, when
|
|
152
|
+
* producing an authentication assertion.
|
|
153
|
+
*/
|
|
154
|
+
challenge: string;
|
|
155
|
+
/**
|
|
156
|
+
* List of credentials to limit the creation of multiple credentials for the same
|
|
157
|
+
* account on a single authenticator. The client is requested to return an error
|
|
158
|
+
* if the new credential would be created on an authenticator that also contains
|
|
159
|
+
* one of the credentials enumerated in this parameter.
|
|
160
|
+
*/
|
|
161
|
+
excludeCredentials?: Array<PubKeyCredentialDescriptor>;
|
|
162
|
+
/**
|
|
163
|
+
* Additional parameters requesting processing by the client and authenticator.
|
|
164
|
+
*/
|
|
165
|
+
extensions?: Record<string, any>;
|
|
166
|
+
/**
|
|
167
|
+
* This member contains information about the desired properties of the credential
|
|
168
|
+
* to be created. The sequence is ordered from most preferred to least preferred.
|
|
169
|
+
* The client makes a best-effort to create the most preferred credential that it
|
|
170
|
+
* can.
|
|
171
|
+
*/
|
|
172
|
+
pubKeyCredParams: Array<PublicKeyCredentialParameters>;
|
|
173
|
+
rp: PublicKeyCredentialRpEntity;
|
|
174
|
+
/**
|
|
175
|
+
* This OPTIONAL member specifies a time, in milliseconds,
|
|
176
|
+
* that the caller is willing to wait for the call to complete. The
|
|
177
|
+
* value is treated as a hint, and MAY be overridden by the client.
|
|
178
|
+
*/
|
|
179
|
+
timeout?: number;
|
|
180
|
+
user: PublicKeyCredentialUserEntity;
|
|
92
181
|
};
|
|
93
|
-
|
|
94
182
|
type AuthenticatorAssertionResponse = {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
183
|
+
/**
|
|
184
|
+
* A base64 encoded authenticator data structure encodes contextual bindings
|
|
185
|
+
* made by the authenticator.
|
|
186
|
+
*/
|
|
187
|
+
authenticatorData: string;
|
|
188
|
+
/**
|
|
189
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
190
|
+
* passed to the authenticator by the client in order to generate this assertion.
|
|
191
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
192
|
+
* client data has been computed over it.
|
|
193
|
+
*/
|
|
194
|
+
clientDataJSON: string;
|
|
195
|
+
/**
|
|
196
|
+
* A base64 encoded byte sequence identifying a public key credential
|
|
197
|
+
* source and its authentication assertions.
|
|
198
|
+
*/
|
|
199
|
+
credentialId: string;
|
|
200
|
+
/**
|
|
201
|
+
* Base64 encoded the raw signature returned from the authenticator.
|
|
202
|
+
*/
|
|
203
|
+
signature: string;
|
|
204
|
+
/**
|
|
205
|
+
* User handle returned from the authenticator, or null if the authenticator did not return a user handle.
|
|
206
|
+
*/
|
|
207
|
+
userHandle?: string;
|
|
120
208
|
};
|
|
121
|
-
|
|
122
209
|
type AuthCompleteRequestBody = {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
210
|
+
assertionResult: AuthenticatorAssertionResponse;
|
|
211
|
+
/**
|
|
212
|
+
* An opaque object containing session data.
|
|
213
|
+
*/
|
|
214
|
+
session: string;
|
|
128
215
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
216
|
+
type AuthInit = {
|
|
217
|
+
/**
|
|
218
|
+
* An action to be performed by the front-end to complete the authentication flow.
|
|
219
|
+
*/
|
|
220
|
+
action: "proceed" | "crossAuth" | "fallback";
|
|
221
|
+
assertionOptions: PublicKeyCredentialRequestOptions;
|
|
222
|
+
/**
|
|
223
|
+
* List of cross authentication methods in the order of preference
|
|
224
|
+
*/
|
|
225
|
+
crossAuthMethods: Array<"otp" | "otp:sms" | "otp:email">;
|
|
226
|
+
/**
|
|
227
|
+
* The list contains available fallback methods in the order of preference. The
|
|
228
|
+
* list is dynamic and shall not be cached. The default fallback mechanism is
|
|
229
|
+
* the one provided by CIAM but our system may provide additional ones as well.
|
|
230
|
+
* These methods may be enabled by customer via application configuration but
|
|
231
|
+
* they are disabled by default. The list may be empty which means no fallback
|
|
232
|
+
* is available and authentication flow shall terminate at this point.
|
|
233
|
+
*/
|
|
234
|
+
fallbackMethods: Array<"ciam">;
|
|
235
|
+
/**
|
|
236
|
+
* Type of passkey supported by the client.
|
|
237
|
+
*/
|
|
238
|
+
passkeyType?: string;
|
|
239
|
+
/**
|
|
240
|
+
* An opaque object containing session data.
|
|
241
|
+
*/
|
|
242
|
+
session: string;
|
|
140
243
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* User verification requirement
|
|
176
|
-
*/
|
|
177
|
-
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
244
|
+
type CreationResult = {
|
|
245
|
+
/**
|
|
246
|
+
* Base64 encoded byte array containing an attestation object, which is opaque to,
|
|
247
|
+
* and cryptographically protected against tampering by, the client.
|
|
248
|
+
*/
|
|
249
|
+
attestationObject: string;
|
|
250
|
+
/**
|
|
251
|
+
* A base64 encoded authenticator data structure encodes contextual bindings
|
|
252
|
+
* made by the authenticator.
|
|
253
|
+
*/
|
|
254
|
+
authenticatorData?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
257
|
+
* passed to the authenticator by the client in order to generate this credential.
|
|
258
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
259
|
+
* client data has been computed over it.
|
|
260
|
+
*/
|
|
261
|
+
clientDataJSON: string;
|
|
262
|
+
/**
|
|
263
|
+
* A base64 encoded byte sequence identifying a public key credential
|
|
264
|
+
* source and its authentication assertions.
|
|
265
|
+
*/
|
|
266
|
+
credentialId: string;
|
|
267
|
+
/**
|
|
268
|
+
* Base64 encoded DER SubjectPublicKeyInfo of the new credential, or null if this is
|
|
269
|
+
* not available.
|
|
270
|
+
*/
|
|
271
|
+
publicKey?: string;
|
|
272
|
+
publicKeyAlgorithm?: number;
|
|
273
|
+
/**
|
|
274
|
+
* These values are the transports that the authenticator is believed to support,
|
|
275
|
+
* or an empty sequence if the information is unavailable.
|
|
276
|
+
*/
|
|
277
|
+
transports?: Array<"usb" | "nfc" | "ble" | "internal" | "hybrid" | "cable" | "smart-card">;
|
|
178
278
|
};
|
|
179
|
-
|
|
279
|
+
type RegCompleteRequestBody = {
|
|
280
|
+
creationResult: CreationResult;
|
|
281
|
+
/**
|
|
282
|
+
* An opaque object containing session data.
|
|
283
|
+
*/
|
|
284
|
+
session: string;
|
|
285
|
+
};
|
|
286
|
+
type RegInit = {
|
|
287
|
+
/**
|
|
288
|
+
* An action to be performed by the front-end to complete the registration flow.
|
|
289
|
+
*/
|
|
290
|
+
action: "proceed" | "signIn" | "fail";
|
|
291
|
+
registrationRequestOptions: PublicKeyCredentialCreationOptions;
|
|
292
|
+
/**
|
|
293
|
+
* An opaque object containing session data.
|
|
294
|
+
*/
|
|
295
|
+
session: string;
|
|
296
|
+
};
|
|
297
|
+
interface GetNavigatorCredentialOptions {
|
|
298
|
+
autoFill?: boolean;
|
|
299
|
+
abortController?: AbortController;
|
|
300
|
+
}
|
|
301
|
+
interface GetPasskeyCredentialOptions {
|
|
302
|
+
autoFill?: boolean;
|
|
303
|
+
abortController?: AbortController;
|
|
304
|
+
}
|
|
305
|
+
interface AuthzTokenOptions {
|
|
306
|
+
authzToken?: string;
|
|
307
|
+
}
|
|
308
|
+
interface SessionInfo {
|
|
309
|
+
/**
|
|
310
|
+
* Current authenticated user's username.
|
|
311
|
+
*/
|
|
312
|
+
username: string;
|
|
313
|
+
/**
|
|
314
|
+
* Current authenticated user's ID.
|
|
315
|
+
*/
|
|
316
|
+
id: string;
|
|
317
|
+
}
|
|
318
|
+
interface LoginIDTokenSet {
|
|
319
|
+
/**
|
|
320
|
+
* The ID token representing the authenticated session.
|
|
321
|
+
*/
|
|
322
|
+
idToken: string;
|
|
323
|
+
/**
|
|
324
|
+
* The access token used for authorization.
|
|
325
|
+
*/
|
|
326
|
+
accessToken: string;
|
|
327
|
+
/**
|
|
328
|
+
* The refresh token used to obtain new access tokens.
|
|
329
|
+
*/
|
|
330
|
+
refreshToken: string;
|
|
331
|
+
/**
|
|
332
|
+
* A JSON Web Signature (JWS) that provides cryptographic proof of the payload's integrity.
|
|
333
|
+
* Ensures that the authentication data has not been tampered with.
|
|
334
|
+
*/
|
|
335
|
+
payloadSignature?: string;
|
|
336
|
+
}
|
|
337
|
+
type PasskeyErrorCode = "ERROR_PASSKEY_ABORTED" | "ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED" | "ERROR_USER_VERIFICATION_UNSUPPORTED" | "ERROR_PASSKEY_EXISTS" | "ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD" | "ERROR_ALGORITHMS_UNSUPPORTED" | "ERROR_DOMAIN_MISMATCH" | "ERROR_AUTHENTICATOR_UNKNOWN_ERROR";
|
|
180
338
|
/**
|
|
181
|
-
*
|
|
339
|
+
* Error class for passkey-related errors.
|
|
182
340
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* An opaque object containing session data.
|
|
208
|
-
*/
|
|
209
|
-
session: string;
|
|
210
|
-
};
|
|
211
|
-
|
|
341
|
+
export declare class PasskeyError extends Error {
|
|
342
|
+
readonly code: PasskeyErrorCode;
|
|
343
|
+
/**
|
|
344
|
+
* Initializes a new instance of PasskeyError with the provided message, code, and original error.
|
|
345
|
+
*
|
|
346
|
+
* @type {Error}
|
|
347
|
+
* @memberof PasskeyError
|
|
348
|
+
*/
|
|
349
|
+
constructor(message: string, code: PasskeyErrorCode, originalError: Error);
|
|
350
|
+
}
|
|
351
|
+
export declare class WebAuthnHelper {
|
|
352
|
+
/**
|
|
353
|
+
* A helper function that attempts public-key credential authentication using WebAuthn API. It is designed to be used with LoginID's
|
|
354
|
+
* passkey authentication flow. The function takes an authentication initialization response and returns an authentication completion request body.
|
|
355
|
+
*/
|
|
356
|
+
static getNavigatorCredential(authInitResponseBody: AuthInit, options?: GetNavigatorCredentialOptions): Promise<AuthCompleteRequestBody>;
|
|
357
|
+
/**
|
|
358
|
+
* A helper function that creates a public-key credential using WebAuthn API.
|
|
359
|
+
* It processes the response body from registration initialization and returns
|
|
360
|
+
* a registration completion request body.
|
|
361
|
+
*/
|
|
362
|
+
static createNavigatorCredential(regInitResponseBody: RegInit): Promise<RegCompleteRequestBody>;
|
|
363
|
+
}
|
|
212
364
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
365
|
+
* Asynchronously creates a passkey credential using the provided registration response.
|
|
366
|
+
*
|
|
367
|
+
* @param {IRegisterPasskeyInitResponse} init - The registration initiation response.
|
|
368
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
369
|
+
* @throws {LoginIdError} If any errors occur during credential creation or if the credential type is invalid.
|
|
215
370
|
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Unique application id
|
|
219
|
-
*/
|
|
220
|
-
id: string;
|
|
221
|
-
/**
|
|
222
|
-
* App authorization token signed with application key.
|
|
223
|
-
*/
|
|
224
|
-
token?: string;
|
|
225
|
-
};
|
|
226
|
-
|
|
371
|
+
export declare const createPasskeyCredential: (init: PublicKeyCredentialCreationOptions) => Promise<PublicKeyCredential>;
|
|
227
372
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
373
|
+
* Asynchronously retrieves a passkey credential for authentication using the provided request options.
|
|
374
|
+
*
|
|
375
|
+
* @param {publicKeyCredentialRequestOptionsResponseBody} init - The authentication initiation response.
|
|
376
|
+
* @param {AuthenticateWithPasskeysOptions} options - Additional options for the authentication request.
|
|
377
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
231
378
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* OS name
|
|
259
|
-
*/
|
|
260
|
-
osName?: string;
|
|
261
|
-
/**
|
|
262
|
-
* OS version
|
|
263
|
-
*/
|
|
264
|
-
osVersion?: string;
|
|
265
|
-
/**
|
|
266
|
-
* Screen height in pixels
|
|
267
|
-
*/
|
|
268
|
-
screenHeight?: number;
|
|
269
|
-
/**
|
|
270
|
-
* Screen width in pixels
|
|
271
|
-
*/
|
|
272
|
-
screenWidth?: number;
|
|
379
|
+
export declare const getPasskeyCredential: (init: PublicKeyCredentialRequestOptions, options?: GetPasskeyCredentialOptions) => Promise<PublicKeyCredential>;
|
|
380
|
+
/**
|
|
381
|
+
* Error class for abort-related errors.
|
|
382
|
+
*/
|
|
383
|
+
export declare class AbortError extends Error {
|
|
384
|
+
/**
|
|
385
|
+
* Initializes a new instance of AbortError with the provided message.
|
|
386
|
+
*
|
|
387
|
+
* @type {Error}
|
|
388
|
+
* @memberof AbortError
|
|
389
|
+
*/
|
|
390
|
+
constructor(message: string);
|
|
391
|
+
}
|
|
392
|
+
type User = {
|
|
393
|
+
/**
|
|
394
|
+
* Display Name
|
|
395
|
+
*/
|
|
396
|
+
displayName?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Username
|
|
399
|
+
*/
|
|
400
|
+
username: string;
|
|
401
|
+
/**
|
|
402
|
+
* Username type
|
|
403
|
+
*/
|
|
404
|
+
usernameType: "email" | "phone" | "other";
|
|
273
405
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
406
|
+
type MfaOption = {
|
|
407
|
+
/**
|
|
408
|
+
* Human readable label
|
|
409
|
+
*/
|
|
410
|
+
label?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Option name
|
|
413
|
+
*/
|
|
414
|
+
name?: string;
|
|
415
|
+
/**
|
|
416
|
+
* Option value to be used in the next request
|
|
417
|
+
*/
|
|
418
|
+
value: string;
|
|
280
419
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
420
|
+
type MfaAction = {
|
|
421
|
+
action: {
|
|
422
|
+
/**
|
|
423
|
+
* Action description
|
|
424
|
+
*/
|
|
425
|
+
desc?: string;
|
|
426
|
+
/**
|
|
427
|
+
* Human readable action label
|
|
428
|
+
*/
|
|
429
|
+
label: string;
|
|
430
|
+
/**
|
|
431
|
+
* Next Action to be performed.
|
|
432
|
+
*/
|
|
433
|
+
name: "passkey:reg" | "passkey:auth" | "passkey:tx" | "otp:email" | "otp:sms" | "otp:verify" | "external";
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Additional options associated with the action.
|
|
437
|
+
*/
|
|
438
|
+
options?: Array<MfaOption>;
|
|
299
439
|
};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
* @returns void
|
|
343
|
-
* @throws ApiError
|
|
344
|
-
*/
|
|
345
|
-
authAuthCodeRequestEmail({ requestBody, }: {
|
|
346
|
-
requestBody: AuthCodeRequestSMSRequestBody;
|
|
347
|
-
}): CancelablePromise<void>;
|
|
348
|
-
/**
|
|
349
|
-
* Request OTP code to be sent via SMS.
|
|
350
|
-
* Send authentication code to the provided phone number. The SMS will only be
|
|
351
|
-
* sent if the phone is registered with the application, however, it will return
|
|
352
|
-
* success regardless.
|
|
353
|
-
* @returns void
|
|
354
|
-
* @throws ApiError
|
|
355
|
-
*/
|
|
356
|
-
authAuthCodeRequestSms({ requestBody, }: {
|
|
357
|
-
requestBody: AuthCodeRequestSMSRequestBody;
|
|
358
|
-
}): CancelablePromise<void>;
|
|
359
|
-
/**
|
|
360
|
-
* Verify authentication code and return JWT access token with appropriate scopes
|
|
361
|
-
* @returns JWT OK response.
|
|
362
|
-
* @throws ApiError
|
|
363
|
-
*/
|
|
364
|
-
authAuthCodeVerify({ requestBody, }: {
|
|
365
|
-
requestBody: AuthCodeVerifyRequestBody;
|
|
366
|
-
}): CancelablePromise<JWT>;
|
|
440
|
+
type Mfa = {
|
|
441
|
+
/**
|
|
442
|
+
* An authorization token (JWT) confirming successful authentication.
|
|
443
|
+
*/
|
|
444
|
+
accessToken: string;
|
|
445
|
+
/**
|
|
446
|
+
* Device ID
|
|
447
|
+
*/
|
|
448
|
+
deviceId?: string;
|
|
449
|
+
/**
|
|
450
|
+
* The current flow type.
|
|
451
|
+
*/
|
|
452
|
+
flow: "signIn" | "signUp";
|
|
453
|
+
/**
|
|
454
|
+
* An authorization token (JWT) confirming successful authentication.
|
|
455
|
+
*/
|
|
456
|
+
idToken: string;
|
|
457
|
+
/**
|
|
458
|
+
* Base64 encoded payload object
|
|
459
|
+
*/
|
|
460
|
+
payload: string;
|
|
461
|
+
/**
|
|
462
|
+
* A digital signature (JWS) of the payload.
|
|
463
|
+
*/
|
|
464
|
+
payloadSignature: string;
|
|
465
|
+
/**
|
|
466
|
+
* An authorization token (JWT) confirming successful authentication.
|
|
467
|
+
*/
|
|
468
|
+
refreshToken: string;
|
|
469
|
+
};
|
|
470
|
+
type UsernameType = User["usernameType"];
|
|
471
|
+
type MfaFactorName = MfaAction["action"]["name"];
|
|
472
|
+
type MfaFlow = Mfa["flow"];
|
|
473
|
+
interface LoginIDConfig {
|
|
474
|
+
/**
|
|
475
|
+
* The base URL for LoginID FIDO service which can be obtained on the [dashboard](https://dashboard.loginid.io).
|
|
476
|
+
*/
|
|
477
|
+
baseUrl: string;
|
|
478
|
+
/**
|
|
479
|
+
* The optional app ID for specific application.
|
|
480
|
+
*/
|
|
481
|
+
appId?: string;
|
|
367
482
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
483
|
+
interface LoginIDMfaConfig {
|
|
484
|
+
/**
|
|
485
|
+
* The base URL for LoginID FIDO service which can be obtained on the [dashboard](https://dashboard.loginid.io).
|
|
486
|
+
*/
|
|
487
|
+
baseUrl: string;
|
|
488
|
+
/**
|
|
489
|
+
* The optional app ID for specific application.
|
|
490
|
+
*/
|
|
491
|
+
appId?: string;
|
|
492
|
+
}
|
|
493
|
+
interface MfaBeginOptions {
|
|
494
|
+
/**
|
|
495
|
+
* A human-palatable name for the user account, intended only for display on your passkeys and modals.
|
|
496
|
+
*/
|
|
497
|
+
displayName?: string;
|
|
498
|
+
/**
|
|
499
|
+
* The type of username validation to be used. Defaults to **`other`**.
|
|
500
|
+
*/
|
|
501
|
+
usernameType?: UsernameType;
|
|
502
|
+
/**
|
|
503
|
+
* A string representing transaction details for confirmation during MFA.
|
|
504
|
+
* This can be any descriptive text, but using a JSON-formatted string is recommended
|
|
505
|
+
* for structured transaction details.
|
|
506
|
+
*
|
|
507
|
+
* Example (plain text):
|
|
508
|
+
* ```
|
|
509
|
+
* Payment of $100 to John Doe
|
|
510
|
+
* ```
|
|
511
|
+
*
|
|
512
|
+
* Example (JSON):
|
|
513
|
+
* ```json
|
|
514
|
+
* {
|
|
515
|
+
* "transactionId": "12345",
|
|
516
|
+
* "amount": "100.00",
|
|
517
|
+
* "currency": "USD",
|
|
518
|
+
* "recipient": "john.doe@example.com"
|
|
519
|
+
* }
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
txPayload?: string;
|
|
523
|
+
/**
|
|
524
|
+
* An identifier generated on the merchant side to identify the current checkout session.
|
|
525
|
+
* This identifier is used as a key to retrieve associated trust information.
|
|
526
|
+
*
|
|
527
|
+
* It is passed to the wallet to link the session with wallet-issued identity data,
|
|
528
|
+
* enabling secure transaction confirmation without revealing end-user identity to the merchant.
|
|
529
|
+
*/
|
|
530
|
+
checkoutId?: string;
|
|
531
|
+
}
|
|
532
|
+
interface MfaPerformActionOptions {
|
|
533
|
+
/**
|
|
534
|
+
* The MFA state session.
|
|
535
|
+
* This should be obtained from a previous MFA request or initiation step.
|
|
536
|
+
*/
|
|
537
|
+
session?: string;
|
|
538
|
+
/**
|
|
539
|
+
* The payload required for completing the authentication factor.
|
|
540
|
+
* This typically contains user input or challenge-response data.
|
|
541
|
+
*/
|
|
542
|
+
payload?: string;
|
|
543
|
+
/**
|
|
544
|
+
* Enables passkey support in browser autofill suggestions (conditional UI), if supported.
|
|
545
|
+
*/
|
|
546
|
+
autoFill?: boolean;
|
|
547
|
+
}
|
|
548
|
+
interface RemainingFactor {
|
|
549
|
+
/**
|
|
550
|
+
* The type of the MFA factor, such as passkey or OTP via email or SMS.
|
|
551
|
+
* Use this value in performAction to initiate the factor.
|
|
552
|
+
*/
|
|
553
|
+
type: MfaFactorName;
|
|
554
|
+
/**
|
|
555
|
+
* A user-friendly label for the factor, providing context on how it should be used.
|
|
556
|
+
*/
|
|
557
|
+
label: string;
|
|
558
|
+
/**
|
|
559
|
+
* A description of the MFA factor, explaining its purpose or instructions for completion.
|
|
560
|
+
*/
|
|
561
|
+
description?: string;
|
|
562
|
+
/**
|
|
563
|
+
* A unique token for authentication, useful for advanced MFA flows across multiple devices.
|
|
564
|
+
*
|
|
565
|
+
* This is available for the following MFA factor:
|
|
566
|
+
* - passkey
|
|
567
|
+
*
|
|
568
|
+
* Example: To authenticate or add a passkey on another device, pass this value
|
|
569
|
+
* along with the session token to continue the MFA process.
|
|
570
|
+
*/
|
|
571
|
+
value?: string;
|
|
572
|
+
/**
|
|
573
|
+
* A list of available options for the MFA factor, if applicable.
|
|
574
|
+
*
|
|
575
|
+
* Supported for the following MFA factors:
|
|
576
|
+
* - otp:email
|
|
577
|
+
* - otp:sms
|
|
578
|
+
*
|
|
579
|
+
* Typically includes valid email addresses or phone numbers for OTP delivery.
|
|
580
|
+
*/
|
|
581
|
+
options?: string[];
|
|
582
|
+
}
|
|
583
|
+
interface MfaSessionResult {
|
|
584
|
+
/**
|
|
585
|
+
* The MFA flow type indicating whether the session is part of sign-in or sign-up.
|
|
586
|
+
* This helps differentiate between authentication scenarios.
|
|
587
|
+
*/
|
|
588
|
+
flow?: MfaFlow;
|
|
589
|
+
/**
|
|
590
|
+
* List of MFA factors that still need to be completed for authentication.
|
|
591
|
+
* If this list is empty, the authentication process is complete.
|
|
592
|
+
*/
|
|
593
|
+
remainingFactors: RemainingFactor[];
|
|
594
|
+
/**
|
|
595
|
+
* The username associated with the authentication session.
|
|
596
|
+
* This may be undefined if not provided or applicable.
|
|
597
|
+
*/
|
|
598
|
+
username?: string;
|
|
599
|
+
/**
|
|
600
|
+
* Indicates whether the MFA session is complete.
|
|
601
|
+
* If `true`, all required factors have been successfully validated.
|
|
602
|
+
*/
|
|
603
|
+
isComplete: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* The MFA state session.
|
|
606
|
+
* This should be obtained from a previous MFA request or initiation step.
|
|
607
|
+
*/
|
|
608
|
+
session?: string;
|
|
609
|
+
/**
|
|
610
|
+
* A JSON Web Token (JWT) issued upon successful authentication.
|
|
611
|
+
* Used to verify user identity and grant access to protected resources.
|
|
612
|
+
*/
|
|
613
|
+
idToken?: string;
|
|
614
|
+
/**
|
|
615
|
+
* A JSON Web Token (JWT) used for authorizing API requests.
|
|
616
|
+
* This token grants access to user-specific resources and actions.
|
|
617
|
+
*/
|
|
618
|
+
accessToken?: string;
|
|
619
|
+
/**
|
|
620
|
+
* A token used to obtain new access and ID tokens after expiration.
|
|
621
|
+
* This helps maintain user sessions without requiring re-authentication.
|
|
622
|
+
*/
|
|
623
|
+
refreshToken?: string;
|
|
624
|
+
/**
|
|
625
|
+
* A JSON Web Signature (JWS) that provides cryptographic proof of the payload's integrity.
|
|
626
|
+
* Ensures that the authentication data has not been tampered with.
|
|
627
|
+
*/
|
|
628
|
+
payloadSignature?: string;
|
|
629
|
+
/**
|
|
630
|
+
* The next recommended MFA factor action to take.
|
|
631
|
+
* Indicates which MFA factor the user should complete next in order to proceed.
|
|
632
|
+
*/
|
|
633
|
+
nextAction?: MfaFactorName;
|
|
634
|
+
}
|
|
635
|
+
interface VerifyConfigResult {
|
|
636
|
+
/**
|
|
637
|
+
* Indicates whether the configuration is valid.
|
|
638
|
+
*/
|
|
639
|
+
isValid: boolean;
|
|
640
|
+
/**
|
|
641
|
+
* Suggested solution to fix any configuration issues.
|
|
642
|
+
*/
|
|
643
|
+
solution?: string;
|
|
644
|
+
/**
|
|
645
|
+
* A message describing the issue with the configuration, if any.
|
|
646
|
+
*/
|
|
647
|
+
message?: string;
|
|
648
|
+
/**
|
|
649
|
+
* A code representing the error type.
|
|
650
|
+
*/
|
|
651
|
+
code?: string;
|
|
652
|
+
}
|
|
653
|
+
declare class LoginIDConfigValidator {
|
|
654
|
+
/**
|
|
655
|
+
* Holds the configuration settings for the LoginID integration, including API base URL and optional app ID.
|
|
656
|
+
*/
|
|
657
|
+
private readonly config;
|
|
658
|
+
/**
|
|
659
|
+
* Constructs a new instance of the LoginIDConfigValidator class, initializing with the provided configuration.
|
|
660
|
+
* @param {LoginIDConfig} config Configuration object for LoginID API, including the base URL and optional app ID.
|
|
661
|
+
*/
|
|
662
|
+
constructor(config: LoginIDConfig);
|
|
663
|
+
/**
|
|
664
|
+
* Retrieves the application ID from the configuration or extracts it from the base URL if not provided.
|
|
665
|
+
* @returns {string} The application ID.
|
|
666
|
+
* @throws {Error} If the app ID is not found in the configuration or the base URL, throws an error.
|
|
667
|
+
*/
|
|
668
|
+
getAppId(): string;
|
|
669
|
+
}
|
|
670
|
+
type MfaNext = {
|
|
671
|
+
/**
|
|
672
|
+
* The current flow type.
|
|
673
|
+
*/
|
|
674
|
+
flow?: "signIn" | "signUp";
|
|
675
|
+
/**
|
|
676
|
+
* Additional info displayed to the user
|
|
677
|
+
*/
|
|
678
|
+
msg: string;
|
|
679
|
+
/**
|
|
680
|
+
* Message code
|
|
681
|
+
*/
|
|
682
|
+
msgCode: string;
|
|
683
|
+
next?: Array<MfaAction>;
|
|
684
|
+
/**
|
|
685
|
+
* An opaque "session" object to be used with the subsequent API call for maintaining flow state.
|
|
686
|
+
*/
|
|
687
|
+
session?: string;
|
|
386
688
|
};
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
*/
|
|
400
|
-
credentialSynced?: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* Internal passkey ID that uniquely identifies a passkey
|
|
403
|
-
*/
|
|
404
|
-
id: string;
|
|
405
|
-
/**
|
|
406
|
-
* Last use timestamp in rfc3339 format
|
|
407
|
-
*/
|
|
408
|
-
lastUsedAt?: string;
|
|
409
|
-
lastUsedFromDevice?: DeviceInfo;
|
|
410
|
-
/**
|
|
411
|
-
* Name of the passkey
|
|
412
|
-
*/
|
|
413
|
-
name: string;
|
|
414
|
-
/**
|
|
415
|
-
* Name of the passkey provider
|
|
416
|
-
*/
|
|
417
|
-
providerName?: string;
|
|
689
|
+
type ApiRequestOptions = {
|
|
690
|
+
readonly method: "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH";
|
|
691
|
+
readonly url: string;
|
|
692
|
+
readonly path?: Record<string, any>;
|
|
693
|
+
readonly cookies?: Record<string, any>;
|
|
694
|
+
readonly headers?: Record<string, any>;
|
|
695
|
+
readonly query?: Record<string, any>;
|
|
696
|
+
readonly formData?: Record<string, any>;
|
|
697
|
+
readonly body?: any;
|
|
698
|
+
readonly mediaType?: string;
|
|
699
|
+
readonly responseHeader?: string;
|
|
700
|
+
readonly errors?: Record<number, string>;
|
|
418
701
|
};
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
702
|
+
interface OnCancel {
|
|
703
|
+
readonly isResolved: boolean;
|
|
704
|
+
readonly isRejected: boolean;
|
|
705
|
+
readonly isCancelled: boolean;
|
|
706
|
+
(cancelHandler: () => void): void;
|
|
707
|
+
}
|
|
708
|
+
declare class CancelablePromise<T> implements Promise<T> {
|
|
709
|
+
#private;
|
|
710
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
711
|
+
get [Symbol.toStringTag](): string;
|
|
712
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
713
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
714
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
715
|
+
cancel(): void;
|
|
716
|
+
get isCancelled(): boolean;
|
|
717
|
+
}
|
|
718
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
719
|
+
type Headers = Record<string, string>;
|
|
720
|
+
type OpenAPIConfig = {
|
|
721
|
+
BASE: string;
|
|
722
|
+
VERSION: string;
|
|
723
|
+
WITH_CREDENTIALS: boolean;
|
|
724
|
+
CREDENTIALS: "include" | "omit" | "same-origin";
|
|
725
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
726
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
727
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
728
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
729
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
730
|
+
};
|
|
731
|
+
declare abstract class BaseHttpRequest {
|
|
732
|
+
readonly config: OpenAPIConfig;
|
|
733
|
+
constructor(config: OpenAPIConfig);
|
|
734
|
+
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
735
|
+
}
|
|
422
736
|
type PasskeyRenameRequestBody = {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
737
|
+
/**
|
|
738
|
+
* Internal passkey identifier
|
|
739
|
+
*/
|
|
740
|
+
name: string;
|
|
741
|
+
};
|
|
742
|
+
export type Passkey = {
|
|
743
|
+
/**
|
|
744
|
+
* AAGUID of passkey provider
|
|
745
|
+
*/
|
|
746
|
+
aaguid: string;
|
|
747
|
+
/**
|
|
748
|
+
* Timestamp in RFC3339 format.
|
|
749
|
+
*/
|
|
750
|
+
createdAt: string;
|
|
751
|
+
/**
|
|
752
|
+
* Credential available on multiple devices
|
|
753
|
+
*/
|
|
754
|
+
credentialSynced?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* Internal passkey ID that uniquely identifies a passkey
|
|
757
|
+
*/
|
|
758
|
+
id: string;
|
|
759
|
+
/**
|
|
760
|
+
* Last use timestamp in rfc3339 format
|
|
761
|
+
*/
|
|
762
|
+
lastUsedAt?: string;
|
|
763
|
+
lastUsedFromDevice?: DeviceInfo;
|
|
764
|
+
/**
|
|
765
|
+
* Name of the passkey
|
|
766
|
+
*/
|
|
767
|
+
name: string;
|
|
768
|
+
/**
|
|
769
|
+
* Name of the passkey provider
|
|
770
|
+
*/
|
|
771
|
+
providerName?: string;
|
|
772
|
+
};
|
|
773
|
+
export type PasskeyCollection = Array<Passkey>;
|
|
774
|
+
type Aaguid = {
|
|
775
|
+
/**
|
|
776
|
+
* Dark Icon of the AAGUID Vendor
|
|
777
|
+
*/
|
|
778
|
+
iconDark: string;
|
|
779
|
+
/**
|
|
780
|
+
* Light Icon of the AAGUID Vendor
|
|
781
|
+
*/
|
|
782
|
+
iconLight: string;
|
|
783
|
+
/**
|
|
784
|
+
* AAGUID
|
|
785
|
+
*/
|
|
786
|
+
id: string;
|
|
787
|
+
/**
|
|
788
|
+
* Name of the AAGUID Vendor
|
|
789
|
+
*/
|
|
790
|
+
name: string;
|
|
427
791
|
};
|
|
428
|
-
|
|
429
792
|
declare class PasskeysService {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
793
|
+
readonly httpRequest: BaseHttpRequest;
|
|
794
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
795
|
+
/**
|
|
796
|
+
* List passkeys of the user
|
|
797
|
+
* @returns PasskeyCollection OK response.
|
|
798
|
+
* @throws ApiError
|
|
799
|
+
*/
|
|
800
|
+
passkeysPasskeysList({ authorization, }: {
|
|
801
|
+
/**
|
|
802
|
+
* JWT Authorization header
|
|
803
|
+
*/
|
|
804
|
+
authorization?: string;
|
|
805
|
+
}): CancelablePromise<PasskeyCollection>;
|
|
806
|
+
/**
|
|
807
|
+
* Delete passkey
|
|
808
|
+
* @returns void
|
|
809
|
+
* @throws ApiError
|
|
810
|
+
*/
|
|
811
|
+
passkeysPasskeyDelete({ id, authorization, }: {
|
|
812
|
+
/**
|
|
813
|
+
* Internal passkey identifier
|
|
814
|
+
*/
|
|
815
|
+
id: string;
|
|
816
|
+
/**
|
|
817
|
+
* JWT Authorization header
|
|
818
|
+
*/
|
|
819
|
+
authorization?: string;
|
|
820
|
+
}): CancelablePromise<void>;
|
|
821
|
+
/**
|
|
822
|
+
* Rename passkey
|
|
823
|
+
* @returns void
|
|
824
|
+
* @throws ApiError
|
|
825
|
+
*/
|
|
826
|
+
passkeysPasskeyRename({ id, requestBody, authorization, }: {
|
|
827
|
+
/**
|
|
828
|
+
* Internal passkey identifier
|
|
829
|
+
*/
|
|
830
|
+
id: string;
|
|
831
|
+
requestBody: PasskeyRenameRequestBody;
|
|
832
|
+
/**
|
|
833
|
+
* JWT Authorization header
|
|
834
|
+
*/
|
|
835
|
+
authorization?: string;
|
|
836
|
+
}): CancelablePromise<void>;
|
|
837
|
+
/**
|
|
838
|
+
* Get AAGUID Metadata
|
|
839
|
+
* @returns Aaguid OK response.
|
|
840
|
+
* @throws ApiError
|
|
841
|
+
*/
|
|
842
|
+
passkeysAaguidMetadata({ aaguid, authorization, }: {
|
|
843
|
+
/**
|
|
844
|
+
* AAGUID identifier
|
|
845
|
+
*/
|
|
846
|
+
aaguid: string;
|
|
847
|
+
/**
|
|
848
|
+
* JWT Authorization header
|
|
849
|
+
*/
|
|
850
|
+
authorization?: string;
|
|
851
|
+
}): CancelablePromise<Aaguid>;
|
|
489
852
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* made by the authenticator.
|
|
500
|
-
*/
|
|
501
|
-
authenticatorData?: string;
|
|
502
|
-
/**
|
|
503
|
-
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
504
|
-
* passed to the authenticator by the client in order to generate this credential.
|
|
505
|
-
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
506
|
-
* client data has been computed over it.
|
|
507
|
-
*/
|
|
508
|
-
clientDataJSON: string;
|
|
509
|
-
/**
|
|
510
|
-
* A base64 encoded byte sequence identifying a public key credential
|
|
511
|
-
* source and its authentication assertions.
|
|
512
|
-
*/
|
|
513
|
-
credentialId: string;
|
|
514
|
-
/**
|
|
515
|
-
* Base64 encoded DER SubjectPublicKeyInfo of the new credential, or null if this is
|
|
516
|
-
* not available.
|
|
517
|
-
*/
|
|
518
|
-
publicKey?: string;
|
|
519
|
-
publicKeyAlgorithm?: number;
|
|
520
|
-
/**
|
|
521
|
-
* These values are the transports that the authenticator is believed to support,
|
|
522
|
-
* or an empty sequence if the information is unavailable.
|
|
523
|
-
*/
|
|
524
|
-
transports?: Array<'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid' | 'cable' | 'smart-card'>;
|
|
853
|
+
type UserLogin = {
|
|
854
|
+
/**
|
|
855
|
+
* Username
|
|
856
|
+
*/
|
|
857
|
+
username: string;
|
|
858
|
+
/**
|
|
859
|
+
* Username type
|
|
860
|
+
*/
|
|
861
|
+
usernameType?: "email" | "phone" | "other";
|
|
525
862
|
};
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
creationResult: CreationResult;
|
|
529
|
-
/**
|
|
530
|
-
* An opaque object containing session data.
|
|
531
|
-
*/
|
|
532
|
-
session: string;
|
|
863
|
+
type AuthCodeRequestSMSRequestBody = {
|
|
864
|
+
user: UserLogin;
|
|
533
865
|
};
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Resident key requirement
|
|
542
|
-
*/
|
|
543
|
-
requireResidentKey?: boolean;
|
|
544
|
-
/**
|
|
545
|
-
* Resident key requirement
|
|
546
|
-
*/
|
|
547
|
-
residentKey?: 'discouraged' | 'preferred' | 'required';
|
|
548
|
-
/**
|
|
549
|
-
* User verification requirement
|
|
550
|
-
*/
|
|
551
|
-
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
866
|
+
type AuthCodeVerifyRequestBody = {
|
|
867
|
+
/**
|
|
868
|
+
* Authentication code
|
|
869
|
+
*/
|
|
870
|
+
authCode: string;
|
|
871
|
+
user: UserLogin;
|
|
552
872
|
};
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
*/
|
|
563
|
-
alg?: -7 | -35 | -36 | -257 | -8;
|
|
564
|
-
/**
|
|
565
|
-
* The valid credential types.
|
|
566
|
-
*/
|
|
567
|
-
type?: 'public-key';
|
|
873
|
+
type Application = {
|
|
874
|
+
/**
|
|
875
|
+
* Unique application id
|
|
876
|
+
*/
|
|
877
|
+
id: string;
|
|
878
|
+
/**
|
|
879
|
+
* App authorization token signed with application key.
|
|
880
|
+
*/
|
|
881
|
+
token?: string;
|
|
568
882
|
};
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
id?: string;
|
|
578
|
-
/**
|
|
579
|
-
* Relaying party name
|
|
580
|
-
*/
|
|
581
|
-
name: string;
|
|
883
|
+
type AuthInitRequestBody = {
|
|
884
|
+
app: Application;
|
|
885
|
+
deviceInfo: DeviceInfo;
|
|
886
|
+
/**
|
|
887
|
+
* TrustIDs provided with the request
|
|
888
|
+
*/
|
|
889
|
+
trustItems?: Record<string, string>;
|
|
890
|
+
user?: UserLogin;
|
|
582
891
|
};
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
892
|
+
type AuthCode = {
|
|
893
|
+
/**
|
|
894
|
+
* Generated code
|
|
895
|
+
*/
|
|
896
|
+
code: string;
|
|
897
|
+
/**
|
|
898
|
+
* Expiration time of the code
|
|
899
|
+
*/
|
|
900
|
+
expiresAt: string;
|
|
591
901
|
};
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Additional parameters requesting processing by the client and authenticator.
|
|
611
|
-
*/
|
|
612
|
-
extensions?: Record<string, any>;
|
|
613
|
-
/**
|
|
614
|
-
* This member contains information about the desired properties of the credential
|
|
615
|
-
* to be created. The sequence is ordered from most preferred to least preferred.
|
|
616
|
-
* The client makes a best-effort to create the most preferred credential that it
|
|
617
|
-
* can.
|
|
618
|
-
*/
|
|
619
|
-
pubKeyCredParams: Array<PublicKeyCredentialParameters>;
|
|
620
|
-
rp: PublicKeyCredentialRpEntity;
|
|
621
|
-
/**
|
|
622
|
-
* This OPTIONAL member specifies a time, in milliseconds,
|
|
623
|
-
* that the caller is willing to wait for the call to complete. The
|
|
624
|
-
* value is treated as a hint, and MAY be overridden by the client.
|
|
625
|
-
*/
|
|
626
|
-
timeout?: number;
|
|
627
|
-
user: PublicKeyCredentialUserEntity;
|
|
902
|
+
type JWT = {
|
|
903
|
+
/**
|
|
904
|
+
* Device ID
|
|
905
|
+
*/
|
|
906
|
+
deviceId?: string;
|
|
907
|
+
/**
|
|
908
|
+
* JWT access token
|
|
909
|
+
*/
|
|
910
|
+
jwtAccess: string;
|
|
911
|
+
/**
|
|
912
|
+
* Passkey ID
|
|
913
|
+
*/
|
|
914
|
+
passkeyId?: string;
|
|
915
|
+
/**
|
|
916
|
+
* User ID
|
|
917
|
+
*/
|
|
918
|
+
userId: string;
|
|
628
919
|
};
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
920
|
+
declare class AuthService {
|
|
921
|
+
readonly httpRequest: BaseHttpRequest;
|
|
922
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
923
|
+
/**
|
|
924
|
+
* Complete WebAuthn authentication
|
|
925
|
+
* @returns JWT OK response.
|
|
926
|
+
* @throws ApiError
|
|
927
|
+
*/
|
|
928
|
+
authAuthComplete({ requestBody, }: {
|
|
929
|
+
requestBody: AuthCompleteRequestBody;
|
|
930
|
+
}): CancelablePromise<JWT>;
|
|
931
|
+
/**
|
|
932
|
+
* Start WebAuthn authentication flow
|
|
933
|
+
* @returns AuthInit OK response.
|
|
934
|
+
* @throws ApiError
|
|
935
|
+
*/
|
|
936
|
+
authAuthInit({ requestBody, userAgent, }: {
|
|
937
|
+
requestBody: AuthInitRequestBody;
|
|
938
|
+
/**
|
|
939
|
+
* Raw user-agent header as set by a browser
|
|
940
|
+
*/
|
|
941
|
+
userAgent?: string;
|
|
942
|
+
}): CancelablePromise<AuthInit>;
|
|
943
|
+
/**
|
|
944
|
+
* Request OTP code by an authenticated user
|
|
945
|
+
* An authenticated user can request an authentication code directly using this
|
|
946
|
+
* method. The code can be used for authentication from another device.
|
|
947
|
+
* @returns AuthCode OK response.
|
|
948
|
+
* @throws ApiError
|
|
949
|
+
*/
|
|
950
|
+
authAuthCodeRequest({ authorization, }: {
|
|
951
|
+
/**
|
|
952
|
+
* JWT Authorization header
|
|
953
|
+
*/
|
|
954
|
+
authorization?: string;
|
|
955
|
+
}): CancelablePromise<AuthCode>;
|
|
956
|
+
/**
|
|
957
|
+
* Request OTP code to be sent via email.
|
|
958
|
+
* Send authentication code to the provided email. The SMS will only be sent
|
|
959
|
+
* if the email address is known to the application, however, this method will
|
|
960
|
+
* return success regardless.
|
|
961
|
+
* @returns void
|
|
962
|
+
* @throws ApiError
|
|
963
|
+
*/
|
|
964
|
+
authAuthCodeRequestEmail({ requestBody, }: {
|
|
965
|
+
requestBody: AuthCodeRequestSMSRequestBody;
|
|
966
|
+
}): CancelablePromise<void>;
|
|
967
|
+
/**
|
|
968
|
+
* Request OTP code to be sent via SMS.
|
|
969
|
+
* Send authentication code to the provided phone number. The SMS will only be
|
|
970
|
+
* sent if the phone is registered with the application, however, it will return
|
|
971
|
+
* success regardless.
|
|
972
|
+
* @returns void
|
|
973
|
+
* @throws ApiError
|
|
974
|
+
*/
|
|
975
|
+
authAuthCodeRequestSms({ requestBody, }: {
|
|
976
|
+
requestBody: AuthCodeRequestSMSRequestBody;
|
|
977
|
+
}): CancelablePromise<void>;
|
|
978
|
+
/**
|
|
979
|
+
* Verify authentication code and return JWT access token with appropriate scopes
|
|
980
|
+
* @returns JWT OK response.
|
|
981
|
+
* @throws ApiError
|
|
982
|
+
*/
|
|
983
|
+
authAuthCodeVerify({ requestBody, }: {
|
|
984
|
+
requestBody: AuthCodeVerifyRequestBody;
|
|
985
|
+
}): CancelablePromise<JWT>;
|
|
986
|
+
}
|
|
987
|
+
type MfaThirdPartyAuthVerifyRequestBody = {
|
|
988
|
+
/**
|
|
989
|
+
* Authorization token produced by mgmt API.
|
|
990
|
+
*/
|
|
991
|
+
token: string;
|
|
643
992
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
conditionalCreate: boolean;
|
|
993
|
+
type MfaOtpRequestResponseBody = {
|
|
994
|
+
/**
|
|
995
|
+
* An opaque session object to be included with the subsequent API call.
|
|
996
|
+
*/
|
|
997
|
+
session: string;
|
|
650
998
|
};
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
999
|
+
type MfaPasskeyAuthRequestBody = {
|
|
1000
|
+
assertionResult: AuthenticatorAssertionResponse;
|
|
1001
|
+
};
|
|
1002
|
+
type MfaOtpRequestRequestBody = {
|
|
1003
|
+
/**
|
|
1004
|
+
* OTP method
|
|
1005
|
+
*/
|
|
1006
|
+
method: "email" | "sms";
|
|
1007
|
+
/**
|
|
1008
|
+
* An OTP option selected by the user (i.e. address to send the OTP request to - phone, email, etc.)
|
|
1009
|
+
*/
|
|
1010
|
+
option?: string;
|
|
1011
|
+
};
|
|
1012
|
+
type MfaPasskeyRegRequestBody = {
|
|
1013
|
+
creationResult: CreationResult;
|
|
1014
|
+
};
|
|
1015
|
+
type MfaOtpVerifyRequestBody = {
|
|
1016
|
+
otp: string;
|
|
1017
|
+
};
|
|
1018
|
+
type MfaBeginRequestBody = {
|
|
1019
|
+
deviceInfo?: DeviceInfo;
|
|
1020
|
+
/**
|
|
1021
|
+
* Payload to be signed
|
|
1022
|
+
*/
|
|
1023
|
+
payload?: string;
|
|
1024
|
+
/**
|
|
1025
|
+
* TrustIDs provided with the request
|
|
1026
|
+
*/
|
|
1027
|
+
trustItems?: Record<string, string>;
|
|
1028
|
+
user?: User;
|
|
1029
|
+
};
|
|
1030
|
+
type MfaErrorRequestBody = {
|
|
1031
|
+
/**
|
|
1032
|
+
* Client side error code.
|
|
1033
|
+
*/
|
|
1034
|
+
error: string;
|
|
1035
|
+
};
|
|
1036
|
+
declare class MfaService {
|
|
1037
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1038
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1039
|
+
/**
|
|
1040
|
+
* Begin and appropriate flow for the provided username.
|
|
1041
|
+
* Perform pre-authentication.
|
|
1042
|
+
* @returns MfaNext OK response.
|
|
1043
|
+
* @throws ApiError
|
|
1044
|
+
*/
|
|
1045
|
+
mfaMfaBegin({ requestBody, userAgent, }: {
|
|
1046
|
+
requestBody: MfaBeginRequestBody;
|
|
1047
|
+
/**
|
|
1048
|
+
* Raw user-agent header as set by a browser
|
|
1049
|
+
*/
|
|
1050
|
+
userAgent?: string;
|
|
1051
|
+
}): CancelablePromise<MfaNext>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Verify auth token created by a third party via management API.
|
|
1054
|
+
* Report a client error. It does not change state of the flow.
|
|
1055
|
+
* @returns void
|
|
1056
|
+
* @throws ApiError
|
|
1057
|
+
*/
|
|
1058
|
+
mfaMfaError({ requestBody, authorization, }: {
|
|
1059
|
+
requestBody: MfaErrorRequestBody;
|
|
1060
|
+
/**
|
|
1061
|
+
* JWT Authorization header
|
|
1062
|
+
*/
|
|
1063
|
+
authorization?: string;
|
|
1064
|
+
}): CancelablePromise<void>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Request OTP authentication using one of the available methods.
|
|
1067
|
+
* Request OTP.
|
|
1068
|
+
* @returns MfaOtpRequestResponseBody OK response.
|
|
1069
|
+
* @throws ApiError
|
|
1070
|
+
*/
|
|
1071
|
+
mfaMfaOtpRequest({ requestBody, authorization, }: {
|
|
1072
|
+
requestBody: MfaOtpRequestRequestBody;
|
|
1073
|
+
/**
|
|
1074
|
+
* JWT Authorization header
|
|
1075
|
+
*/
|
|
1076
|
+
authorization?: string;
|
|
1077
|
+
}): CancelablePromise<MfaOtpRequestResponseBody>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Confirm OTP received in a previous step.
|
|
1080
|
+
* Verify OTP received by one of the methods.
|
|
1081
|
+
* @returns Mfa OK response.
|
|
1082
|
+
* @throws ApiError
|
|
1083
|
+
*/
|
|
1084
|
+
mfaMfaOtpVerify({ requestBody, authorization, }: {
|
|
1085
|
+
requestBody: MfaOtpVerifyRequestBody;
|
|
1086
|
+
/**
|
|
1087
|
+
* JWT Authorization header
|
|
1088
|
+
*/
|
|
1089
|
+
authorization?: string;
|
|
1090
|
+
}): CancelablePromise<Mfa>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Authenticate using passkey.
|
|
1093
|
+
* Authenticate with a passkeys.
|
|
1094
|
+
* @returns Mfa OK response.
|
|
1095
|
+
* @throws ApiError
|
|
1096
|
+
*/
|
|
1097
|
+
mfaMfaPasskeyAuth({ requestBody, authorization, }: {
|
|
1098
|
+
requestBody: MfaPasskeyAuthRequestBody;
|
|
1099
|
+
/**
|
|
1100
|
+
* JWT Authorization header
|
|
1101
|
+
*/
|
|
1102
|
+
authorization?: string;
|
|
1103
|
+
}): CancelablePromise<Mfa>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Register a new passkey.
|
|
1106
|
+
* Register a new passkey.
|
|
1107
|
+
* @returns Mfa OK response.
|
|
1108
|
+
* @throws ApiError
|
|
1109
|
+
*/
|
|
1110
|
+
mfaMfaPasskeyReg({ requestBody, authorization, }: {
|
|
1111
|
+
requestBody: MfaPasskeyRegRequestBody;
|
|
1112
|
+
/**
|
|
1113
|
+
* JWT Authorization header
|
|
1114
|
+
*/
|
|
1115
|
+
authorization?: string;
|
|
1116
|
+
}): CancelablePromise<Mfa>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Transaction confirmation using passkey.
|
|
1119
|
+
* Confirm a transaction with a passkey.
|
|
1120
|
+
* @returns Mfa OK response.
|
|
1121
|
+
* @throws ApiError
|
|
1122
|
+
*/
|
|
1123
|
+
mfaMfaPasskeyTx({ requestBody, authorization, }: {
|
|
1124
|
+
requestBody: MfaPasskeyAuthRequestBody;
|
|
1125
|
+
/**
|
|
1126
|
+
* JWT Authorization header
|
|
1127
|
+
*/
|
|
1128
|
+
authorization?: string;
|
|
1129
|
+
}): CancelablePromise<Mfa>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Verify auth token created by a third party via management API.
|
|
1132
|
+
* Verify authentication token received from a third party.
|
|
1133
|
+
* @returns Mfa OK response.
|
|
1134
|
+
* @throws ApiError
|
|
1135
|
+
*/
|
|
1136
|
+
mfaMfaThirdPartyAuthVerify({ requestBody, authorization, }: {
|
|
1137
|
+
requestBody: MfaThirdPartyAuthVerifyRequestBody;
|
|
1138
|
+
/**
|
|
1139
|
+
* JWT Authorization header
|
|
1140
|
+
*/
|
|
1141
|
+
authorization?: string;
|
|
1142
|
+
}): CancelablePromise<Mfa>;
|
|
1143
|
+
}
|
|
1144
|
+
type PasskeyOptions = {
|
|
1145
|
+
/**
|
|
1146
|
+
* Flag to allow conditional creation
|
|
1147
|
+
*/
|
|
1148
|
+
conditionalCreate?: boolean;
|
|
1149
|
+
/**
|
|
1150
|
+
* Whether the authenticator is a security key
|
|
1151
|
+
*/
|
|
1152
|
+
securityKey?: boolean;
|
|
665
1153
|
};
|
|
666
|
-
|
|
667
1154
|
type RegInitRequestBody = {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
1155
|
+
app: Application;
|
|
1156
|
+
deviceInfo: DeviceInfo;
|
|
1157
|
+
passkeyOptions?: PasskeyOptions;
|
|
1158
|
+
/**
|
|
1159
|
+
* TrustIDs provided with the request
|
|
1160
|
+
*/
|
|
1161
|
+
trustItems?: Record<string, string>;
|
|
1162
|
+
user?: User;
|
|
673
1163
|
};
|
|
674
|
-
|
|
675
1164
|
declare class RegService {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
1165
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1166
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1167
|
+
/**
|
|
1168
|
+
* Complete WebAuthn registration flow
|
|
1169
|
+
* @returns JWT OK response.
|
|
1170
|
+
* @throws ApiError
|
|
1171
|
+
*/
|
|
1172
|
+
regRegComplete({ requestBody, }: {
|
|
1173
|
+
requestBody: RegCompleteRequestBody;
|
|
1174
|
+
}): CancelablePromise<JWT>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Start WebAuthn registration flow
|
|
1177
|
+
* @returns RegInit OK response.
|
|
1178
|
+
* @throws ApiError
|
|
1179
|
+
*/
|
|
1180
|
+
regRegInit({ requestBody, userAgent, authorization, }: {
|
|
1181
|
+
requestBody: RegInitRequestBody;
|
|
1182
|
+
/**
|
|
1183
|
+
* Raw user-agent header as set by a browser
|
|
1184
|
+
*/
|
|
1185
|
+
userAgent?: string;
|
|
1186
|
+
/**
|
|
1187
|
+
* JWT Authorization header
|
|
1188
|
+
*/
|
|
1189
|
+
authorization?: string;
|
|
1190
|
+
}): CancelablePromise<RegInit>;
|
|
702
1191
|
}
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* Transaction Confirmation Complete response
|
|
706
|
-
*/
|
|
707
|
-
type TxComplete = {
|
|
708
|
-
authCred?: Passkey;
|
|
709
|
-
/**
|
|
710
|
-
* Internal passkey identifier
|
|
711
|
-
*/
|
|
712
|
-
credentialId: string;
|
|
713
|
-
/**
|
|
714
|
-
* Authorization token
|
|
715
|
-
*/
|
|
716
|
-
token: string;
|
|
717
|
-
};
|
|
718
|
-
|
|
719
1192
|
type TxCompleteRequestBody = {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* Transaction Confirmation Init response
|
|
747
|
-
*/
|
|
748
|
-
type TxInit = {
|
|
749
|
-
assertionOptions: PublicKeyCredentialRequestOptions;
|
|
750
|
-
/**
|
|
751
|
-
* An opaque object containing session data.
|
|
752
|
-
*/
|
|
753
|
-
session: string;
|
|
754
|
-
/**
|
|
755
|
-
* Internal transaction identifier
|
|
756
|
-
*/
|
|
757
|
-
txId: string;
|
|
1193
|
+
/**
|
|
1194
|
+
* This attribute contains the authenticator data returned by the authenticator.
|
|
1195
|
+
*/
|
|
1196
|
+
authenticatorData: string;
|
|
1197
|
+
/**
|
|
1198
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
1199
|
+
* passed to the authenticator by the client in order to generate this assertion.
|
|
1200
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
1201
|
+
* client data has been computed over it.
|
|
1202
|
+
*/
|
|
1203
|
+
clientData: string;
|
|
1204
|
+
/**
|
|
1205
|
+
* Identified of the passkey credential.
|
|
1206
|
+
*/
|
|
1207
|
+
keyHandle: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* An opaque object containing session data.
|
|
1210
|
+
*/
|
|
1211
|
+
session: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* Base64 encoded the raw signature returned from the authenticator.
|
|
1214
|
+
*/
|
|
1215
|
+
signature: string;
|
|
758
1216
|
};
|
|
759
|
-
|
|
760
1217
|
type TxInitRequestBody = {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
1218
|
+
/**
|
|
1219
|
+
* Random string
|
|
1220
|
+
*/
|
|
1221
|
+
nonce: string;
|
|
1222
|
+
/**
|
|
1223
|
+
* Payload of transaction
|
|
1224
|
+
*/
|
|
1225
|
+
txPayload: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* Type of transaction
|
|
1228
|
+
*/
|
|
1229
|
+
txType: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* Username of user
|
|
1232
|
+
*/
|
|
1233
|
+
username: string;
|
|
1234
|
+
};
|
|
1235
|
+
type TxComplete = {
|
|
1236
|
+
authCred?: Passkey;
|
|
1237
|
+
/**
|
|
1238
|
+
* Internal passkey identifier
|
|
1239
|
+
*/
|
|
1240
|
+
credentialId: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* Authorization token
|
|
1243
|
+
*/
|
|
1244
|
+
token: string;
|
|
1245
|
+
};
|
|
1246
|
+
type TxInit = {
|
|
1247
|
+
assertionOptions: PublicKeyCredentialRequestOptions;
|
|
1248
|
+
/**
|
|
1249
|
+
* An opaque object containing session data.
|
|
1250
|
+
*/
|
|
1251
|
+
session: string;
|
|
1252
|
+
/**
|
|
1253
|
+
* Internal transaction identifier
|
|
1254
|
+
*/
|
|
1255
|
+
txId: string;
|
|
777
1256
|
};
|
|
778
|
-
|
|
779
1257
|
declare class TxService {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1258
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1259
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1260
|
+
/**
|
|
1261
|
+
* Complete transaction confirmation
|
|
1262
|
+
* @returns TxComplete OK response.
|
|
1263
|
+
* @throws ApiError
|
|
1264
|
+
*/
|
|
1265
|
+
txTxComplete({ requestBody, }: {
|
|
1266
|
+
requestBody: TxCompleteRequestBody;
|
|
1267
|
+
}): CancelablePromise<TxComplete>;
|
|
1268
|
+
/**
|
|
1269
|
+
* Start transaction confirmation flow
|
|
1270
|
+
* @returns TxInit OK response.
|
|
1271
|
+
* @throws ApiError
|
|
1272
|
+
*/
|
|
1273
|
+
txTxInit({ requestBody, }: {
|
|
1274
|
+
requestBody: TxInitRequestBody;
|
|
1275
|
+
}): CancelablePromise<TxInit>;
|
|
798
1276
|
}
|
|
799
|
-
|
|
800
1277
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
801
1278
|
declare class LoginIDService {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1279
|
+
readonly auth: AuthService;
|
|
1280
|
+
readonly mfa: MfaService;
|
|
1281
|
+
readonly passkeys: PasskeysService;
|
|
1282
|
+
readonly reg: RegService;
|
|
1283
|
+
readonly tx: TxService;
|
|
1284
|
+
readonly request: BaseHttpRequest;
|
|
1285
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
808
1286
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
1287
|
+
declare class SessionManager {
|
|
1288
|
+
/**
|
|
1289
|
+
* Holds the configuration settings for the LoginID integration, including API base URL.
|
|
1290
|
+
*/
|
|
1291
|
+
protected config: LoginIDConfigValidator;
|
|
1292
|
+
/**
|
|
1293
|
+
* Initializes a new instance of SessionManager with the provided configuration.
|
|
1294
|
+
*
|
|
1295
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1296
|
+
*/
|
|
1297
|
+
constructor(config: LoginIDConfig);
|
|
1298
|
+
/**
|
|
1299
|
+
* Retrieves the authentication token from the provided options or from cookies if not available in options.
|
|
1300
|
+
*
|
|
1301
|
+
* @param {AuthzTokenOptions} options Options containing the token.
|
|
1302
|
+
* @returns {string} The authentication token.
|
|
1303
|
+
*/
|
|
1304
|
+
getToken(options: AuthzTokenOptions): string;
|
|
1305
|
+
/**
|
|
1306
|
+
* Retrieves the currently authenticated user's session information.
|
|
1307
|
+
*
|
|
1308
|
+
* @returns {LoginIDUser | null} The currently authenticated user's information, including username and id.
|
|
1309
|
+
* It will return null if user is not authenticated
|
|
1310
|
+
*/
|
|
1311
|
+
getSessionInfo(): SessionInfo | null;
|
|
1312
|
+
/**
|
|
1313
|
+
* Returns the dynamic Cookie name holding the authorization token for the given application.
|
|
1314
|
+
*
|
|
1315
|
+
* @returns {string} The name of the cookie
|
|
1316
|
+
*/
|
|
1317
|
+
getJwtCookieName(): string;
|
|
1318
|
+
/**
|
|
1319
|
+
* Returns the dynamic Cookie name holding the identification token for the given user.
|
|
1320
|
+
*
|
|
1321
|
+
* @returns {string} The name of the cookie
|
|
1322
|
+
*/
|
|
1323
|
+
getIdTokenName(): string;
|
|
1324
|
+
/**
|
|
1325
|
+
* Returns the dynamic Cookie name holding the access token for the given user.
|
|
1326
|
+
*
|
|
1327
|
+
* @returns {string} The name of the cookie
|
|
1328
|
+
*/
|
|
1329
|
+
getAccessTokenName(): string;
|
|
1330
|
+
/**
|
|
1331
|
+
* Returns the dynamic Cookie name holding the refresh token for the given user.
|
|
1332
|
+
*
|
|
1333
|
+
* @returns {string} The name of the cookie
|
|
1334
|
+
*/
|
|
1335
|
+
getRefreshTokenName(): string;
|
|
1336
|
+
/**
|
|
1337
|
+
* Returns the dynamic Cookie name holding the payload signature for the given user.
|
|
1338
|
+
*
|
|
1339
|
+
* @returns {string} The name of the cookie
|
|
1340
|
+
*/
|
|
1341
|
+
getPayloadSignatureName(): string;
|
|
1342
|
+
/**
|
|
1343
|
+
* Set jwt token to local Cookie
|
|
1344
|
+
*
|
|
1345
|
+
* @param {string} jwt Configuration object for LoginID API, including the base URL.
|
|
1346
|
+
*/
|
|
1347
|
+
setJwtCookie(jwt: string): void;
|
|
1348
|
+
/**
|
|
1349
|
+
* Retrieves the JWT access token.
|
|
1350
|
+
*
|
|
1351
|
+
* @returns {string | undefined} The JWT access token.
|
|
1352
|
+
*/
|
|
1353
|
+
getJwtCookie(): string | undefined;
|
|
1354
|
+
/**
|
|
1355
|
+
* Checks if the user is logged in.
|
|
1356
|
+
*
|
|
1357
|
+
* @returns {boolean}
|
|
1358
|
+
*/
|
|
1359
|
+
isLoggedIn(): boolean;
|
|
1360
|
+
/**
|
|
1361
|
+
* Deletes the jwt cookie.
|
|
1362
|
+
*/
|
|
1363
|
+
logout(): void;
|
|
1364
|
+
/**
|
|
1365
|
+
* Set the successful result token set to local Cookie.
|
|
1366
|
+
*
|
|
1367
|
+
* @param {Mfa} result Configuration object for LoginID API, including the base URL.
|
|
1368
|
+
*/
|
|
1369
|
+
setTokenSet(result: Mfa): void;
|
|
1370
|
+
/**
|
|
1371
|
+
* Retrieves a specific token by type.
|
|
1372
|
+
*
|
|
1373
|
+
* @param {string} tokenType The type of token to retrieve ('idToken', 'accessToken', 'refreshToken', 'payloadSignature').
|
|
1374
|
+
* @returns {string | undefined} The token value, or null if not found.
|
|
1375
|
+
*/
|
|
1376
|
+
retrieveToken(tokenType: "idToken" | "accessToken" | "refreshToken" | "payloadSignature"): string;
|
|
1377
|
+
/**
|
|
1378
|
+
* Retrieves the complete token set as a JavaScript object.
|
|
1379
|
+
*
|
|
1380
|
+
* @returns {LoginIDTokenSet} The token set object.
|
|
1381
|
+
*/
|
|
1382
|
+
getTokenSet(): LoginIDTokenSet;
|
|
825
1383
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
type index_AuthInit = AuthInit;
|
|
845
|
-
type index_AuthInitRequestBody = AuthInitRequestBody;
|
|
846
|
-
type index_AuthService = AuthService;
|
|
847
|
-
declare const index_AuthService: typeof AuthService;
|
|
848
|
-
type index_AuthenticatorAssertionResponse = AuthenticatorAssertionResponse;
|
|
849
|
-
type index_AuthenticatorSelectionCriteria = AuthenticatorSelectionCriteria;
|
|
850
|
-
type index_BaseHttpRequest = BaseHttpRequest;
|
|
851
|
-
declare const index_BaseHttpRequest: typeof BaseHttpRequest;
|
|
852
|
-
type index_CancelError = CancelError;
|
|
853
|
-
declare const index_CancelError: typeof CancelError;
|
|
854
|
-
type index_CancelablePromise<T> = CancelablePromise<T>;
|
|
855
|
-
declare const index_CancelablePromise: typeof CancelablePromise;
|
|
856
|
-
type index_CreationResult = CreationResult;
|
|
857
|
-
type index_DeviceInfo = DeviceInfo;
|
|
858
|
-
type index_JWT = JWT;
|
|
859
|
-
type index_LoginIDService = LoginIDService;
|
|
860
|
-
declare const index_LoginIDService: typeof LoginIDService;
|
|
861
|
-
declare const index_OpenAPI: typeof OpenAPI;
|
|
862
|
-
type index_OpenAPIConfig = OpenAPIConfig;
|
|
863
|
-
type index_Passkey = Passkey;
|
|
864
|
-
type index_PasskeyCollection = PasskeyCollection;
|
|
865
|
-
type index_PasskeyRenameRequestBody = PasskeyRenameRequestBody;
|
|
866
|
-
type index_PasskeysService = PasskeysService;
|
|
867
|
-
declare const index_PasskeysService: typeof PasskeysService;
|
|
868
|
-
type index_PubKeyCredentialDescriptor = PubKeyCredentialDescriptor;
|
|
869
|
-
type index_PublicKeyCredentialCreationOptions = PublicKeyCredentialCreationOptions;
|
|
870
|
-
type index_PublicKeyCredentialParameters = PublicKeyCredentialParameters;
|
|
871
|
-
type index_PublicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions;
|
|
872
|
-
type index_PublicKeyCredentialRpEntity = PublicKeyCredentialRpEntity;
|
|
873
|
-
type index_PublicKeyCredentialUserEntity = PublicKeyCredentialUserEntity;
|
|
874
|
-
type index_RegCompleteRequestBody = RegCompleteRequestBody;
|
|
875
|
-
type index_RegInit = RegInit;
|
|
876
|
-
type index_RegInitRequestBody = RegInitRequestBody;
|
|
877
|
-
type index_RegService = RegService;
|
|
878
|
-
declare const index_RegService: typeof RegService;
|
|
879
|
-
type index_TxComplete = TxComplete;
|
|
880
|
-
type index_TxCompleteRequestBody = TxCompleteRequestBody;
|
|
881
|
-
type index_TxInit = TxInit;
|
|
882
|
-
type index_TxInitRequestBody = TxInitRequestBody;
|
|
883
|
-
type index_TxService = TxService;
|
|
884
|
-
declare const index_TxService: typeof TxService;
|
|
885
|
-
type index_User = User;
|
|
886
|
-
type index_UserLogin = UserLogin;
|
|
887
|
-
declare namespace index {
|
|
888
|
-
export { type index_Aaguid as Aaguid, index_ApiError as ApiError, type index_AppError as AppError, type index_Application as Application, type index_AuthCode as AuthCode, type index_AuthCodeRequestSMSRequestBody as AuthCodeRequestSMSRequestBody, type index_AuthCodeVerifyRequestBody as AuthCodeVerifyRequestBody, type index_AuthCompleteRequestBody as AuthCompleteRequestBody, type index_AuthInit as AuthInit, type index_AuthInitRequestBody as AuthInitRequestBody, index_AuthService as AuthService, type index_AuthenticatorAssertionResponse as AuthenticatorAssertionResponse, type index_AuthenticatorSelectionCriteria as AuthenticatorSelectionCriteria, index_BaseHttpRequest as BaseHttpRequest, index_CancelError as CancelError, index_CancelablePromise as CancelablePromise, type index_CreationResult as CreationResult, type index_DeviceInfo as DeviceInfo, type index_JWT as JWT, index_LoginIDService as LoginIDService, index_OpenAPI as OpenAPI, type index_OpenAPIConfig as OpenAPIConfig, type index_Passkey as Passkey, type index_PasskeyCollection as PasskeyCollection, type PasskeyOptions$1 as PasskeyOptions, type index_PasskeyRenameRequestBody as PasskeyRenameRequestBody, index_PasskeysService as PasskeysService, type index_PubKeyCredentialDescriptor as PubKeyCredentialDescriptor, type index_PublicKeyCredentialCreationOptions as PublicKeyCredentialCreationOptions, type index_PublicKeyCredentialParameters as PublicKeyCredentialParameters, type index_PublicKeyCredentialRequestOptions as PublicKeyCredentialRequestOptions, type index_PublicKeyCredentialRpEntity as PublicKeyCredentialRpEntity, type index_PublicKeyCredentialUserEntity as PublicKeyCredentialUserEntity, type index_RegCompleteRequestBody as RegCompleteRequestBody, type index_RegInit as RegInit, type index_RegInitRequestBody as RegInitRequestBody, index_RegService as RegService, type index_TxComplete as TxComplete, type index_TxCompleteRequestBody as TxCompleteRequestBody, type index_TxInit as TxInit, type index_TxInitRequestBody as TxInitRequestBody, index_TxService as TxService, type index_User as User, type index_UserLogin as UserLogin };
|
|
1384
|
+
declare class LoginIDBase {
|
|
1385
|
+
/**
|
|
1386
|
+
* Holds the configuration settings for the LoginID integration, including API base URL.
|
|
1387
|
+
*/
|
|
1388
|
+
protected readonly config: LoginIDConfigValidator;
|
|
1389
|
+
/**
|
|
1390
|
+
* Instance of LoginIDService, providing access to the LoginID API methods.
|
|
1391
|
+
*/
|
|
1392
|
+
protected readonly service: LoginIDService;
|
|
1393
|
+
/**
|
|
1394
|
+
* Instance of SessionManager, providing access to the session management methods.
|
|
1395
|
+
*/
|
|
1396
|
+
readonly session: SessionManager;
|
|
1397
|
+
/**
|
|
1398
|
+
* Constructs a new instance of the LoginIDBase class, initializing the service with the provided configuration.
|
|
1399
|
+
* @param {LoginIDConfig} config Configuration object for LoginID API, including the base URL.
|
|
1400
|
+
*/
|
|
1401
|
+
constructor(config: LoginIDConfig);
|
|
889
1402
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1403
|
+
declare class Utils extends LoginIDBase {
|
|
1404
|
+
/**
|
|
1405
|
+
* Initializes a new Utils instance with the provided configuration.
|
|
1406
|
+
*
|
|
1407
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1408
|
+
*/
|
|
1409
|
+
constructor(config: LoginIDConfig);
|
|
1410
|
+
/**
|
|
1411
|
+
* Validates the application's configuration settings and provides a suggested correction if any issues are detected.
|
|
1412
|
+
*
|
|
1413
|
+
* @returns {Promise<VerifyConfigResult>} The result of the verification process.
|
|
1414
|
+
* @example
|
|
1415
|
+
* ```javascript
|
|
1416
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1417
|
+
*
|
|
1418
|
+
* // Obtain credentials from LoginID
|
|
1419
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1420
|
+
*
|
|
1421
|
+
* // Initialize the SDK with your configuration
|
|
1422
|
+
* const config = {
|
|
1423
|
+
* baseUrl: BASE_URL,
|
|
1424
|
+
* };
|
|
1425
|
+
*
|
|
1426
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1427
|
+
*
|
|
1428
|
+
* async function checkConfig() {
|
|
1429
|
+
* const result = await lid.verifyConfigSettings();
|
|
1430
|
+
*
|
|
1431
|
+
* if (result.isValid) {
|
|
1432
|
+
* console.log('Configuration is valid');
|
|
1433
|
+
* } else {
|
|
1434
|
+
* console.error(`Error: ${result.message} (Code: ${result.code})`);
|
|
1435
|
+
* console.info(`Solution: ${result.solution}`);
|
|
1436
|
+
* }
|
|
1437
|
+
* }
|
|
1438
|
+
*
|
|
1439
|
+
* checkConfig();
|
|
1440
|
+
*
|
|
1441
|
+
* // Attach the click handler to a button
|
|
1442
|
+
* const checkConfigButton = document.getElementById("button");
|
|
1443
|
+
* checkConfigButton.addEventListener("click", checkConfig);
|
|
1444
|
+
* ```
|
|
1445
|
+
*/
|
|
1446
|
+
verifyConfigSettings(): Promise<VerifyConfigResult>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Check whether the user of the current browser session is authenticated and returns user info.
|
|
1449
|
+
* This info is retrieved locally and no requests to backend are made.
|
|
1450
|
+
*
|
|
1451
|
+
* @returns {SessionInfo | null} The currently authenticated user's information, including username and id.
|
|
1452
|
+
* @example
|
|
1453
|
+
* ```javascript
|
|
1454
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1455
|
+
*
|
|
1456
|
+
* // Obtain credentials from LoginID
|
|
1457
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1458
|
+
*
|
|
1459
|
+
* // Initialize the SDK with your configuration
|
|
1460
|
+
* const config = {
|
|
1461
|
+
* baseUrl: BASE_URL,
|
|
1462
|
+
* };
|
|
1463
|
+
*
|
|
1464
|
+
* // Use the SDK components for signup and signin
|
|
1465
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1466
|
+
* const username = "billy@loginid.io";
|
|
1467
|
+
*
|
|
1468
|
+
* try {
|
|
1469
|
+
* // Retrieve session information
|
|
1470
|
+
* await lid.authenticateWithPasskey(username);
|
|
1471
|
+
* const sessionInfo = lid.getSessionInfo();
|
|
1472
|
+
* console.log("Session Information:", sessionInfo);
|
|
1473
|
+
* } catch (error) {
|
|
1474
|
+
* console.error("Error retrieving session information:", error);
|
|
1475
|
+
* }
|
|
1476
|
+
* ```
|
|
1477
|
+
*/
|
|
1478
|
+
getSessionInfo(): SessionInfo | null;
|
|
1479
|
+
/**
|
|
1480
|
+
* Clears current user session. This method is executed locally and it just deletes authorization token from local Cookies.
|
|
1481
|
+
*
|
|
1482
|
+
* @returns {boolean}
|
|
1483
|
+
* @example
|
|
1484
|
+
* ```javascript
|
|
1485
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1486
|
+
*
|
|
1487
|
+
* // Obtain credentials from LoginID
|
|
1488
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1489
|
+
*
|
|
1490
|
+
* // Initialize the SDK with your configuration
|
|
1491
|
+
* const config = {
|
|
1492
|
+
* baseUrl: BASE_URL,
|
|
1493
|
+
* };
|
|
1494
|
+
*
|
|
1495
|
+
* // Use the SDK components for signup and signin
|
|
1496
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1497
|
+
*
|
|
1498
|
+
* try {
|
|
1499
|
+
* // Retrieve user information
|
|
1500
|
+
* await lid.authenticateWithPasskey(username);
|
|
1501
|
+
* lid.logout();
|
|
1502
|
+
* const info = lid.getSessionInfo();
|
|
1503
|
+
* // false
|
|
1504
|
+
* console.log("Is user signed in?", info !== null);
|
|
1505
|
+
* } catch (error) {
|
|
1506
|
+
* console.error("Error:", error);
|
|
1507
|
+
* }
|
|
1508
|
+
* ```
|
|
1509
|
+
*/
|
|
1510
|
+
logout(): void;
|
|
1511
|
+
}
|
|
1512
|
+
declare class MFA extends LoginIDBase {
|
|
1513
|
+
/**
|
|
1514
|
+
* Initializes a new MFA instance with the provided configuration.
|
|
1515
|
+
*
|
|
1516
|
+
* @param {LoginIDMfaConfig} config Configuration object for LoginID services.
|
|
1517
|
+
*
|
|
1518
|
+
*/
|
|
1519
|
+
constructor(config: LoginIDMfaConfig);
|
|
1520
|
+
/**
|
|
1521
|
+
* Initiates the pre-authentication process for Multi-Factor Authentication (MFA).
|
|
1522
|
+
* This method begins an MFA session and stores session details in local storage.
|
|
1523
|
+
*
|
|
1524
|
+
* To proceed with the MFA flow, use the `performAction` method with the required
|
|
1525
|
+
* payload if necessary. To check the current MFA session status, use `getMfaSessionDetails`.
|
|
1526
|
+
*
|
|
1527
|
+
* @param {string} username - The username of the user initiating MFA.
|
|
1528
|
+
* @param {MfaBeginOptions} [options={}] - Optional parameters for initiating MFA.
|
|
1529
|
+
* @returns {Promise<MfaSessionResult>} - A promise resolving to the MFA session result.
|
|
1530
|
+
*/
|
|
1531
|
+
beginFlow(username: string, options?: MfaBeginOptions): Promise<MfaSessionResult>;
|
|
1532
|
+
/**
|
|
1533
|
+
* Performs a Multi-Factor Authentication (MFA) action using the specified factor.
|
|
1534
|
+
*
|
|
1535
|
+
* This method supports various MFA factors, including passkeys, OTP (email/SMS), and external authentication.
|
|
1536
|
+
* It validates the provided options, processes the authentication step, and invokes the corresponding MFA API.
|
|
1537
|
+
* The MFA session deatils is updated upon a successful factor completion.
|
|
1538
|
+
*
|
|
1539
|
+
* - **OTP Request (email/SMS):** Initiates an OTP request by sending an OTP to the user's contact information. If `options.payload` contains a contact, it will be used; otherwise, the primary contact on record is used.
|
|
1540
|
+
* - **OTP Verify (email/SMS):** Verifies the OTP code provided in `options.payload` by validating it against the expected value.
|
|
1541
|
+
* - **External authentication:** Provide the authorization code in `options.payload`.
|
|
1542
|
+
* - **Passkeys:** Uses WebAuthn for authentication or registration.
|
|
1543
|
+
*
|
|
1544
|
+
* @param {MfaFactorName} factorName - The MFA factor being performed (e.g., `"passkey"`, `"otp:email"`, `"otp:sms"`, `"external"`).
|
|
1545
|
+
* @param {MfaPerformActionOptions} [options={}] - The options containing session and payload data for the MFA factor.
|
|
1546
|
+
* @returns {Promise<MfaSessionResult>} - A promise resolving to the updated MFA session result.
|
|
1547
|
+
*/
|
|
1548
|
+
performAction(factorName: MfaFactorName, options?: MfaPerformActionOptions): Promise<MfaSessionResult>;
|
|
1549
|
+
/**
|
|
1550
|
+
* Retrieves the current Multi-Factor Authentication (MFA) session details.
|
|
1551
|
+
*
|
|
1552
|
+
* This method fetches the latest MFA session information from local storage and
|
|
1553
|
+
* includes any available authentication tokens. It provides the current status
|
|
1554
|
+
* of the MFA process, including remaining factors and completion state.
|
|
1555
|
+
*
|
|
1556
|
+
* @returns {MfaSessionResult} - The current MFA session details, including session status and tokens.
|
|
1557
|
+
*/
|
|
1558
|
+
getMfaSessionDetails(): MfaSessionResult;
|
|
1559
|
+
/**
|
|
1560
|
+
* Handles the execution of an MFA API request and updates the MFA session state.
|
|
1561
|
+
*
|
|
1562
|
+
* This internal method executes the provided MFA request function, updates local storage,
|
|
1563
|
+
* and sets authentication tokens. If the request results in an MFA challenge (401 error),
|
|
1564
|
+
* it processes the response and updates the session accordingly.
|
|
1565
|
+
*
|
|
1566
|
+
* @param {string} appId - The application ID associated with the MFA session.
|
|
1567
|
+
* @param {string} [username=""] - The username, if available.
|
|
1568
|
+
* @param {() => Promise<Mfa>} fn - A function that performs the MFA API request.
|
|
1569
|
+
* @returns {Promise<MfaSessionResult>} - The updated MFA session result.
|
|
1570
|
+
*/
|
|
1571
|
+
private invokeMfaApi;
|
|
1572
|
+
}
|
|
1573
|
+
export interface LoginIDMfa extends MFA, Utils {
|
|
1574
|
+
}
|
|
1575
|
+
export declare class LoginIDMfa extends LoginIDBase {
|
|
1576
|
+
constructor(config: LoginIDConfig);
|
|
1577
|
+
}
|
|
1578
|
+
type ApiResult = {
|
|
1579
|
+
readonly url: string;
|
|
1580
|
+
readonly ok: boolean;
|
|
1581
|
+
readonly status: number;
|
|
1582
|
+
readonly statusText: string;
|
|
1583
|
+
readonly body: any;
|
|
893
1584
|
};
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
interface Callbacks {
|
|
902
|
-
onFallback?: FallbackCallback;
|
|
903
|
-
onSuccess?: SuccessCallback;
|
|
1585
|
+
export declare class ApiError extends Error {
|
|
1586
|
+
readonly url: string;
|
|
1587
|
+
readonly status: number;
|
|
1588
|
+
readonly statusText: string;
|
|
1589
|
+
readonly body: any;
|
|
1590
|
+
readonly request: ApiRequestOptions;
|
|
1591
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
904
1592
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1593
|
+
export type Complete<T> = {
|
|
1594
|
+
[P in keyof T]-?: T[P];
|
|
1595
|
+
};
|
|
1596
|
+
export type DeviceInfoRequestBody = DeviceInfo;
|
|
1597
|
+
export type Transports = CreationResult["transports"];
|
|
1598
|
+
export type Message = "email" | "sms";
|
|
1599
|
+
export type FallbackOptions = string[];
|
|
1600
|
+
export type FallbackCallback = (username: string, options: FallbackOptions) => Promise<void>;
|
|
1601
|
+
export type SuccessCallback = (result: AuthResult) => Promise<void>;
|
|
1602
|
+
export interface Callbacks {
|
|
1603
|
+
onFallback?: FallbackCallback;
|
|
1604
|
+
onSuccess?: SuccessCallback;
|
|
910
1605
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
* The base URL for LoginID FIDO service which can be obtained on the [dashboard](https://dashboard.loginid.io).
|
|
917
|
-
*/
|
|
918
|
-
baseUrl: string;
|
|
919
|
-
/**
|
|
920
|
-
* The optional app ID for specific application.
|
|
921
|
-
*/
|
|
922
|
-
appId?: string;
|
|
1606
|
+
export interface AllOptions {
|
|
1607
|
+
authzToken?: string;
|
|
1608
|
+
usernameType?: UsernameType;
|
|
1609
|
+
displayName?: string;
|
|
1610
|
+
callbacks?: Callbacks;
|
|
923
1611
|
}
|
|
924
1612
|
/**
|
|
925
1613
|
* The base interface for passkey options.
|
|
926
1614
|
*/
|
|
927
|
-
interface
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1615
|
+
export interface MainPasskeyOptions {
|
|
1616
|
+
/**
|
|
1617
|
+
* Authorization token used for accessing protected resources typically used for adding multiple passkeys to a user.
|
|
1618
|
+
*/
|
|
1619
|
+
authzToken?: string;
|
|
1620
|
+
/**
|
|
1621
|
+
* Callback functions that can be triggered on various events during the authentication process.
|
|
1622
|
+
*/
|
|
1623
|
+
callbacks?: Callbacks;
|
|
1624
|
+
/**
|
|
1625
|
+
* The type of username validation to be used. Defaults to **`other`**.
|
|
1626
|
+
*/
|
|
1627
|
+
usernameType?: UsernameType;
|
|
940
1628
|
}
|
|
941
1629
|
/**
|
|
942
1630
|
* The base interface for passkey management options.
|
|
943
1631
|
*/
|
|
944
|
-
interface PasskeyManagementOptions {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1632
|
+
export interface PasskeyManagementOptions {
|
|
1633
|
+
/**
|
|
1634
|
+
* Authorization token used for authorizing passkey management actions.
|
|
1635
|
+
*/
|
|
1636
|
+
authzToken?: string;
|
|
949
1637
|
}
|
|
950
1638
|
/**
|
|
951
1639
|
* List passkeys options.
|
|
952
1640
|
*/
|
|
953
|
-
interface ListPasskeysOptions extends PasskeyManagementOptions {
|
|
1641
|
+
export interface ListPasskeysOptions extends PasskeyManagementOptions {
|
|
954
1642
|
}
|
|
955
1643
|
/**
|
|
956
1644
|
* Rename passkeys options.
|
|
957
1645
|
*/
|
|
958
|
-
interface RenamePasskeyOptions extends PasskeyManagementOptions {
|
|
1646
|
+
export interface RenamePasskeyOptions extends PasskeyManagementOptions {
|
|
959
1647
|
}
|
|
960
1648
|
/**
|
|
961
1649
|
* Delete passkeys options.
|
|
962
1650
|
*/
|
|
963
|
-
interface DeletePasskeyOptions extends PasskeyManagementOptions {
|
|
1651
|
+
export interface DeletePasskeyOptions extends PasskeyManagementOptions {
|
|
964
1652
|
}
|
|
965
1653
|
/**
|
|
966
1654
|
* Authenticate with passkeys options.
|
|
967
1655
|
*/
|
|
968
|
-
interface AuthenticateWithPasskeysOptions extends
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1656
|
+
export interface AuthenticateWithPasskeysOptions extends MainPasskeyOptions {
|
|
1657
|
+
/**
|
|
1658
|
+
* When true it will enable passkeys on the browser autofill suggestions if supported (conditional UI). Username does not need to be set.
|
|
1659
|
+
*/
|
|
1660
|
+
autoFill?: boolean;
|
|
1661
|
+
/**
|
|
1662
|
+
* This should be used with the **`options.autoFill`** option to trigger the cancellation of the passkey conditional UI.
|
|
1663
|
+
* Pass this if additional passkeys API calls may be anticipated on the current context page.
|
|
1664
|
+
*/
|
|
1665
|
+
abortController?: AbortController;
|
|
978
1666
|
}
|
|
979
1667
|
/**
|
|
980
1668
|
* Authenticate with passkey autofill options.
|
|
981
1669
|
*/
|
|
982
|
-
interface AuthenticateWithPasskeyAutofillOptions extends AuthenticateWithPasskeysOptions {
|
|
1670
|
+
export interface AuthenticateWithPasskeyAutofillOptions extends AuthenticateWithPasskeysOptions {
|
|
983
1671
|
}
|
|
984
1672
|
/**
|
|
985
1673
|
* Create passkeys options interface.
|
|
986
1674
|
*/
|
|
987
|
-
interface CreatePasskeyOptions extends
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1675
|
+
export interface CreatePasskeyOptions extends MainPasskeyOptions {
|
|
1676
|
+
/**
|
|
1677
|
+
* A human-palatable name for the user account, intended only for display on your passkeys and modals.
|
|
1678
|
+
*/
|
|
1679
|
+
displayName?: string;
|
|
992
1680
|
}
|
|
993
1681
|
/**
|
|
994
1682
|
* Confirm transaction options.
|
|
995
1683
|
*/
|
|
996
|
-
interface ConfirmTransactionOptions extends
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1684
|
+
export interface ConfirmTransactionOptions extends MainPasskeyOptions {
|
|
1685
|
+
/**
|
|
1686
|
+
* Specify the type of transaction being confirmed for additional validation.
|
|
1687
|
+
*/
|
|
1688
|
+
txType?: string;
|
|
1689
|
+
/**
|
|
1690
|
+
* A unique nonce to ensure the transaction's integrity and prevent replay attacks
|
|
1691
|
+
*/
|
|
1692
|
+
nonce?: string;
|
|
1005
1693
|
}
|
|
1006
1694
|
/**
|
|
1007
1695
|
* Request and send OTP options.
|
|
1008
1696
|
*/
|
|
1009
|
-
interface RequestAndSendOtpOptions {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1697
|
+
export interface RequestAndSendOtpOptions {
|
|
1698
|
+
/**
|
|
1699
|
+
* The type of username validation to be used. Defaults to **`other`**.
|
|
1700
|
+
*/
|
|
1701
|
+
usernameType?: UsernameType;
|
|
1014
1702
|
}
|
|
1015
1703
|
/**
|
|
1016
1704
|
* Request OTP options.
|
|
1017
1705
|
*/
|
|
1018
|
-
interface RequestOtpOptions extends AuthenticateWithPasskeyAutofillOptions {
|
|
1706
|
+
export interface RequestOtpOptions extends AuthenticateWithPasskeyAutofillOptions {
|
|
1019
1707
|
}
|
|
1020
1708
|
/**
|
|
1021
1709
|
* Validate OTP options.
|
|
1022
1710
|
*/
|
|
1023
|
-
interface ValidateOtpOptions extends RequestAndSendOtpOptions {
|
|
1711
|
+
export interface ValidateOtpOptions extends RequestAndSendOtpOptions {
|
|
1024
1712
|
}
|
|
1025
1713
|
/**
|
|
1026
1714
|
* The result after requesting an OTP with **`requestOtp`**.
|
|
1027
1715
|
*/
|
|
1028
|
-
interface Otp extends AuthCode {
|
|
1716
|
+
export interface Otp extends AuthCode {
|
|
1029
1717
|
}
|
|
1030
1718
|
/**
|
|
1031
1719
|
* The result after a successful authentication process either with passkeys or OTP.
|
|
1032
1720
|
*/
|
|
1033
|
-
interface AuthResult {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* General information about the current user session. Information is obtained from the stored authorization token.
|
|
1068
|
-
*/
|
|
1069
|
-
interface SessionInfo {
|
|
1070
|
-
/**
|
|
1071
|
-
* Current authenticated user's username.
|
|
1072
|
-
*/
|
|
1073
|
-
username: string;
|
|
1074
|
-
/**
|
|
1075
|
-
* Current authenticated user's ID.
|
|
1076
|
-
*/
|
|
1077
|
-
id: string;
|
|
1721
|
+
export interface AuthResult {
|
|
1722
|
+
/**
|
|
1723
|
+
* Indicates whether the user is authenticated. If **`false`**, a fallback options can be taken place if available on **`fallbackOptions`**.
|
|
1724
|
+
*/
|
|
1725
|
+
isAuthenticated: boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* A short-lived authorization token is returned, allowing access to protected resources for the given user such as listing, renaming or deleting passkeys.
|
|
1728
|
+
*/
|
|
1729
|
+
token: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* The unique identifier of the authenticated user.
|
|
1732
|
+
*/
|
|
1733
|
+
userId: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* The identifier for the passkey used in authentication, if applicable.
|
|
1736
|
+
*/
|
|
1737
|
+
passkeyId?: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* An identifier for the device used in the authentication process. This property helps determine if supported authentications can be proceeded,
|
|
1740
|
+
* allowing future authentications to identify the device correctly.
|
|
1741
|
+
*/
|
|
1742
|
+
deviceID?: string;
|
|
1743
|
+
/**
|
|
1744
|
+
* If **`true`**, the authentication process should resort to a fallback method as specified in **`fallbackOptions`**.
|
|
1745
|
+
*/
|
|
1746
|
+
isFallback: boolean;
|
|
1747
|
+
/**
|
|
1748
|
+
* This property will be returned if the LoginID indicates that the user is unlikely to proceed with passkey authentication.
|
|
1749
|
+
* In this case, instead of prompting for passkey authentication, available cross-authentication options are listed as an alternative,
|
|
1750
|
+
* providing suggested authentications to use instead.
|
|
1751
|
+
*/
|
|
1752
|
+
fallbackOptions?: FallbackOptions;
|
|
1078
1753
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
getAppId(): string;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* Provides a base class for integrating with the LoginID API services.
|
|
1212
|
-
* This class initializes the common configuration and service needed for derived classes to interact with LoginID services.
|
|
1213
|
-
*/
|
|
1214
|
-
declare class LoginIDBase {
|
|
1215
|
-
/**
|
|
1216
|
-
* Holds the configuration settings for the LoginID integration, including API base URL.
|
|
1217
|
-
*/
|
|
1218
|
-
protected readonly config: LoginIDConfigValidator;
|
|
1219
|
-
/**
|
|
1220
|
-
* Instance of LoginIDService, providing access to the LoginID API methods.
|
|
1221
|
-
*/
|
|
1222
|
-
protected readonly service: LoginIDService;
|
|
1223
|
-
/**
|
|
1224
|
-
* Instance of SessionManager, providing access to the session management methods.
|
|
1225
|
-
*/
|
|
1226
|
-
readonly session: SessionManager;
|
|
1227
|
-
/**
|
|
1228
|
-
* Constructs a new instance of the LoginIDBase class, initializing the service with the provided configuration.
|
|
1229
|
-
* @param {LoginIDConfig} config Configuration object for LoginID API, including the base URL.
|
|
1230
|
-
*/
|
|
1231
|
-
constructor(config: LoginIDConfig);
|
|
1754
|
+
declare class PasskeyManager extends LoginIDBase {
|
|
1755
|
+
/**
|
|
1756
|
+
* Initializes a new instance of PasskeyManager with the provided configuration.
|
|
1757
|
+
*
|
|
1758
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1759
|
+
*/
|
|
1760
|
+
constructor(config: LoginIDConfig);
|
|
1761
|
+
/**
|
|
1762
|
+
* This method returns list of passkeys associated with the current user. The user must be fully authorized for this call to succeed.
|
|
1763
|
+
*
|
|
1764
|
+
* @param {ListPasskeysOptions} options Additional options for listing passkeys.
|
|
1765
|
+
* @returns {Promise<PasskeyCollection>} A collection of passkeys.
|
|
1766
|
+
* @example
|
|
1767
|
+
* ```javascript
|
|
1768
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1769
|
+
*
|
|
1770
|
+
* // Obtain credentials from LoginID
|
|
1771
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1772
|
+
*
|
|
1773
|
+
* // Initialize the SDK with your configuration
|
|
1774
|
+
* const config = {
|
|
1775
|
+
* baseUrl: BASE_URL,
|
|
1776
|
+
* };
|
|
1777
|
+
*
|
|
1778
|
+
* // Use the SDK components for signup and signin
|
|
1779
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1780
|
+
*
|
|
1781
|
+
* // Button click handler for signing in
|
|
1782
|
+
* async function handleSigninButtonClick() {
|
|
1783
|
+
* const username = "billy@loginid.io";
|
|
1784
|
+
*
|
|
1785
|
+
* try {
|
|
1786
|
+
* // Sign in with a passkey
|
|
1787
|
+
* await lid.authenticateWithPasskey(username);
|
|
1788
|
+
*
|
|
1789
|
+
* // List all user credentials
|
|
1790
|
+
* const passkeys = await lid.listPasskeys();
|
|
1791
|
+
* // Handle the sign-in result
|
|
1792
|
+
* } catch (error) {
|
|
1793
|
+
* // Handle errors
|
|
1794
|
+
* console.error("Error during obtaining passkeys:", error);
|
|
1795
|
+
* }
|
|
1796
|
+
* }
|
|
1797
|
+
*
|
|
1798
|
+
* // Attach the click handler to a button
|
|
1799
|
+
* const signinButton = document.getElementById("signinButton");
|
|
1800
|
+
* signinButton.addEventListener("click", handleSigninButtonClick);
|
|
1801
|
+
* ```
|
|
1802
|
+
*/
|
|
1803
|
+
listPasskeys(options?: ListPasskeysOptions): Promise<PasskeyCollection>;
|
|
1804
|
+
/**
|
|
1805
|
+
* Renames a specified passkey by ID. The user must be fully authorized for this call to succeed.
|
|
1806
|
+
*
|
|
1807
|
+
* @param {string} id The ID of the passkey to rename.
|
|
1808
|
+
* @param {string} name The new name for the passkey.
|
|
1809
|
+
* @param {RenamePasskeyOptions} options Additional options for renaming the passkey.
|
|
1810
|
+
* @returns {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
1811
|
+
* @example
|
|
1812
|
+
* ```javascript
|
|
1813
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1814
|
+
*
|
|
1815
|
+
* // Obtain credentials from LoginID
|
|
1816
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1817
|
+
*
|
|
1818
|
+
* // Initialize the SDK with your configuration
|
|
1819
|
+
* const config = {
|
|
1820
|
+
* baseUrl: BASE_URL,
|
|
1821
|
+
* };
|
|
1822
|
+
*
|
|
1823
|
+
* // Use the SDK components for signup and signin
|
|
1824
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1825
|
+
*
|
|
1826
|
+
* const passkeyId = "abc123";
|
|
1827
|
+
* const newCredName = "New Passkey Credential Name";
|
|
1828
|
+
*
|
|
1829
|
+
* // Rename the passkey user credential
|
|
1830
|
+
* try {
|
|
1831
|
+
* // Signin with passkey
|
|
1832
|
+
* await lid.authenticateWithPasskey(username);
|
|
1833
|
+
*
|
|
1834
|
+
* // Find a way to retrieve passkey ID
|
|
1835
|
+
* await lid.renamePasskey(passkeyId, newCredName);
|
|
1836
|
+
* // Passkey credential successfully renamed
|
|
1837
|
+
* } catch (error) {
|
|
1838
|
+
* // Handle errors
|
|
1839
|
+
* console.error("Error during passkey credential renaming:", error);
|
|
1840
|
+
* }
|
|
1841
|
+
* ```
|
|
1842
|
+
*/
|
|
1843
|
+
renamePasskey(id: string, name: string, options?: RenamePasskeyOptions): Promise<void>;
|
|
1844
|
+
/**
|
|
1845
|
+
* Delete a specified passkey by ID from LoginID. The user must be fully authorized for this call to succeed.
|
|
1846
|
+
*
|
|
1847
|
+
* @param {string} id The ID of the passkey to delete.
|
|
1848
|
+
* @param {DeletePasskeyOptions} options Additional options for deleting the passkey.
|
|
1849
|
+
* @returns {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```javascript
|
|
1852
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1853
|
+
*
|
|
1854
|
+
* // Obtain credentials from LoginID
|
|
1855
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1856
|
+
*
|
|
1857
|
+
* // Initialize the SDK with your configuration
|
|
1858
|
+
* const config = {
|
|
1859
|
+
* baseUrl: BASE_URL,
|
|
1860
|
+
* };
|
|
1861
|
+
*
|
|
1862
|
+
* // Use the SDK components for signup and signin
|
|
1863
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1864
|
+
*
|
|
1865
|
+
* const passkeyId = "abc123";
|
|
1866
|
+
*
|
|
1867
|
+
* // Delete the passkey user credential
|
|
1868
|
+
* try {
|
|
1869
|
+
* // Signin with passkey
|
|
1870
|
+
* const signinResult = await lid.authenticateWithPasskey(username);
|
|
1871
|
+
*
|
|
1872
|
+
* // Find a way to retrieve passkey ID
|
|
1873
|
+
* await lid.deletePasskey(passkeyId);
|
|
1874
|
+
* // Passkey credential successfully deleted
|
|
1875
|
+
* } catch (error) {
|
|
1876
|
+
* // Handle errors
|
|
1877
|
+
* console.error("Error deleting passkey:", error);
|
|
1878
|
+
* }
|
|
1879
|
+
* ```
|
|
1880
|
+
*/
|
|
1881
|
+
deletePasskey(id: string, options?: DeletePasskeyOptions): Promise<void>;
|
|
1232
1882
|
}
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Extends LoginIDBase to support OTP methods.
|
|
1236
|
-
*/
|
|
1237
1883
|
declare class OTP extends LoginIDBase {
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1884
|
+
/**
|
|
1885
|
+
* Initializes a new instance of OTP with the provided configuration.
|
|
1886
|
+
*
|
|
1887
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1888
|
+
*/
|
|
1889
|
+
constructor(config: LoginIDConfig);
|
|
1890
|
+
/**
|
|
1891
|
+
* This method verifies the OTP and returns an authorization token, which can be used with the `passkeyCreate()`
|
|
1892
|
+
* method to create a new passkey. The authorization token has a short validity period and should be used immediately.
|
|
1893
|
+
*
|
|
1894
|
+
* @param {string} username Username to validate with.
|
|
1895
|
+
* @param {string} otp OTP to validate.
|
|
1896
|
+
* @param {ValidateOtpOptions} options Additional authentication options.
|
|
1897
|
+
* @returns {Promise<AuthResult>} Result of the authentication operation.
|
|
1898
|
+
* @example
|
|
1899
|
+
* ```javascript
|
|
1900
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1901
|
+
*
|
|
1902
|
+
* // Obtain credentials from LoginID
|
|
1903
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1904
|
+
*
|
|
1905
|
+
* // Initialize the SDK with your configuration
|
|
1906
|
+
* const config = {
|
|
1907
|
+
* baseUrl: BASE_URL,
|
|
1908
|
+
* };
|
|
1909
|
+
*
|
|
1910
|
+
* // Use the SDK components for signup and signin
|
|
1911
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1912
|
+
*
|
|
1913
|
+
* // Button click handler to generate a code with passkey
|
|
1914
|
+
* async function handleRequestOTPButtonClick() {
|
|
1915
|
+
* const username = "billy@loginid.io";
|
|
1916
|
+
*
|
|
1917
|
+
* try {
|
|
1918
|
+
* // Request OTP with passkey
|
|
1919
|
+
* const result = await lid.requestOtp(username);
|
|
1920
|
+
* // Extract the OTP from the response
|
|
1921
|
+
* const otp = result.code;
|
|
1922
|
+
*
|
|
1923
|
+
* // Authenticate with the OTP
|
|
1924
|
+
* // You can authenticate on another device with this OTP
|
|
1925
|
+
* const authenticateResult = await lid.validateOtp(username, otp);
|
|
1926
|
+
* // Handle the authentication result
|
|
1927
|
+
* console.log("Authentication Result:", authenticateResult);
|
|
1928
|
+
* } catch (error) {
|
|
1929
|
+
* // Handle errors
|
|
1930
|
+
* console.error("Error during authentication:", error);
|
|
1931
|
+
* }
|
|
1932
|
+
* }
|
|
1933
|
+
*
|
|
1934
|
+
* // Attach the click handler to a button
|
|
1935
|
+
* const requestOtpButton = document.getElementById("requestOtpButton");
|
|
1936
|
+
* requestOtpButton.addEventListener("click", handleRequestOTPButtonClick);
|
|
1937
|
+
* ```
|
|
1938
|
+
*/
|
|
1939
|
+
validateOtp(username: string, otp: string, options?: ValidateOtpOptions): Promise<AuthResult>;
|
|
1940
|
+
/**
|
|
1941
|
+
* This method requests an OTP from the backend to be sent via the selected method. The method of delivery should be based on
|
|
1942
|
+
* the user's choice from the list of available options. This can be found in the result of `authenticateWithPasskey`
|
|
1943
|
+
* method as `fallbackOptions`.
|
|
1944
|
+
*
|
|
1945
|
+
* @param {string} username Username to request and send the OTP to.
|
|
1946
|
+
* @param {Message} method Method to send the code, either 'email' or 'sms'. Default is 'email'.
|
|
1947
|
+
* @param {RequestAndSendOtpOptions} options Additional options for sending the OTP.
|
|
1948
|
+
* @returns {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
1949
|
+
* @example
|
|
1950
|
+
* ```javascript
|
|
1951
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1952
|
+
*
|
|
1953
|
+
* // Obtain credentials from LoginID
|
|
1954
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
1955
|
+
*
|
|
1956
|
+
* // Initialize the SDK with your configuration
|
|
1957
|
+
* const config = {
|
|
1958
|
+
* baseUrl: BASE_URL,
|
|
1959
|
+
* };
|
|
1960
|
+
*
|
|
1961
|
+
* // Use the SDK components for signup and signin
|
|
1962
|
+
* const lid = new LoginIDWebSDK(config);
|
|
1963
|
+
*
|
|
1964
|
+
* const username = "billy@loginid.io";
|
|
1965
|
+
*
|
|
1966
|
+
* async function sendUserOTPHandler() {
|
|
1967
|
+
* try {
|
|
1968
|
+
* // Send OTP to a user via email
|
|
1969
|
+
* await lid.requestAndSendOtp(username, "email");
|
|
1970
|
+
* console.log("OTP sent successfully.");
|
|
1971
|
+
* } catch (error) {
|
|
1972
|
+
* console.error("Error sending code:", error);
|
|
1973
|
+
* }
|
|
1974
|
+
* }
|
|
1975
|
+
*
|
|
1976
|
+
* const sendOtpButton = document.getElementById("button");
|
|
1977
|
+
* sendOtpButton.addEventListener("click", sendUserOTPHandler);
|
|
1978
|
+
* ```
|
|
1979
|
+
*/
|
|
1980
|
+
requestAndSendOtp(username: string, method?: Message, options?: RequestAndSendOtpOptions): Promise<void>;
|
|
1335
1981
|
}
|
|
1336
|
-
|
|
1337
|
-
declare class Utils extends LoginIDBase {
|
|
1338
|
-
/**
|
|
1339
|
-
* Initializes a new Utils instance with the provided configuration.
|
|
1340
|
-
*
|
|
1341
|
-
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1342
|
-
*/
|
|
1343
|
-
constructor(config: LoginIDConfig);
|
|
1344
|
-
/**
|
|
1345
|
-
* Validates the application's configuration settings and provides a suggested correction if any issues are detected.
|
|
1346
|
-
*
|
|
1347
|
-
* @returns {Promise<VerifyConfigResult>} The result of the verification process.
|
|
1348
|
-
* @example
|
|
1349
|
-
* ```javascript
|
|
1350
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1351
|
-
*
|
|
1352
|
-
* // Obtain credentials from LoginID
|
|
1353
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1354
|
-
*
|
|
1355
|
-
* // Initialize the SDK with your configuration
|
|
1356
|
-
* const config = {
|
|
1357
|
-
* baseUrl: BASE_URL,
|
|
1358
|
-
* };
|
|
1359
|
-
*
|
|
1360
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1361
|
-
*
|
|
1362
|
-
* async function checkConfig() {
|
|
1363
|
-
* const result = await lid.verifyConfigSettings();
|
|
1364
|
-
*
|
|
1365
|
-
* if (result.isValid) {
|
|
1366
|
-
* console.log('Configuration is valid');
|
|
1367
|
-
* } else {
|
|
1368
|
-
* console.error(`Error: ${result.message} (Code: ${result.code})`);
|
|
1369
|
-
* console.info(`Solution: ${result.solution}`);
|
|
1370
|
-
* }
|
|
1371
|
-
* }
|
|
1372
|
-
*
|
|
1373
|
-
* checkConfig();
|
|
1374
|
-
*
|
|
1375
|
-
* // Attach the click handler to a button
|
|
1376
|
-
* const checkConfigButton = document.getElementById("button");
|
|
1377
|
-
* checkConfigButton.addEventListener("click", checkConfig);
|
|
1378
|
-
* ```
|
|
1379
|
-
*/
|
|
1380
|
-
verifyConfigSettings(): Promise<VerifyConfigResult>;
|
|
1381
|
-
/**
|
|
1382
|
-
* Check whether the user of the current browser session is authenticated and returns user info.
|
|
1383
|
-
* This info is retrieved locally and no requests to backend are made.
|
|
1384
|
-
*
|
|
1385
|
-
* @returns {SessionInfo | null} The currently authenticated user's information, including username and id.
|
|
1386
|
-
* @example
|
|
1387
|
-
* ```javascript
|
|
1388
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1389
|
-
*
|
|
1390
|
-
* // Obtain credentials from LoginID
|
|
1391
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1392
|
-
*
|
|
1393
|
-
* // Initialize the SDK with your configuration
|
|
1394
|
-
* const config = {
|
|
1395
|
-
* baseUrl: BASE_URL,
|
|
1396
|
-
* };
|
|
1397
|
-
*
|
|
1398
|
-
* // Use the SDK components for signup and signin
|
|
1399
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1400
|
-
* const username = "billy@loginid.io";
|
|
1401
|
-
*
|
|
1402
|
-
* try {
|
|
1403
|
-
* // Retrieve session information
|
|
1404
|
-
* await lid.authenticateWithPasskey(username);
|
|
1405
|
-
* const sessionInfo = lid.getSessionInfo();
|
|
1406
|
-
* console.log("Session Information:", sessionInfo);
|
|
1407
|
-
* } catch (error) {
|
|
1408
|
-
* console.error("Error retrieving session information:", error);
|
|
1409
|
-
* }
|
|
1410
|
-
* ```
|
|
1411
|
-
*/
|
|
1412
|
-
getSessionInfo(): SessionInfo | null;
|
|
1413
|
-
/**
|
|
1414
|
-
* Clears current user session. This method is executed locally and it just deletes authorization token from local Cookies.
|
|
1415
|
-
*
|
|
1416
|
-
* @returns {boolean}
|
|
1417
|
-
* @example
|
|
1418
|
-
* ```javascript
|
|
1419
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1420
|
-
*
|
|
1421
|
-
* // Obtain credentials from LoginID
|
|
1422
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1423
|
-
*
|
|
1424
|
-
* // Initialize the SDK with your configuration
|
|
1425
|
-
* const config = {
|
|
1426
|
-
* baseUrl: BASE_URL,
|
|
1427
|
-
* };
|
|
1428
|
-
*
|
|
1429
|
-
* // Use the SDK components for signup and signin
|
|
1430
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1431
|
-
*
|
|
1432
|
-
* try {
|
|
1433
|
-
* // Retrieve user information
|
|
1434
|
-
* await lid.authenticateWithPasskey(username);
|
|
1435
|
-
* lid.logout();
|
|
1436
|
-
* const info = lid.getSessionInfo();
|
|
1437
|
-
* // false
|
|
1438
|
-
* console.log("Is user signed in?", info !== null);
|
|
1439
|
-
* } catch (error) {
|
|
1440
|
-
* console.error("Error:", error);
|
|
1441
|
-
* }
|
|
1442
|
-
* ```
|
|
1443
|
-
*/
|
|
1444
|
-
logout(): void;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
/**
|
|
1448
|
-
* Extends LoginIDBase to support creation and authentication of passkeys.
|
|
1449
|
-
*/
|
|
1450
1982
|
declare class Passkeys extends OTP {
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
* } catch (error) {
|
|
1699
|
-
* // Handle errors
|
|
1700
|
-
* console.error("Error during transaction confirmation:", error);
|
|
1701
|
-
* }
|
|
1702
|
-
* }
|
|
1703
|
-
*
|
|
1704
|
-
* // Attach the click handler to a button for transaction confirmation
|
|
1705
|
-
* const confirmTransactionButton = document.getElementById(
|
|
1706
|
-
* "confirmTransactionButton"
|
|
1707
|
-
* );
|
|
1708
|
-
* confirmTransactionButton.addEventListener(
|
|
1709
|
-
* "click",
|
|
1710
|
-
* handleTransactionConfirmation
|
|
1711
|
-
* );
|
|
1712
|
-
* ```
|
|
1713
|
-
*/
|
|
1714
|
-
confirmTransaction(username: string, txPayload: string, options?: ConfirmTransactionOptions): Promise<TxComplete>;
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
/**
|
|
1718
|
-
* Extends LoginIDBase to manage Passkeys, including listing, renaming, and deleting passkeys.
|
|
1719
|
-
*/
|
|
1720
|
-
declare class PasskeyManager extends LoginIDBase {
|
|
1721
|
-
/**
|
|
1722
|
-
* Initializes a new instance of PasskeyManager with the provided configuration.
|
|
1723
|
-
*
|
|
1724
|
-
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1725
|
-
*/
|
|
1726
|
-
constructor(config: LoginIDConfig);
|
|
1727
|
-
/**
|
|
1728
|
-
* This method returns list of passkeys associated with the current user. The user must be fully authorized for this call to succeed.
|
|
1729
|
-
*
|
|
1730
|
-
* @param {ListPasskeysOptions} options Additional options for listing passkeys.
|
|
1731
|
-
* @returns {Promise<PasskeyCollection>} A collection of passkeys.
|
|
1732
|
-
* @example
|
|
1733
|
-
* ```javascript
|
|
1734
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1735
|
-
*
|
|
1736
|
-
* // Obtain credentials from LoginID
|
|
1737
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1738
|
-
*
|
|
1739
|
-
* // Initialize the SDK with your configuration
|
|
1740
|
-
* const config = {
|
|
1741
|
-
* baseUrl: BASE_URL,
|
|
1742
|
-
* };
|
|
1743
|
-
*
|
|
1744
|
-
* // Use the SDK components for signup and signin
|
|
1745
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1746
|
-
*
|
|
1747
|
-
* // Button click handler for signing in
|
|
1748
|
-
* async function handleSigninButtonClick() {
|
|
1749
|
-
* const username = "billy@loginid.io";
|
|
1750
|
-
*
|
|
1751
|
-
* try {
|
|
1752
|
-
* // Sign in with a passkey
|
|
1753
|
-
* await lid.authenticateWithPasskey(username);
|
|
1754
|
-
*
|
|
1755
|
-
* // List all user credentials
|
|
1756
|
-
* const passkeys = await lid.listPasskeys();
|
|
1757
|
-
* // Handle the sign-in result
|
|
1758
|
-
* } catch (error) {
|
|
1759
|
-
* // Handle errors
|
|
1760
|
-
* console.error("Error during obtaining passkeys:", error);
|
|
1761
|
-
* }
|
|
1762
|
-
* }
|
|
1763
|
-
*
|
|
1764
|
-
* // Attach the click handler to a button
|
|
1765
|
-
* const signinButton = document.getElementById("signinButton");
|
|
1766
|
-
* signinButton.addEventListener("click", handleSigninButtonClick);
|
|
1767
|
-
* ```
|
|
1768
|
-
*/
|
|
1769
|
-
listPasskeys(options?: ListPasskeysOptions): Promise<PasskeyCollection>;
|
|
1770
|
-
/**
|
|
1771
|
-
* Renames a specified passkey by ID. The user must be fully authorized for this call to succeed.
|
|
1772
|
-
*
|
|
1773
|
-
* @param {string} id The ID of the passkey to rename.
|
|
1774
|
-
* @param {string} name The new name for the passkey.
|
|
1775
|
-
* @param {RenamePasskeyOptions} options Additional options for renaming the passkey.
|
|
1776
|
-
* @returns {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
1777
|
-
* @example
|
|
1778
|
-
* ```javascript
|
|
1779
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1780
|
-
*
|
|
1781
|
-
* // Obtain credentials from LoginID
|
|
1782
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1783
|
-
*
|
|
1784
|
-
* // Initialize the SDK with your configuration
|
|
1785
|
-
* const config = {
|
|
1786
|
-
* baseUrl: BASE_URL,
|
|
1787
|
-
* };
|
|
1788
|
-
*
|
|
1789
|
-
* // Use the SDK components for signup and signin
|
|
1790
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1791
|
-
*
|
|
1792
|
-
* const passkeyId = "abc123";
|
|
1793
|
-
* const newCredName = "New Passkey Credential Name";
|
|
1794
|
-
*
|
|
1795
|
-
* // Rename the passkey user credential
|
|
1796
|
-
* try {
|
|
1797
|
-
* // Signin with passkey
|
|
1798
|
-
* await lid.authenticateWithPasskey(username);
|
|
1799
|
-
*
|
|
1800
|
-
* // Find a way to retrieve passkey ID
|
|
1801
|
-
* await lid.renamePasskey(passkeyId, newCredName);
|
|
1802
|
-
* // Passkey credential successfully renamed
|
|
1803
|
-
* } catch (error) {
|
|
1804
|
-
* // Handle errors
|
|
1805
|
-
* console.error("Error during passkey credential renaming:", error);
|
|
1806
|
-
* }
|
|
1807
|
-
* ```
|
|
1808
|
-
*/
|
|
1809
|
-
renamePasskey(id: string, name: string, options?: RenamePasskeyOptions): Promise<void>;
|
|
1810
|
-
/**
|
|
1811
|
-
* Delete a specified passkey by ID from LoginID. The user must be fully authorized for this call to succeed.
|
|
1812
|
-
*
|
|
1813
|
-
* @param {string} id The ID of the passkey to delete.
|
|
1814
|
-
* @param {DeletePasskeyOptions} options Additional options for deleting the passkey.
|
|
1815
|
-
* @returns {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
1816
|
-
* @example
|
|
1817
|
-
* ```javascript
|
|
1818
|
-
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
1819
|
-
*
|
|
1820
|
-
* // Obtain credentials from LoginID
|
|
1821
|
-
* const BASE_URL = process.env.BASE_URL;
|
|
1822
|
-
*
|
|
1823
|
-
* // Initialize the SDK with your configuration
|
|
1824
|
-
* const config = {
|
|
1825
|
-
* baseUrl: BASE_URL,
|
|
1826
|
-
* };
|
|
1827
|
-
*
|
|
1828
|
-
* // Use the SDK components for signup and signin
|
|
1829
|
-
* const lid = new LoginIDWebSDK(config);
|
|
1830
|
-
*
|
|
1831
|
-
* const passkeyId = "abc123";
|
|
1832
|
-
*
|
|
1833
|
-
* // Delete the passkey user credential
|
|
1834
|
-
* try {
|
|
1835
|
-
* // Signin with passkey
|
|
1836
|
-
* const signinResult = await lid.authenticateWithPasskey(username);
|
|
1837
|
-
*
|
|
1838
|
-
* // Find a way to retrieve passkey ID
|
|
1839
|
-
* await lid.deletePasskey(passkeyId);
|
|
1840
|
-
* // Passkey credential successfully deleted
|
|
1841
|
-
* } catch (error) {
|
|
1842
|
-
* // Handle errors
|
|
1843
|
-
* console.error("Error deleting passkey:", error);
|
|
1844
|
-
* }
|
|
1845
|
-
* ```
|
|
1846
|
-
*/
|
|
1847
|
-
deletePasskey(id: string, options?: DeletePasskeyOptions): Promise<void>;
|
|
1983
|
+
/**
|
|
1984
|
+
* Initializes a new Passkeys instance with the provided configuration.
|
|
1985
|
+
*
|
|
1986
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
1987
|
+
*
|
|
1988
|
+
*/
|
|
1989
|
+
constructor(config: LoginIDConfig);
|
|
1990
|
+
/**
|
|
1991
|
+
* This method helps to create a passkey. The only required parameter is the username, but additional attributes can be provided in the options parameter.
|
|
1992
|
+
* Note: While the authorization token is optional, it must always be used in a production environment. You can skip it during development by adjusting
|
|
1993
|
+
* the app configuration in the LoginID dashboard.
|
|
1994
|
+
*
|
|
1995
|
+
* A short-lived authorization token is returned, allowing access to protected resources for the given user such as listing, renaming or deleting passkeys.
|
|
1996
|
+
*
|
|
1997
|
+
* @param {string} username Username to register.
|
|
1998
|
+
* @param {string} authzToken Authorization token for passkey creation.
|
|
1999
|
+
* @param {CreatePasskeyOptions} options Additional passkey creation options.
|
|
2000
|
+
* @returns {Promise<AuthResult>} Result of the passkey creation operation.
|
|
2001
|
+
* @example
|
|
2002
|
+
* ```javascript
|
|
2003
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
2004
|
+
*
|
|
2005
|
+
* // Obtain credentials from LoginID
|
|
2006
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
2007
|
+
*
|
|
2008
|
+
* // Initialize the SDK with your configuration
|
|
2009
|
+
* const config = {
|
|
2010
|
+
* baseUrl: BASE_URL,
|
|
2011
|
+
* };
|
|
2012
|
+
*
|
|
2013
|
+
* // Use the SDK components for signup and signin
|
|
2014
|
+
* const lid = new LoginIDWebSDK(config);
|
|
2015
|
+
*
|
|
2016
|
+
* // Button click handler
|
|
2017
|
+
* async function handleSignupButtonClick() {
|
|
2018
|
+
* const username = "billy@loginid.io";
|
|
2019
|
+
*
|
|
2020
|
+
* try {
|
|
2021
|
+
* // Sign up with a passkey
|
|
2022
|
+
* const signupResult = await lid.createPasskey(username);
|
|
2023
|
+
* // Handle the signup result
|
|
2024
|
+
* console.log("Signup Result:", signupResult);
|
|
2025
|
+
* } catch (error) {
|
|
2026
|
+
* // Handle errors
|
|
2027
|
+
* console.error("Error during signup:", error);
|
|
2028
|
+
* }
|
|
2029
|
+
* }
|
|
2030
|
+
*
|
|
2031
|
+
* // Attach the click handler to a button
|
|
2032
|
+
* const signinButton = document.getElementById("signinButton");
|
|
2033
|
+
* signinButton.addEventListener("click", handleSigninButtonClick);
|
|
2034
|
+
* ```
|
|
2035
|
+
*/
|
|
2036
|
+
createPasskey(username: string, authzToken?: string, options?: CreatePasskeyOptions): Promise<AuthResult>;
|
|
2037
|
+
/**
|
|
2038
|
+
* This method authenticates a user with a passkey and may trigger additional browser dialogs to guide the user through the process.
|
|
2039
|
+
*
|
|
2040
|
+
* A short-lived authorization token is returned, allowing access to protected resources for the given user such as listing, renaming or deleting passkeys.
|
|
2041
|
+
*
|
|
2042
|
+
* @param {string} username Username to authenticate. When empty, usernameless passkey authentication is performed.
|
|
2043
|
+
* @param {AuthenticateWithPasskeysOptions} options Additional authentication options.
|
|
2044
|
+
* @returns {Promise<AuthResult>} Result of the passkey authentication operation.
|
|
2045
|
+
* @example
|
|
2046
|
+
* ```javascript
|
|
2047
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
2048
|
+
*
|
|
2049
|
+
* // Obtain credentials from LoginID
|
|
2050
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
2051
|
+
*
|
|
2052
|
+
* // Initialize the SDK with your configuration
|
|
2053
|
+
* const config = {
|
|
2054
|
+
* baseUrl: BASE_URL,
|
|
2055
|
+
* };
|
|
2056
|
+
*
|
|
2057
|
+
* // Use the SDK components for signup and signin
|
|
2058
|
+
* const lid = new LoginIDWebSDK(config);
|
|
2059
|
+
*
|
|
2060
|
+
* // Button click handler
|
|
2061
|
+
* async function handleSignupButtonClick() {
|
|
2062
|
+
* const username = "billy@loginid.io";
|
|
2063
|
+
*
|
|
2064
|
+
* try {
|
|
2065
|
+
* // Sign in with a passkey
|
|
2066
|
+
* const signinResult = await lid.authenticateWithPasskey(username);
|
|
2067
|
+
* // Handle the signin result
|
|
2068
|
+
* console.log("Signin Result:", signinResult);
|
|
2069
|
+
* } catch (error) {
|
|
2070
|
+
* // Handle errors
|
|
2071
|
+
* console.error("Error during signin:", error);
|
|
2072
|
+
* }
|
|
2073
|
+
* }
|
|
2074
|
+
*
|
|
2075
|
+
* // Attach the click handler to a button
|
|
2076
|
+
* const signinButton = document.getElementById("signinButton");
|
|
2077
|
+
* signinButton.addEventListener("click", handleSigninButtonClick);
|
|
2078
|
+
* ```
|
|
2079
|
+
*/
|
|
2080
|
+
authenticateWithPasskey(username?: string, options?: AuthenticateWithPasskeysOptions): Promise<AuthResult>;
|
|
2081
|
+
/**
|
|
2082
|
+
* Authenticates a user by utilizing the browser's passkey autofill capabilities.
|
|
2083
|
+
*
|
|
2084
|
+
* A short-lived authorization token is returned, allowing access to protected resources for the given user such as listing, renaming or deleting passkeys.
|
|
2085
|
+
*
|
|
2086
|
+
* @param {AuthenticateWithPasskeyAutofillOptions} options Additional authentication options.
|
|
2087
|
+
* @returns {Promise<AuthResult>} Result of the passkey authentication operation.
|
|
2088
|
+
* @example
|
|
2089
|
+
* * import { isConditionalUIAvailable, LoginIDWebSDK } from "@loginid/websdk3";
|
|
2090
|
+
*
|
|
2091
|
+
* // Obtain credentials from LoginID
|
|
2092
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
2093
|
+
*
|
|
2094
|
+
* // Initialize the SDK with your configuration
|
|
2095
|
+
* const config = {
|
|
2096
|
+
* baseUrl: BASE_URL,
|
|
2097
|
+
* };
|
|
2098
|
+
*
|
|
2099
|
+
* // Use the SDK components for signup and signin
|
|
2100
|
+
* const lid = new LoginIDWebSDK(config);
|
|
2101
|
+
*
|
|
2102
|
+
* window.addEventListener("load", async (event) => {
|
|
2103
|
+
* try {
|
|
2104
|
+
* const result = await isConditionalUIAvailable();
|
|
2105
|
+
* if (!result) {
|
|
2106
|
+
* // If conditional UI is not supported then continue without it or handle what to do
|
|
2107
|
+
* // next here.
|
|
2108
|
+
* return;
|
|
2109
|
+
* }
|
|
2110
|
+
*
|
|
2111
|
+
* const result = await lid.authenticateWithPasskeyAutofill();
|
|
2112
|
+
* console.log("Authentication Result:", result);
|
|
2113
|
+
* } catch (error) {
|
|
2114
|
+
* // Handle errors
|
|
2115
|
+
* console.error("Error during authentication:", error);
|
|
2116
|
+
* }
|
|
2117
|
+
* });
|
|
2118
|
+
*/
|
|
2119
|
+
authenticateWithPasskeyAutofill(options?: AuthenticateWithPasskeyAutofillOptions): Promise<AuthResult>;
|
|
2120
|
+
/**
|
|
2121
|
+
* This method returns a one-time OTP to be displayed on the current device. The user must be authenticated on this device.
|
|
2122
|
+
* The OTP is meant for cross-authentication, where the user reads the OTP from the screen and enters it on the target device.
|
|
2123
|
+
*
|
|
2124
|
+
* @param {string} username The username used for passkey authentication and OTP request.
|
|
2125
|
+
* @param {RequestOtpOptions} options Additional request OTP options.
|
|
2126
|
+
* @returns {Promise<Otp>} Result of the request OTP operation returning an OTP and expiry time.
|
|
2127
|
+
* @example
|
|
2128
|
+
* ```javascript
|
|
2129
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
2130
|
+
*
|
|
2131
|
+
* // Obtain credentials from LoginID
|
|
2132
|
+
* const BASE_URL = process.env.BASE_URL;
|
|
2133
|
+
*
|
|
2134
|
+
* // Initialize the SDK with your configuration
|
|
2135
|
+
* const config = {
|
|
2136
|
+
* baseUrl: BASE_URL,
|
|
2137
|
+
* };
|
|
2138
|
+
*
|
|
2139
|
+
* // Use the SDK components for signup and signin
|
|
2140
|
+
* const lid = new LoginIDWebSDK(config);
|
|
2141
|
+
*
|
|
2142
|
+
* // Button click handler
|
|
2143
|
+
* async function handleRequestOTPButtonClick() {
|
|
2144
|
+
* const username = "billy@loginid.io";
|
|
2145
|
+
*
|
|
2146
|
+
* try {
|
|
2147
|
+
* // Request OTP with passkey
|
|
2148
|
+
* const result = await lid.requestOtp(username);
|
|
2149
|
+
* const otp = result.code;
|
|
2150
|
+
* console.log("The OTP is: ", otp);
|
|
2151
|
+
* } catch (error) {
|
|
2152
|
+
* // Handle errors
|
|
2153
|
+
* console.error("Error during authentication:", error);
|
|
2154
|
+
* }
|
|
2155
|
+
* }
|
|
2156
|
+
*
|
|
2157
|
+
* // Attach the click handler to a button
|
|
2158
|
+
* const requestOTPButton = document.getElementById("requestOTPButton");
|
|
2159
|
+
* requestOTPButton.addEventListener("click", handleRequestOTPButtonClick);
|
|
2160
|
+
* ```
|
|
2161
|
+
*/
|
|
2162
|
+
requestOtp(username: string, options?: RequestOtpOptions): Promise<Otp>;
|
|
2163
|
+
/**
|
|
2164
|
+
* This method initiates a non-repudiation signature process by generating a transaction-specific challenge
|
|
2165
|
+
* and then expects the client to provide an assertion response using a passkey.
|
|
2166
|
+
*
|
|
2167
|
+
* This method is useful for confirming actions such as payments
|
|
2168
|
+
* or changes to sensitive account information, ensuring that the transaction is being authorized
|
|
2169
|
+
* by the rightful owner of the passkey.
|
|
2170
|
+
*
|
|
2171
|
+
* For a more detailed guide click [here](https://docs.loginid.io/scenarios/transaction-confirmation).
|
|
2172
|
+
*
|
|
2173
|
+
* @param {string} username The username of the user confirming the transaction.
|
|
2174
|
+
* @param {string} txPayload The transaction-specific payload, which could include details
|
|
2175
|
+
* such as the transaction amount, recipient, and other metadata necessary for the transaction.
|
|
2176
|
+
* @param {ConfirmTransactionOptions} options Optional parameters for transaction confirmation.
|
|
2177
|
+
* @returns {Promise<TxComplete>} A promise that resolves with the result of the transaction confirmation operation.
|
|
2178
|
+
* The result includes details about the transaction's details and includes a new JWT access token.
|
|
2179
|
+
* @example
|
|
2180
|
+
* ```javascript
|
|
2181
|
+
* import { LoginIDWebSDK } from "@loginid/websdk3";
|
|
2182
|
+
*
|
|
2183
|
+
* const config = {
|
|
2184
|
+
* baseUrl: BASE_URL,
|
|
2185
|
+
* };
|
|
2186
|
+
*
|
|
2187
|
+
* const lid = new LoginIDWebSDK(config);
|
|
2188
|
+
*
|
|
2189
|
+
* const username = "jane@securelogin.com";
|
|
2190
|
+
* const txPayload = JSON.stringify({
|
|
2191
|
+
* amount: 100,
|
|
2192
|
+
* recipient: "bob@securepay.com",
|
|
2193
|
+
* });
|
|
2194
|
+
* // Unique transaction nonce
|
|
2195
|
+
* const nonce = "f846bb01-492e-422b-944a-44b04adc441e";
|
|
2196
|
+
*
|
|
2197
|
+
* async function handleTransactionConfirmation() {
|
|
2198
|
+
* try {
|
|
2199
|
+
* // Confirm the transaction
|
|
2200
|
+
* const confirmationResult = await lid.confirmTransaction(
|
|
2201
|
+
* username,
|
|
2202
|
+
* txPayload,
|
|
2203
|
+
* nonce
|
|
2204
|
+
* );
|
|
2205
|
+
* // Handle the transaction confirmation result
|
|
2206
|
+
* console.log("Transaction Confirmation Result:", confirmationResult);
|
|
2207
|
+
*
|
|
2208
|
+
* // Check nonce
|
|
2209
|
+
* const { nonce: resultNonce } = confirmationResult;
|
|
2210
|
+
* if (nonce !== resultNonce) {
|
|
2211
|
+
* throw new Error("Nonce mismatch");
|
|
2212
|
+
* }
|
|
2213
|
+
* } catch (error) {
|
|
2214
|
+
* // Handle errors
|
|
2215
|
+
* console.error("Error during transaction confirmation:", error);
|
|
2216
|
+
* }
|
|
2217
|
+
* }
|
|
2218
|
+
*
|
|
2219
|
+
* // Attach the click handler to a button for transaction confirmation
|
|
2220
|
+
* const confirmTransactionButton = document.getElementById(
|
|
2221
|
+
* "confirmTransactionButton"
|
|
2222
|
+
* );
|
|
2223
|
+
* confirmTransactionButton.addEventListener(
|
|
2224
|
+
* "click",
|
|
2225
|
+
* handleTransactionConfirmation
|
|
2226
|
+
* );
|
|
2227
|
+
* ```
|
|
2228
|
+
*/
|
|
2229
|
+
confirmTransaction(username: string, txPayload: string, options?: ConfirmTransactionOptions): Promise<TxComplete>;
|
|
1848
2230
|
}
|
|
1849
|
-
|
|
1850
|
-
interface LoginIDWebSDK extends Passkeys, OTP, PasskeyManager, Utils {
|
|
2231
|
+
export interface LoginIDWebSDK extends Passkeys, OTP, PasskeyManager, Utils {
|
|
1851
2232
|
}
|
|
1852
|
-
declare class LoginIDWebSDK extends LoginIDBase {
|
|
1853
|
-
|
|
2233
|
+
export declare class LoginIDWebSDK extends LoginIDBase {
|
|
2234
|
+
constructor(config: LoginIDConfig);
|
|
1854
2235
|
}
|
|
1855
2236
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
declare class AbortError extends Error {
|
|
1860
|
-
/**
|
|
1861
|
-
* Initializes a new instance of AbortError with the provided message.
|
|
1862
|
-
*
|
|
1863
|
-
* @type {Error}
|
|
1864
|
-
* @memberof AbortError
|
|
1865
|
-
*/
|
|
1866
|
-
constructor(message: string);
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
type PasskeyErrorCode = 'ERROR_PASSKEY_ABORTED' | 'ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED' | 'ERROR_USER_VERIFICATION_UNSUPPORTED' | 'ERROR_PASSKEY_EXISTS' | 'ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD' | 'ERROR_ALGORITHMS_UNSUPPORTED' | 'ERROR_DOMAIN_MISMATCH' | 'ERROR_AUTHENTICATOR_UNKNOWN_ERROR';
|
|
1870
|
-
|
|
1871
|
-
/**
|
|
1872
|
-
* Error class for passkey-related errors.
|
|
1873
|
-
*/
|
|
1874
|
-
declare class PasskeyError extends Error {
|
|
1875
|
-
readonly code: PasskeyErrorCode;
|
|
1876
|
-
/**
|
|
1877
|
-
* Initializes a new instance of PasskeyError with the provided message, code, and original error.
|
|
1878
|
-
*
|
|
1879
|
-
* @type {Error}
|
|
1880
|
-
* @memberof PasskeyError
|
|
1881
|
-
*/
|
|
1882
|
-
constructor(message: string, code: PasskeyErrorCode, originalError: Error);
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
declare class WebAuthnHelper {
|
|
1886
|
-
/**
|
|
1887
|
-
* Retrieves a navigator credential for authentication.
|
|
1888
|
-
* @param {AuthInit} authInitResponseBody The response body from authentication initialization.
|
|
1889
|
-
* @param {AuthenticateWithPasskeysOptions} options Additional options for authentication.
|
|
1890
|
-
* @returns {Promise<AuthAuthCompleteRequestBody>} Completion request body for authentication.
|
|
1891
|
-
*/
|
|
1892
|
-
static getNavigatorCredential(authInitResponseBody: AuthInit, options?: AuthenticateWithPasskeysOptions): Promise<AuthCompleteRequestBody>;
|
|
1893
|
-
/**
|
|
1894
|
-
* Creates a navigator credential using WebAuthn.
|
|
1895
|
-
* @param {RegInit} regInitResponseBody The response body from registration initialization.
|
|
1896
|
-
* @returns {Promise<RegRegCompleteRequestBody>} Completion request body for registration.
|
|
1897
|
-
*/
|
|
1898
|
-
static createNavigatorCredential(regInitResponseBody: RegInit): Promise<RegCompleteRequestBody>;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
* Asynchronously creates a passkey credential using the provided registration response.
|
|
1903
|
-
*
|
|
1904
|
-
* @param {IRegisterPasskeyInitResponse} init - The registration initiation response.
|
|
1905
|
-
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
1906
|
-
* @throws {LoginIdError} If any errors occur during credential creation or if the credential type is invalid.
|
|
1907
|
-
*/
|
|
1908
|
-
declare const createPasskeyCredential: (init: PublicKeyCredentialCreationOptions) => Promise<PublicKeyCredential>;
|
|
1909
|
-
/**
|
|
1910
|
-
* Asynchronously retrieves a passkey credential for authentication using the provided request options.
|
|
1911
|
-
*
|
|
1912
|
-
* @param {publicKeyCredentialRequestOptionsResponseBody} init - The authentication initiation response.
|
|
1913
|
-
* @param {AuthenticateWithPasskeysOptions} options - Additional options for the authentication request.
|
|
1914
|
-
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
1915
|
-
*/
|
|
1916
|
-
declare const getPasskeyCredential: (init: PublicKeyCredentialRequestOptions, options?: AuthenticateWithPasskeysOptions) => Promise<PublicKeyCredential>;
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* Checks if platform authenticator available
|
|
1920
|
-
* */
|
|
1921
|
-
declare function isPlatformAuthenticatorAvailable(): Promise<boolean>;
|
|
1922
|
-
/**
|
|
1923
|
-
* Checks if conditional UI is available
|
|
1924
|
-
* */
|
|
1925
|
-
declare function isConditionalUIAvailable(): Promise<boolean>;
|
|
2237
|
+
export {
|
|
2238
|
+
LoginIDWebSDK as default,
|
|
2239
|
+
};
|
|
1926
2240
|
|
|
1927
|
-
export {
|
|
2241
|
+
export {};
|