@loginid/websdk3 1.0.0 → 1.0.1
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/dist/index.cjs +2 -0
- package/dist/index.d.cts +777 -0
- package/dist/index.d.ts +777 -0
- package/dist/index.js +2 -0
- package/package.json +2 -3
- package/CHANGELOG.md +0 -9
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
type ApiRequestOptions = {
|
|
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
|
+
};
|
|
14
|
+
|
|
15
|
+
interface OnCancel {
|
|
16
|
+
readonly isResolved: boolean;
|
|
17
|
+
readonly isRejected: boolean;
|
|
18
|
+
readonly isCancelled: boolean;
|
|
19
|
+
(cancelHandler: () => void): void;
|
|
20
|
+
}
|
|
21
|
+
declare class CancelablePromise<T> implements Promise<T> {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
24
|
+
get [Symbol.toStringTag](): string;
|
|
25
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
26
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
27
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
28
|
+
cancel(): void;
|
|
29
|
+
get isCancelled(): boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
33
|
+
type Headers = Record<string, string>;
|
|
34
|
+
type OpenAPIConfig = {
|
|
35
|
+
BASE: string;
|
|
36
|
+
VERSION: string;
|
|
37
|
+
WITH_CREDENTIALS: boolean;
|
|
38
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
39
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
40
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
41
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
42
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
43
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare abstract class BaseHttpRequest {
|
|
47
|
+
readonly config: OpenAPIConfig;
|
|
48
|
+
constructor(config: OpenAPIConfig);
|
|
49
|
+
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type authenticatorAssertionResponseRequestBody = {
|
|
53
|
+
/**
|
|
54
|
+
* This attribute contains the authenticator data returned by the authenticator.
|
|
55
|
+
*/
|
|
56
|
+
authenticatorData: string;
|
|
57
|
+
/**
|
|
58
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
59
|
+
* passed to the authenticator by the client in order to generate this assertion.
|
|
60
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
61
|
+
* client data has been computed over it.
|
|
62
|
+
*/
|
|
63
|
+
clientDataJSON: string;
|
|
64
|
+
/**
|
|
65
|
+
* A base64 encoded byte sequence identifying a public key credential
|
|
66
|
+
* source and its authentication assertions.
|
|
67
|
+
*/
|
|
68
|
+
credentialId: string;
|
|
69
|
+
/**
|
|
70
|
+
* Base64 encoded the raw signature returned from the authenticator.
|
|
71
|
+
*/
|
|
72
|
+
signature: string;
|
|
73
|
+
/**
|
|
74
|
+
* User handle returned from the authenticator, or null if the authenticator did not return a user handle.
|
|
75
|
+
*/
|
|
76
|
+
userHandle?: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
type AuthAuthCompleteRequestBody = {
|
|
80
|
+
assertionResult: authenticatorAssertionResponseRequestBody;
|
|
81
|
+
/**
|
|
82
|
+
* An opaque object containing session data.
|
|
83
|
+
*/
|
|
84
|
+
session: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* AuthCompleteResponseBody result type (default view)
|
|
89
|
+
*/
|
|
90
|
+
type AuthAuthCompleteResponseBody = {
|
|
91
|
+
/**
|
|
92
|
+
* JWT access token
|
|
93
|
+
*/
|
|
94
|
+
jwtAccess: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Application making the request. It contains additional info about the caller
|
|
99
|
+
* to distinguish between tenants.
|
|
100
|
+
*/
|
|
101
|
+
type applicationRequestBody = {
|
|
102
|
+
/**
|
|
103
|
+
* Unique application id
|
|
104
|
+
*/
|
|
105
|
+
id: string;
|
|
106
|
+
/**
|
|
107
|
+
* App authorization token signed with application key.
|
|
108
|
+
*/
|
|
109
|
+
token?: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Information about the device. All of these attributes are optional and should
|
|
114
|
+
* be provided on best effort basis. If provide, they will be taken into
|
|
115
|
+
* consideration in order to improve user experience.
|
|
116
|
+
*/
|
|
117
|
+
type deviceInfoRequestBody = {
|
|
118
|
+
/**
|
|
119
|
+
* Client name
|
|
120
|
+
*/
|
|
121
|
+
clientName?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Client type.
|
|
124
|
+
*/
|
|
125
|
+
clientType?: 'browser' | 'other';
|
|
126
|
+
/**
|
|
127
|
+
* Client version
|
|
128
|
+
*/
|
|
129
|
+
clientVersion?: string;
|
|
130
|
+
/**
|
|
131
|
+
* An unique device identifier
|
|
132
|
+
*/
|
|
133
|
+
deviceId?: string;
|
|
134
|
+
/**
|
|
135
|
+
* OS architecture
|
|
136
|
+
*/
|
|
137
|
+
osArch?: string;
|
|
138
|
+
/**
|
|
139
|
+
* OS name
|
|
140
|
+
*/
|
|
141
|
+
osName?: string;
|
|
142
|
+
/**
|
|
143
|
+
* OS version
|
|
144
|
+
*/
|
|
145
|
+
osVersion?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Screen height in pixels
|
|
148
|
+
*/
|
|
149
|
+
screenHeight?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Screen width in pixels
|
|
152
|
+
*/
|
|
153
|
+
screenWidth?: number;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
type userRequestBody = {
|
|
157
|
+
/**
|
|
158
|
+
* Display Name
|
|
159
|
+
*/
|
|
160
|
+
displayName?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Username
|
|
163
|
+
*/
|
|
164
|
+
username: string;
|
|
165
|
+
/**
|
|
166
|
+
* Username type
|
|
167
|
+
*/
|
|
168
|
+
usernameType: 'email' | 'phone';
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
type AuthAuthInitRequestBody = {
|
|
172
|
+
app: applicationRequestBody;
|
|
173
|
+
deviceInfo: deviceInfoRequestBody;
|
|
174
|
+
user: userRequestBody;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type pubKeyCredentialDescriptorResponseBody = {
|
|
178
|
+
/**
|
|
179
|
+
* Base64 encoded byte array of the public key identifier.
|
|
180
|
+
*/
|
|
181
|
+
id: string;
|
|
182
|
+
transports?: Array<'usb' | 'nfc' | 'ble' | 'internal'>;
|
|
183
|
+
type: 'public-key';
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
type publicKeyCredentialRequestOptionsResponseBody = {
|
|
187
|
+
/**
|
|
188
|
+
* A list of PublicKeyCredentialDescriptor objects representing public key
|
|
189
|
+
* credentials acceptable to the caller, in descending order of the caller’s
|
|
190
|
+
* preference (the first item in the list is the most preferred credential,
|
|
191
|
+
* and so on down the list).
|
|
192
|
+
*/
|
|
193
|
+
allowCredentials?: Array<pubKeyCredentialDescriptorResponseBody>;
|
|
194
|
+
/**
|
|
195
|
+
* This base64 encoded byte array represents a challenge that the selected
|
|
196
|
+
* authenticator signs, along with other data, when producing an authentication
|
|
197
|
+
* assertion.
|
|
198
|
+
*/
|
|
199
|
+
challenge: string;
|
|
200
|
+
/**
|
|
201
|
+
* Additional parameters requesting additional processing by the client and
|
|
202
|
+
* authenticator. For example, if transaction confirmation is sought from the
|
|
203
|
+
* user, then the prompt string might be included as an extension.
|
|
204
|
+
*/
|
|
205
|
+
extensions?: Record<string, string>;
|
|
206
|
+
/**
|
|
207
|
+
* The relying party identifier claimed by the caller. If omitted, its value will
|
|
208
|
+
* be the CredentialsContainer object’s relevant settings object's origin's
|
|
209
|
+
* effective domain.
|
|
210
|
+
*/
|
|
211
|
+
rpId?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Specifies a time, in milliseconds, that the caller is willing
|
|
214
|
+
* to wait for the call to complete. The value is treated as a
|
|
215
|
+
* hint, and MAY be overridden by the client.
|
|
216
|
+
*/
|
|
217
|
+
timeout?: number;
|
|
218
|
+
/**
|
|
219
|
+
* The Relying Party's requirements regarding user verification for the get()
|
|
220
|
+
* operation. The value SHOULD be a member of UserVerificationRequirement but
|
|
221
|
+
* client platforms MUST ignore unknown values, treating an unknown value as if
|
|
222
|
+
* the member does not exist. Eligible authenticators are filtered to only those
|
|
223
|
+
* capable of satisfying this requirement.
|
|
224
|
+
*/
|
|
225
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* AuthInitResponseBody result type (default view)
|
|
230
|
+
*/
|
|
231
|
+
type AuthAuthInitResponseBody = {
|
|
232
|
+
assertionOptions: publicKeyCredentialRequestOptionsResponseBody;
|
|
233
|
+
/**
|
|
234
|
+
* An opaque object containing session data.
|
|
235
|
+
*/
|
|
236
|
+
session: string;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
declare class AuthService {
|
|
240
|
+
readonly httpRequest: BaseHttpRequest;
|
|
241
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
242
|
+
/**
|
|
243
|
+
* Complete WebAuthn registration
|
|
244
|
+
* @returns AuthAuthCompleteResponseBody OK response.
|
|
245
|
+
* @throws ApiError
|
|
246
|
+
*/
|
|
247
|
+
authAuthComplete({ authCompleteRequestBody, }: {
|
|
248
|
+
authCompleteRequestBody: AuthAuthCompleteRequestBody;
|
|
249
|
+
}): CancelablePromise<AuthAuthCompleteResponseBody>;
|
|
250
|
+
/**
|
|
251
|
+
* Start WebAuthn registration flow
|
|
252
|
+
* @returns AuthAuthInitResponseBody OK response.
|
|
253
|
+
* @throws ApiError
|
|
254
|
+
*/
|
|
255
|
+
authAuthInit({ authInitRequestBody, userAgent, }: {
|
|
256
|
+
authInitRequestBody: AuthAuthInitRequestBody;
|
|
257
|
+
/**
|
|
258
|
+
* Raw user-agent header as set by a browser
|
|
259
|
+
*/
|
|
260
|
+
userAgent?: string;
|
|
261
|
+
}): CancelablePromise<AuthAuthInitResponseBody>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
type PasskeysPasskeyRenameRequestBody = {
|
|
265
|
+
/**
|
|
266
|
+
* Internal passkey identifier
|
|
267
|
+
*/
|
|
268
|
+
name: string;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* PasskeyResponse result type (default view)
|
|
273
|
+
*/
|
|
274
|
+
type PasskeyResponse = {
|
|
275
|
+
/**
|
|
276
|
+
* Timestamp in RFC3339 format.
|
|
277
|
+
*/
|
|
278
|
+
createdAt: string;
|
|
279
|
+
/**
|
|
280
|
+
* Device type
|
|
281
|
+
*/
|
|
282
|
+
device: string;
|
|
283
|
+
/**
|
|
284
|
+
* PassKey ID
|
|
285
|
+
*/
|
|
286
|
+
id: string;
|
|
287
|
+
/**
|
|
288
|
+
* Name of the passkey
|
|
289
|
+
*/
|
|
290
|
+
name: string;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* PasskeysListResponseBody is the result type for an array of PasskeyResponse (default view)
|
|
295
|
+
*/
|
|
296
|
+
type PasskeysPasskeyResponseCollection = Array<PasskeyResponse>;
|
|
297
|
+
|
|
298
|
+
declare class PasskeysService {
|
|
299
|
+
readonly httpRequest: BaseHttpRequest;
|
|
300
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
301
|
+
/**
|
|
302
|
+
* List passkeys
|
|
303
|
+
* **Required security scopes for jwt**:
|
|
304
|
+
* * `passkey:read`
|
|
305
|
+
* @returns PasskeysPasskeyResponseCollection OK response.
|
|
306
|
+
* @throws ApiError
|
|
307
|
+
*/
|
|
308
|
+
passkeysPasskeysList({ authorization, }: {
|
|
309
|
+
/**
|
|
310
|
+
* Authorization token
|
|
311
|
+
*/
|
|
312
|
+
authorization?: string;
|
|
313
|
+
}): CancelablePromise<PasskeysPasskeyResponseCollection>;
|
|
314
|
+
/**
|
|
315
|
+
* Rename passkey
|
|
316
|
+
* **Required security scopes for jwt**:
|
|
317
|
+
* * `passkey:write`
|
|
318
|
+
* @returns void
|
|
319
|
+
* @throws ApiError
|
|
320
|
+
*/
|
|
321
|
+
passkeysPasskeyRename({ id, passkeyRenameRequestBody, authorization, }: {
|
|
322
|
+
/**
|
|
323
|
+
* Internal passkey identifier
|
|
324
|
+
*/
|
|
325
|
+
id: string;
|
|
326
|
+
passkeyRenameRequestBody: PasskeysPasskeyRenameRequestBody;
|
|
327
|
+
/**
|
|
328
|
+
* Authorization token
|
|
329
|
+
*/
|
|
330
|
+
authorization?: string;
|
|
331
|
+
}): CancelablePromise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* Delete passkey
|
|
334
|
+
* **Required security scopes for jwt**:
|
|
335
|
+
* * `passkey:write`
|
|
336
|
+
* @returns void
|
|
337
|
+
* @throws ApiError
|
|
338
|
+
*/
|
|
339
|
+
passkeysPasskeyDelete({ id, authorization, }: {
|
|
340
|
+
/**
|
|
341
|
+
* Internal passkey identifier
|
|
342
|
+
*/
|
|
343
|
+
id: string;
|
|
344
|
+
/**
|
|
345
|
+
* Authorization token
|
|
346
|
+
*/
|
|
347
|
+
authorization?: string;
|
|
348
|
+
}): CancelablePromise<void>;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
type creationResultRequestBody = {
|
|
352
|
+
/**
|
|
353
|
+
* Base64 encoded byte array containing an attestation object, which is opaque to,
|
|
354
|
+
* and cryptographically protected against tampering by, the client.
|
|
355
|
+
*/
|
|
356
|
+
attestationObject: string;
|
|
357
|
+
/**
|
|
358
|
+
* This attribute contains the authenticator data contained within attestationObject.
|
|
359
|
+
*/
|
|
360
|
+
authenticatorData?: string;
|
|
361
|
+
/**
|
|
362
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
363
|
+
* passed to the authenticator by the client in order to generate this credential.
|
|
364
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
365
|
+
* client data has been computed over it.
|
|
366
|
+
*/
|
|
367
|
+
clientDataJSON: string;
|
|
368
|
+
/**
|
|
369
|
+
* A base64 encoded byte sequence identifying a public key credential
|
|
370
|
+
* source and its authentication assertions.
|
|
371
|
+
*/
|
|
372
|
+
credentialId: string;
|
|
373
|
+
/**
|
|
374
|
+
* Base64 encoded DER SubjectPublicKeyInfo of the new credential, or null if this is
|
|
375
|
+
* not available.
|
|
376
|
+
*/
|
|
377
|
+
publicKey?: string;
|
|
378
|
+
publicKeyAlgorithm?: number;
|
|
379
|
+
/**
|
|
380
|
+
* These values are the transports that the authenticator is believed to support,
|
|
381
|
+
* or an empty sequence if the information is unavailable.
|
|
382
|
+
*/
|
|
383
|
+
transports?: Array<'usb' | 'nfc' | 'ble' | 'internal'>;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
type RegRegCompleteRequestBody = {
|
|
387
|
+
creationResult: creationResultRequestBody;
|
|
388
|
+
/**
|
|
389
|
+
* An opaque object containing session data.
|
|
390
|
+
*/
|
|
391
|
+
session: string;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* RegCompleteResponseBody result type (default view)
|
|
396
|
+
*/
|
|
397
|
+
type RegRegCompleteResponseBody = {
|
|
398
|
+
/**
|
|
399
|
+
* JWT access token
|
|
400
|
+
*/
|
|
401
|
+
jwtAccess: string;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
type RegRegInitRequestBody = {
|
|
405
|
+
app: applicationRequestBody;
|
|
406
|
+
deviceInfo: deviceInfoRequestBody;
|
|
407
|
+
/**
|
|
408
|
+
* Set of authentication factors:
|
|
409
|
+
* - Single factor: Username (i.e. email or phone) + FIDO2 credential;
|
|
410
|
+
* - Two factor: Username + password + FIDO2 credential;
|
|
411
|
+
* - Passwordless: FIDO2 discoverable credentials;
|
|
412
|
+
* - Passwordless + MFA: FIDO2 discoverable credentials + PIN;
|
|
413
|
+
*/
|
|
414
|
+
mfa?: Array<'fido2' | 'email' | 'phone' | 'password' | 'pin'>;
|
|
415
|
+
user: userRequestBody;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
type authenticatorSelectionCriteriaResponseBody = {
|
|
419
|
+
/**
|
|
420
|
+
* Authenticator attachment modality
|
|
421
|
+
*/
|
|
422
|
+
authenticatorAttachment?: 'platform' | 'cross-platform';
|
|
423
|
+
/**
|
|
424
|
+
* Resident key requirement
|
|
425
|
+
*/
|
|
426
|
+
requireResidentKey?: boolean;
|
|
427
|
+
/**
|
|
428
|
+
* Resident key requirement
|
|
429
|
+
*/
|
|
430
|
+
residentKey?: 'discouraged' | 'preferred' | 'required';
|
|
431
|
+
/**
|
|
432
|
+
* Resident key requirement
|
|
433
|
+
*/
|
|
434
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Additional parameters when creating a new credential.
|
|
439
|
+
*/
|
|
440
|
+
type publicKeyCredentialParametersResponseBody = {
|
|
441
|
+
/**
|
|
442
|
+
* A cryptographic signature algorithm with which the newly generated credential
|
|
443
|
+
* will be used, and thus also the type of asymmetric key pair to be generated,
|
|
444
|
+
* e.g., RSA or Elliptic Curve.
|
|
445
|
+
*/
|
|
446
|
+
alg?: -7 | -35 | -36 | -257 | -8;
|
|
447
|
+
type?: 'public-key';
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Data about the Relying Party responsible for the request.
|
|
452
|
+
*/
|
|
453
|
+
type publicKeyCredentialRpEntityResponseBody = {
|
|
454
|
+
/**
|
|
455
|
+
* A unique identifier for the Relying Party entity, which sets the RP ID.
|
|
456
|
+
*/
|
|
457
|
+
id?: string;
|
|
458
|
+
/**
|
|
459
|
+
* Relaying party name
|
|
460
|
+
*/
|
|
461
|
+
name: string;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Data about the user account for which the Relying Party is requesting attestation
|
|
466
|
+
*/
|
|
467
|
+
type publicKeyCredentialUserEntityResponseBody = {
|
|
468
|
+
displayName: string;
|
|
469
|
+
id: string;
|
|
470
|
+
name: string;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
type publicKeyCredentialCreationOptionsResponseBody = {
|
|
474
|
+
/**
|
|
475
|
+
* A preference for attestation conveyance.
|
|
476
|
+
*/
|
|
477
|
+
attestation?: 'none' | 'indirect' | 'direct' | 'enterprise';
|
|
478
|
+
authenticatorSelection?: authenticatorSelectionCriteriaResponseBody;
|
|
479
|
+
/**
|
|
480
|
+
* This base64 encoded byte array represents a challenge that
|
|
481
|
+
* the selected authenticator signs, along with other data, when
|
|
482
|
+
* producing an authentication assertion.
|
|
483
|
+
*/
|
|
484
|
+
challenge: string;
|
|
485
|
+
/**
|
|
486
|
+
* List of credentials to limit the creation of multiple credentials for the same
|
|
487
|
+
* account on a single authenticator. The client is requested to return an error
|
|
488
|
+
* if the new credential would be created on an authenticator that also contains
|
|
489
|
+
* one of the credentials enumerated in this parameter.
|
|
490
|
+
*/
|
|
491
|
+
excludeCredentials?: Array<pubKeyCredentialDescriptorResponseBody>;
|
|
492
|
+
/**
|
|
493
|
+
* Additional parameters requesting processing by the client and authenticator.
|
|
494
|
+
*/
|
|
495
|
+
extensions?: Record<string, string>;
|
|
496
|
+
/**
|
|
497
|
+
* This member contains information about the desired properties of the credential
|
|
498
|
+
* to be created. The sequence is ordered from most preferred to least preferred.
|
|
499
|
+
* The client makes a best-effort to create the most preferred credential that it
|
|
500
|
+
* can.
|
|
501
|
+
*/
|
|
502
|
+
pubKeyCredParams: Array<publicKeyCredentialParametersResponseBody>;
|
|
503
|
+
rp: publicKeyCredentialRpEntityResponseBody;
|
|
504
|
+
/**
|
|
505
|
+
* This OPTIONAL member specifies a time, in milliseconds,
|
|
506
|
+
* that the caller is willing to wait for the call to complete. The
|
|
507
|
+
* value is treated as a hint, and MAY be overridden by the client.
|
|
508
|
+
*/
|
|
509
|
+
timeout?: number;
|
|
510
|
+
user: publicKeyCredentialUserEntityResponseBody;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* RegInitResponseBody result type (default view)
|
|
515
|
+
*/
|
|
516
|
+
type RegRegInitResponseBody = {
|
|
517
|
+
registrationRequestOptions: publicKeyCredentialCreationOptionsResponseBody;
|
|
518
|
+
/**
|
|
519
|
+
* An opaque object containing session data.
|
|
520
|
+
*/
|
|
521
|
+
session: string;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
declare class RegService {
|
|
525
|
+
readonly httpRequest: BaseHttpRequest;
|
|
526
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
527
|
+
/**
|
|
528
|
+
* Complete WebAuthn registration flow
|
|
529
|
+
* @returns RegRegCompleteResponseBody OK response.
|
|
530
|
+
* @throws ApiError
|
|
531
|
+
*/
|
|
532
|
+
regRegComplete({ regCompleteRequestBody, }: {
|
|
533
|
+
regCompleteRequestBody: RegRegCompleteRequestBody;
|
|
534
|
+
}): CancelablePromise<RegRegCompleteResponseBody>;
|
|
535
|
+
/**
|
|
536
|
+
* Start WebAuthn registration flow
|
|
537
|
+
* @returns RegRegInitResponseBody OK response.
|
|
538
|
+
* @throws ApiError
|
|
539
|
+
*/
|
|
540
|
+
regRegInit({ regInitRequestBody, userAgent, }: {
|
|
541
|
+
regInitRequestBody: RegRegInitRequestBody;
|
|
542
|
+
/**
|
|
543
|
+
* Raw user-agent header as set by a browser
|
|
544
|
+
*/
|
|
545
|
+
userAgent?: string;
|
|
546
|
+
}): CancelablePromise<RegRegInitResponseBody>;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* VersionShowResponseBody result type (default view)
|
|
551
|
+
*/
|
|
552
|
+
type VersionVersionShowResponseBody = {
|
|
553
|
+
/**
|
|
554
|
+
* Version hash
|
|
555
|
+
*/
|
|
556
|
+
hash?: string;
|
|
557
|
+
/**
|
|
558
|
+
* Software version
|
|
559
|
+
*/
|
|
560
|
+
version: string;
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
declare class VersionService {
|
|
564
|
+
readonly httpRequest: BaseHttpRequest;
|
|
565
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
566
|
+
/**
|
|
567
|
+
* Show software version
|
|
568
|
+
* @returns VersionVersionShowResponseBody OK response.
|
|
569
|
+
* @throws ApiError
|
|
570
|
+
*/
|
|
571
|
+
versionVersionShow(): CancelablePromise<VersionVersionShowResponseBody>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
575
|
+
declare class LoginIDService {
|
|
576
|
+
readonly auth: AuthService;
|
|
577
|
+
readonly passkeys: PasskeysService;
|
|
578
|
+
readonly reg: RegService;
|
|
579
|
+
readonly version: VersionService;
|
|
580
|
+
readonly request: BaseHttpRequest;
|
|
581
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
type ApiResult = {
|
|
585
|
+
readonly url: string;
|
|
586
|
+
readonly ok: boolean;
|
|
587
|
+
readonly status: number;
|
|
588
|
+
readonly statusText: string;
|
|
589
|
+
readonly body: any;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
declare class ApiError extends Error {
|
|
593
|
+
readonly url: string;
|
|
594
|
+
readonly status: number;
|
|
595
|
+
readonly statusText: string;
|
|
596
|
+
readonly body: any;
|
|
597
|
+
readonly request: ApiRequestOptions;
|
|
598
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
type UsernameType = userRequestBody['usernameType'];
|
|
602
|
+
type DeviceInfoRequestBody = deviceInfoRequestBody;
|
|
603
|
+
type MFA = RegRegInitRequestBody['mfa'];
|
|
604
|
+
type Transports = creationResultRequestBody['transports'];
|
|
605
|
+
interface LoginIDConfig {
|
|
606
|
+
baseUrl: string;
|
|
607
|
+
appId: string;
|
|
608
|
+
}
|
|
609
|
+
interface PasskeyOptions {
|
|
610
|
+
token?: string;
|
|
611
|
+
displayName?: string;
|
|
612
|
+
usernameType?: UsernameType;
|
|
613
|
+
}
|
|
614
|
+
interface AuthenticateWithPasskeysOptions extends PasskeyOptions {
|
|
615
|
+
autoFill?: boolean;
|
|
616
|
+
abortSignal?: AbortSignal;
|
|
617
|
+
}
|
|
618
|
+
interface RegisterWithPasskeyOptions extends PasskeyOptions {
|
|
619
|
+
mfa?: MFA;
|
|
620
|
+
}
|
|
621
|
+
interface PasskeyResult {
|
|
622
|
+
jwtAccess: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Provides a base class for integrating with the LoginID API services.
|
|
627
|
+
* This class initializes the common configuration and service needed for derived classes to interact with LoginID services.
|
|
628
|
+
*/
|
|
629
|
+
declare class LoginIDBase {
|
|
630
|
+
/**
|
|
631
|
+
* Holds the configuration settings for the LoginID integration, including API base URL.
|
|
632
|
+
*/
|
|
633
|
+
protected readonly config: LoginIDConfig;
|
|
634
|
+
/**
|
|
635
|
+
* Instance of LoginIDService, providing access to the LoginID API methods.
|
|
636
|
+
*/
|
|
637
|
+
protected readonly service: LoginIDService;
|
|
638
|
+
/**
|
|
639
|
+
* Constructs a new instance of the LoginIDBase class, initializing the service with the provided configuration.
|
|
640
|
+
* @param {LoginIDConfig} config Configuration object for LoginID API, including the base URL.
|
|
641
|
+
*/
|
|
642
|
+
constructor(config: LoginIDConfig);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Extends LoginIDBase to support creation, registration, and authentication of passkeys.
|
|
647
|
+
*/
|
|
648
|
+
declare class Passkeys extends LoginIDBase {
|
|
649
|
+
private jwtAccess;
|
|
650
|
+
/**
|
|
651
|
+
* Initializes a new Passkeys instance with the provided configuration.
|
|
652
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
653
|
+
*/
|
|
654
|
+
constructor(config: LoginIDConfig);
|
|
655
|
+
/**
|
|
656
|
+
* Creates a navigator credential using WebAuthn.
|
|
657
|
+
* @param {RegRegInitResponseBody} regInitResponseBody The response body from registration initialization.
|
|
658
|
+
* @returns {Promise<RegRegCompleteRequestBody>} Completion request body for registration.
|
|
659
|
+
*/
|
|
660
|
+
createNavigatorCredential(regInitResponseBody: RegRegInitResponseBody): Promise<RegRegCompleteRequestBody>;
|
|
661
|
+
/**
|
|
662
|
+
* Registers a user with a passkey.
|
|
663
|
+
* @param {string} username Username to register.
|
|
664
|
+
* @param {RegisterWithPasskeysOptions} options Additional registration options.
|
|
665
|
+
* @returns {Promise<any>} Result of the registration operation.
|
|
666
|
+
*/
|
|
667
|
+
registerWithPasskey(username: string, options?: RegisterWithPasskeyOptions): Promise<PasskeyResult>;
|
|
668
|
+
/**
|
|
669
|
+
* Retrieves a navigator credential for authentication.
|
|
670
|
+
* @param {AuthAuthInitResponseBody} authInitResponseBody The response body from authentication initialization.
|
|
671
|
+
* @param {AuthenticateWithPasskeysOptions} options Additional options for authentication.
|
|
672
|
+
* @returns {Promise<AuthAuthCompleteRequestBody>} Completion request body for authentication.
|
|
673
|
+
*/
|
|
674
|
+
getNavigatorCredential(authInitResponseBody: AuthAuthInitResponseBody, options?: AuthenticateWithPasskeysOptions): Promise<AuthAuthCompleteRequestBody>;
|
|
675
|
+
/**
|
|
676
|
+
* Authenticates a user with a passkey.
|
|
677
|
+
* @param {string} username Username to authenticate.
|
|
678
|
+
* @param {AuthenticateWithPasskeysOptions} options Additional authentication options.
|
|
679
|
+
* @returns {Promise<any>} Result of the authentication operation.
|
|
680
|
+
*/
|
|
681
|
+
authenticateWithPasskey(username: string, options?: AuthenticateWithPasskeysOptions): Promise<PasskeyResult>;
|
|
682
|
+
/**
|
|
683
|
+
* Retrieves the JWT access token.
|
|
684
|
+
* @returns {string} The JWT access token.
|
|
685
|
+
*/
|
|
686
|
+
getJWTAccess(): string;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Extends LoginIDBase to manage Passkeys, including listing, renaming, and deleting passkeys.
|
|
691
|
+
*/
|
|
692
|
+
declare class PasskeyManager extends LoginIDBase {
|
|
693
|
+
/**
|
|
694
|
+
* Initializes a new instance of PasskeyManager with the provided configuration.
|
|
695
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
696
|
+
*/
|
|
697
|
+
constructor(config: LoginIDConfig);
|
|
698
|
+
/**
|
|
699
|
+
* Lists all passkeys associated with the account identified by the authToken.
|
|
700
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
701
|
+
* @returns {Promise<PasskeysPasskeyResponseCollection>} A collection of passkeys.
|
|
702
|
+
*/
|
|
703
|
+
listPasskeys(authToken: string): Promise<PasskeysPasskeyResponseCollection>;
|
|
704
|
+
/**
|
|
705
|
+
* Renames a specified passkey.
|
|
706
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
707
|
+
* @param {string} id The ID of the passkey to rename.
|
|
708
|
+
* @param {string} name The new name for the passkey.
|
|
709
|
+
* @returns {Promise<null>} A promise that resolves to null upon successful completion.
|
|
710
|
+
*/
|
|
711
|
+
renamePasskey(authToken: string, id: string, name: string): Promise<null>;
|
|
712
|
+
/**
|
|
713
|
+
* Deletes a specified passkey.
|
|
714
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
715
|
+
* @param {string} id The ID of the passkey to delete.
|
|
716
|
+
* @returns {Promise<null>} A promise that resolves to null upon successful deletion.
|
|
717
|
+
*/
|
|
718
|
+
deletePasskey(authToken: string, id: string): Promise<null>;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
interface LoginIDWebSDK extends Passkeys, PasskeyManager {
|
|
722
|
+
}
|
|
723
|
+
declare class LoginIDWebSDK extends LoginIDBase {
|
|
724
|
+
constructor(config: LoginIDConfig);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
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';
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Error class for passkey-related errors.
|
|
731
|
+
*/
|
|
732
|
+
declare class PasskeyError extends Error {
|
|
733
|
+
readonly code: PasskeyErrorCode;
|
|
734
|
+
/**
|
|
735
|
+
* Initializes a new instance of PasskeyError with the provided message, code, and original error.
|
|
736
|
+
*
|
|
737
|
+
* @type {Error}
|
|
738
|
+
* @memberof PasskeyError
|
|
739
|
+
*/
|
|
740
|
+
constructor(message: string, code: PasskeyErrorCode, originalError: Error);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Asynchronously creates a passkey credential using the provided registration response.
|
|
745
|
+
*
|
|
746
|
+
* @param {IRegisterPasskeyInitResponse} init - The registration initiation response.
|
|
747
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
748
|
+
* @throws {LoginIdError} If any errors occur during credential creation or if the credential type is invalid.
|
|
749
|
+
*/
|
|
750
|
+
declare const createPasskeyCredential: (init: publicKeyCredentialCreationOptionsResponseBody) => Promise<PublicKeyCredential>;
|
|
751
|
+
/**
|
|
752
|
+
* Asynchronously retrieves a passkey credential for authentication using the provided request options.
|
|
753
|
+
*
|
|
754
|
+
* @param {publicKeyCredentialRequestOptionsResponseBody} init - The authentication initiation response.
|
|
755
|
+
* @param {AuthenticateWithPasskeysOptions} options - Additional options for the authentication request.
|
|
756
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
757
|
+
*/
|
|
758
|
+
declare const getPasskeyCredential: (init: publicKeyCredentialRequestOptionsResponseBody, options?: AuthenticateWithPasskeysOptions) => Promise<PublicKeyCredential>;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Checks if platform authenticator available
|
|
762
|
+
* */
|
|
763
|
+
declare function isPlatformAuthenticatorAvailable(): Promise<boolean>;
|
|
764
|
+
/**
|
|
765
|
+
* Checks if conditional UI is available
|
|
766
|
+
* */
|
|
767
|
+
declare function isConditionalUIAvailable(): Promise<boolean>;
|
|
768
|
+
interface DoesDeviceSupportPasskeysResponse {
|
|
769
|
+
solution: string;
|
|
770
|
+
deviceSupported: boolean;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Attempts to provide a solution for missing platform authenticator
|
|
774
|
+
*/
|
|
775
|
+
declare function doesDeviceSupportPasskeys(): Promise<DoesDeviceSupportPasskeysResponse>;
|
|
776
|
+
|
|
777
|
+
export { ApiError, type AuthenticateWithPasskeysOptions, type DeviceInfoRequestBody, type DoesDeviceSupportPasskeysResponse, type LoginIDConfig, LoginIDWebSDK, type MFA, PasskeyError, type PasskeyOptions, type PasskeyResult, type RegisterWithPasskeyOptions, type Transports, type UsernameType, createPasskeyCredential, LoginIDWebSDK as default, doesDeviceSupportPasskeys, getPasskeyCredential, isConditionalUIAvailable, isPlatformAuthenticatorAvailable };
|