@loginid/websdk3 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +881 -0
- package/dist/index.d.ts +881 -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,881 @@
|
|
|
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 AuthenticatorAssertionResponse = {
|
|
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 AuthCompleteRequestBody = {
|
|
80
|
+
assertionResult: AuthenticatorAssertionResponse;
|
|
81
|
+
/**
|
|
82
|
+
* An opaque object containing session data.
|
|
83
|
+
*/
|
|
84
|
+
session: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type PubKeyCredentialDescriptor = {
|
|
88
|
+
/**
|
|
89
|
+
* Base64 encoded byte array of the public key identifier.
|
|
90
|
+
*/
|
|
91
|
+
id: string;
|
|
92
|
+
transports?: Array<'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid'>;
|
|
93
|
+
type: 'public-key';
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type PublicKeyCredentialRequestOptions = {
|
|
97
|
+
/**
|
|
98
|
+
* A list of PublicKeyCredentialDescriptor objects representing public key
|
|
99
|
+
* credentials acceptable to the caller, in descending order of the caller’s
|
|
100
|
+
* preference (the first item in the list is the most preferred credential,
|
|
101
|
+
* and so on down the list).
|
|
102
|
+
*/
|
|
103
|
+
allowCredentials?: Array<PubKeyCredentialDescriptor>;
|
|
104
|
+
/**
|
|
105
|
+
* This base64 encoded byte array represents a challenge that the selected
|
|
106
|
+
* authenticator signs, along with other data, when producing an authentication
|
|
107
|
+
* assertion.
|
|
108
|
+
*/
|
|
109
|
+
challenge: string;
|
|
110
|
+
/**
|
|
111
|
+
* Additional parameters requesting additional processing by the client and
|
|
112
|
+
* authenticator. For example, if transaction confirmation is sought from the
|
|
113
|
+
* user, then the prompt string might be included as an extension.
|
|
114
|
+
*/
|
|
115
|
+
extensions?: Record<string, string>;
|
|
116
|
+
/**
|
|
117
|
+
* The relying party identifier claimed by the caller. If omitted, its value will
|
|
118
|
+
* be the CredentialsContainer object’s relevant settings object's origin's
|
|
119
|
+
* effective domain.
|
|
120
|
+
*/
|
|
121
|
+
rpId?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Specifies a time, in milliseconds, that the caller is willing
|
|
124
|
+
* to wait for the call to complete. The value is treated as a
|
|
125
|
+
* hint, and MAY be overridden by the client.
|
|
126
|
+
*/
|
|
127
|
+
timeout?: number;
|
|
128
|
+
/**
|
|
129
|
+
* The Relying Party's requirements regarding user verification for the get()
|
|
130
|
+
* operation. The value SHOULD be a member of UserVerificationRequirement but
|
|
131
|
+
* client platforms MUST ignore unknown values, treating an unknown value as if
|
|
132
|
+
* the member does not exist. Eligible authenticators are filtered to only those
|
|
133
|
+
* capable of satisfying this requirement.
|
|
134
|
+
*/
|
|
135
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
type AuthInit = {
|
|
139
|
+
assertionOptions: PublicKeyCredentialRequestOptions;
|
|
140
|
+
/**
|
|
141
|
+
* An opaque object containing session data.
|
|
142
|
+
*/
|
|
143
|
+
session: string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Application making the request. It contains additional info about the caller
|
|
148
|
+
* to distinguish between tenants.
|
|
149
|
+
*/
|
|
150
|
+
type Application = {
|
|
151
|
+
/**
|
|
152
|
+
* Unique application id
|
|
153
|
+
*/
|
|
154
|
+
id: string;
|
|
155
|
+
/**
|
|
156
|
+
* App authorization token signed with application key.
|
|
157
|
+
*/
|
|
158
|
+
token?: string;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Information about the device. All of these attributes are optional and should
|
|
163
|
+
* be provided on best effort basis. If provide, they will be taken into
|
|
164
|
+
* consideration in order to improve user experience.
|
|
165
|
+
*/
|
|
166
|
+
type DeviceInfo = {
|
|
167
|
+
/**
|
|
168
|
+
* Client name
|
|
169
|
+
*/
|
|
170
|
+
clientName?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Client type.
|
|
173
|
+
*/
|
|
174
|
+
clientType?: 'browser' | 'other';
|
|
175
|
+
/**
|
|
176
|
+
* Client version
|
|
177
|
+
*/
|
|
178
|
+
clientVersion?: string;
|
|
179
|
+
/**
|
|
180
|
+
* An unique device identifier
|
|
181
|
+
*/
|
|
182
|
+
deviceId?: string;
|
|
183
|
+
/**
|
|
184
|
+
* OS architecture
|
|
185
|
+
*/
|
|
186
|
+
osArch?: string;
|
|
187
|
+
/**
|
|
188
|
+
* OS name
|
|
189
|
+
*/
|
|
190
|
+
osName?: string;
|
|
191
|
+
/**
|
|
192
|
+
* OS version
|
|
193
|
+
*/
|
|
194
|
+
osVersion?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Screen height in pixels
|
|
197
|
+
*/
|
|
198
|
+
screenHeight?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Screen width in pixels
|
|
201
|
+
*/
|
|
202
|
+
screenWidth?: number;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
type User = {
|
|
206
|
+
/**
|
|
207
|
+
* Display Name
|
|
208
|
+
*/
|
|
209
|
+
displayName?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Username
|
|
212
|
+
*/
|
|
213
|
+
username: string;
|
|
214
|
+
/**
|
|
215
|
+
* Username type
|
|
216
|
+
*/
|
|
217
|
+
usernameType: 'email' | 'phone';
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
type AuthInitRequestBody = {
|
|
221
|
+
app: Application;
|
|
222
|
+
deviceInfo: DeviceInfo;
|
|
223
|
+
user?: User;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
type JWT = {
|
|
227
|
+
/**
|
|
228
|
+
* JWT access token
|
|
229
|
+
*/
|
|
230
|
+
jwtAccess: string;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
declare class AuthService {
|
|
234
|
+
readonly httpRequest: BaseHttpRequest;
|
|
235
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
236
|
+
/**
|
|
237
|
+
* Complete WebAuthn registration
|
|
238
|
+
* @returns JWT OK response.
|
|
239
|
+
* @throws ApiError
|
|
240
|
+
*/
|
|
241
|
+
authAuthComplete({ requestBody, }: {
|
|
242
|
+
requestBody: AuthCompleteRequestBody;
|
|
243
|
+
}): CancelablePromise<JWT>;
|
|
244
|
+
/**
|
|
245
|
+
* Start WebAuthn registration flow
|
|
246
|
+
* @returns AuthInit OK response.
|
|
247
|
+
* @throws ApiError
|
|
248
|
+
*/
|
|
249
|
+
authAuthInit({ requestBody, userAgent, }: {
|
|
250
|
+
requestBody: AuthInitRequestBody;
|
|
251
|
+
/**
|
|
252
|
+
* Raw user-agent header as set by a browser
|
|
253
|
+
*/
|
|
254
|
+
userAgent?: string;
|
|
255
|
+
}): CancelablePromise<AuthInit>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type Passkey = {
|
|
259
|
+
/**
|
|
260
|
+
* Timestamp in RFC3339 format.
|
|
261
|
+
*/
|
|
262
|
+
createdAt: string;
|
|
263
|
+
/**
|
|
264
|
+
* Device type
|
|
265
|
+
*/
|
|
266
|
+
device: string;
|
|
267
|
+
/**
|
|
268
|
+
* PassKey ID
|
|
269
|
+
*/
|
|
270
|
+
id: string;
|
|
271
|
+
/**
|
|
272
|
+
* Name of the passkey
|
|
273
|
+
*/
|
|
274
|
+
name: string;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
type PasskeyCollection = Array<Passkey>;
|
|
278
|
+
|
|
279
|
+
type PasskeyRenameRequestBody = {
|
|
280
|
+
/**
|
|
281
|
+
* Internal passkey identifier
|
|
282
|
+
*/
|
|
283
|
+
name: string;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare class PasskeysService {
|
|
287
|
+
readonly httpRequest: BaseHttpRequest;
|
|
288
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
289
|
+
/**
|
|
290
|
+
* List passkeys
|
|
291
|
+
* @returns PasskeyCollection OK response.
|
|
292
|
+
* @throws ApiError
|
|
293
|
+
*/
|
|
294
|
+
passkeysPasskeysList({ authorization }: {
|
|
295
|
+
authorization: string;
|
|
296
|
+
}): CancelablePromise<PasskeyCollection>;
|
|
297
|
+
/**
|
|
298
|
+
* Delete passkey
|
|
299
|
+
* @returns void
|
|
300
|
+
* @throws ApiError
|
|
301
|
+
*/
|
|
302
|
+
passkeysPasskeyDelete({ id, authorization, }: {
|
|
303
|
+
/**
|
|
304
|
+
* Internal passkey identifier
|
|
305
|
+
*/
|
|
306
|
+
id: string;
|
|
307
|
+
authorization: string;
|
|
308
|
+
}): CancelablePromise<void>;
|
|
309
|
+
/**
|
|
310
|
+
* Rename passkey
|
|
311
|
+
* @returns void
|
|
312
|
+
* @throws ApiError
|
|
313
|
+
*/
|
|
314
|
+
passkeysPasskeyRename({ id, requestBody, authorization }: {
|
|
315
|
+
/**
|
|
316
|
+
* Internal passkey identifier
|
|
317
|
+
*/
|
|
318
|
+
id: string;
|
|
319
|
+
requestBody: PasskeyRenameRequestBody;
|
|
320
|
+
authorization: string;
|
|
321
|
+
}): CancelablePromise<void>;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
type CreationResult = {
|
|
325
|
+
/**
|
|
326
|
+
* Base64 encoded byte array containing an attestation object, which is opaque to,
|
|
327
|
+
* and cryptographically protected against tampering by, the client.
|
|
328
|
+
*/
|
|
329
|
+
attestationObject: string;
|
|
330
|
+
/**
|
|
331
|
+
* This attribute contains the authenticator data contained within attestationObject.
|
|
332
|
+
*/
|
|
333
|
+
authenticatorData?: string;
|
|
334
|
+
/**
|
|
335
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
336
|
+
* passed to the authenticator by the client in order to generate this credential.
|
|
337
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
338
|
+
* client data has been computed over it.
|
|
339
|
+
*/
|
|
340
|
+
clientDataJSON: string;
|
|
341
|
+
/**
|
|
342
|
+
* A base64 encoded byte sequence identifying a public key credential
|
|
343
|
+
* source and its authentication assertions.
|
|
344
|
+
*/
|
|
345
|
+
credentialId: string;
|
|
346
|
+
/**
|
|
347
|
+
* Base64 encoded DER SubjectPublicKeyInfo of the new credential, or null if this is
|
|
348
|
+
* not available.
|
|
349
|
+
*/
|
|
350
|
+
publicKey?: string;
|
|
351
|
+
publicKeyAlgorithm?: number;
|
|
352
|
+
/**
|
|
353
|
+
* These values are the transports that the authenticator is believed to support,
|
|
354
|
+
* or an empty sequence if the information is unavailable.
|
|
355
|
+
*/
|
|
356
|
+
transports?: Array<'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid'>;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
type RegCompleteRequestBody = {
|
|
360
|
+
creationResult: CreationResult;
|
|
361
|
+
/**
|
|
362
|
+
* An opaque object containing session data.
|
|
363
|
+
*/
|
|
364
|
+
session: string;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
type AuthenticatorSelectionCriteria = {
|
|
368
|
+
/**
|
|
369
|
+
* Authenticator attachment modality
|
|
370
|
+
*/
|
|
371
|
+
authenticatorAttachment?: 'platform' | 'cross-platform';
|
|
372
|
+
/**
|
|
373
|
+
* Resident key requirement
|
|
374
|
+
*/
|
|
375
|
+
requireResidentKey?: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* Resident key requirement
|
|
378
|
+
*/
|
|
379
|
+
residentKey?: 'discouraged' | 'preferred' | 'required';
|
|
380
|
+
/**
|
|
381
|
+
* Resident key requirement
|
|
382
|
+
*/
|
|
383
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Additional parameters when creating a new credential.
|
|
388
|
+
*/
|
|
389
|
+
type PublicKeyCredentialParameters = {
|
|
390
|
+
/**
|
|
391
|
+
* A cryptographic signature algorithm with which the newly generated credential
|
|
392
|
+
* will be used, and thus also the type of asymmetric key pair to be generated,
|
|
393
|
+
* e.g., RSA or Elliptic Curve.
|
|
394
|
+
*/
|
|
395
|
+
alg?: -7 | -35 | -36 | -257 | -8;
|
|
396
|
+
type?: 'public-key';
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Data about the Relying Party responsible for the request.
|
|
401
|
+
*/
|
|
402
|
+
type PublicKeyCredentialRpEntity = {
|
|
403
|
+
/**
|
|
404
|
+
* A unique identifier for the Relying Party entity, which sets the RP ID.
|
|
405
|
+
*/
|
|
406
|
+
id?: string;
|
|
407
|
+
/**
|
|
408
|
+
* Relaying party name
|
|
409
|
+
*/
|
|
410
|
+
name: string;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Data about the user account for which the Relying Party is requesting attestation
|
|
415
|
+
*/
|
|
416
|
+
type PublicKeyCredentialUserEntity = {
|
|
417
|
+
displayName: string;
|
|
418
|
+
id: string;
|
|
419
|
+
name: string;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
type PublicKeyCredentialCreationOptions = {
|
|
423
|
+
/**
|
|
424
|
+
* A preference for attestation conveyance.
|
|
425
|
+
*/
|
|
426
|
+
attestation?: 'none' | 'indirect' | 'direct' | 'enterprise';
|
|
427
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
428
|
+
/**
|
|
429
|
+
* This base64 encoded byte array represents a challenge that
|
|
430
|
+
* the selected authenticator signs, along with other data, when
|
|
431
|
+
* producing an authentication assertion.
|
|
432
|
+
*/
|
|
433
|
+
challenge: string;
|
|
434
|
+
/**
|
|
435
|
+
* List of credentials to limit the creation of multiple credentials for the same
|
|
436
|
+
* account on a single authenticator. The client is requested to return an error
|
|
437
|
+
* if the new credential would be created on an authenticator that also contains
|
|
438
|
+
* one of the credentials enumerated in this parameter.
|
|
439
|
+
*/
|
|
440
|
+
excludeCredentials?: Array<PubKeyCredentialDescriptor>;
|
|
441
|
+
/**
|
|
442
|
+
* Additional parameters requesting processing by the client and authenticator.
|
|
443
|
+
*/
|
|
444
|
+
extensions?: Record<string, string>;
|
|
445
|
+
/**
|
|
446
|
+
* This member contains information about the desired properties of the credential
|
|
447
|
+
* to be created. The sequence is ordered from most preferred to least preferred.
|
|
448
|
+
* The client makes a best-effort to create the most preferred credential that it
|
|
449
|
+
* can.
|
|
450
|
+
*/
|
|
451
|
+
pubKeyCredParams: Array<PublicKeyCredentialParameters>;
|
|
452
|
+
rp: PublicKeyCredentialRpEntity;
|
|
453
|
+
/**
|
|
454
|
+
* This OPTIONAL member specifies a time, in milliseconds,
|
|
455
|
+
* that the caller is willing to wait for the call to complete. The
|
|
456
|
+
* value is treated as a hint, and MAY be overridden by the client.
|
|
457
|
+
*/
|
|
458
|
+
timeout?: number;
|
|
459
|
+
user: PublicKeyCredentialUserEntity;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
type RegInit = {
|
|
463
|
+
registrationRequestOptions: PublicKeyCredentialCreationOptions;
|
|
464
|
+
/**
|
|
465
|
+
* An opaque object containing session data.
|
|
466
|
+
*/
|
|
467
|
+
session: string;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
type RegInitRequestBody = {
|
|
471
|
+
app: Application;
|
|
472
|
+
deviceInfo: DeviceInfo;
|
|
473
|
+
/**
|
|
474
|
+
* Set of authentication factors:
|
|
475
|
+
* - Single factor: Username (i.e. email or phone) + FIDO2 credential;
|
|
476
|
+
* - Two factor: Username + password + FIDO2 credential;
|
|
477
|
+
* - Passwordless: FIDO2 discoverable credentials;
|
|
478
|
+
* - Passwordless + MFA: FIDO2 discoverable credentials + PIN;
|
|
479
|
+
*/
|
|
480
|
+
mfa?: Array<'fido2' | 'email' | 'phone' | 'password' | 'pin'>;
|
|
481
|
+
user: User;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
declare class RegService {
|
|
485
|
+
readonly httpRequest: BaseHttpRequest;
|
|
486
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
487
|
+
/**
|
|
488
|
+
* Complete WebAuthn registration flow
|
|
489
|
+
* @returns JWT OK response.
|
|
490
|
+
* @throws ApiError
|
|
491
|
+
*/
|
|
492
|
+
regRegComplete({ requestBody, }: {
|
|
493
|
+
requestBody: RegCompleteRequestBody;
|
|
494
|
+
}): CancelablePromise<JWT>;
|
|
495
|
+
/**
|
|
496
|
+
* Start WebAuthn registration flow
|
|
497
|
+
* @returns RegInit OK response.
|
|
498
|
+
* @throws ApiError
|
|
499
|
+
*/
|
|
500
|
+
regRegInit({ requestBody, userAgent, }: {
|
|
501
|
+
requestBody: RegInitRequestBody;
|
|
502
|
+
/**
|
|
503
|
+
* Raw user-agent header as set by a browser
|
|
504
|
+
*/
|
|
505
|
+
userAgent?: string;
|
|
506
|
+
}): CancelablePromise<RegInit>;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
type TokenVerifyRequestBody = {
|
|
510
|
+
/**
|
|
511
|
+
* JWT access token
|
|
512
|
+
*/
|
|
513
|
+
jwtAccess: string;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
declare class TokenService {
|
|
517
|
+
readonly httpRequest: BaseHttpRequest;
|
|
518
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
519
|
+
/**
|
|
520
|
+
* Validate JWT Access Token
|
|
521
|
+
* @returns void
|
|
522
|
+
* @throws ApiError
|
|
523
|
+
*/
|
|
524
|
+
tokenTokenVerify({ requestBody, }: {
|
|
525
|
+
requestBody: TokenVerifyRequestBody;
|
|
526
|
+
}): CancelablePromise<void>;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
type TxComplete = {
|
|
530
|
+
authCred?: Passkey;
|
|
531
|
+
/**
|
|
532
|
+
* Internal passkey identifier
|
|
533
|
+
*/
|
|
534
|
+
credentialId: string;
|
|
535
|
+
/**
|
|
536
|
+
* JWT access token
|
|
537
|
+
*/
|
|
538
|
+
jwtAccess: string;
|
|
539
|
+
/**
|
|
540
|
+
* Random string generated by LoginID.
|
|
541
|
+
*/
|
|
542
|
+
lNonce: string;
|
|
543
|
+
/**
|
|
544
|
+
* Random string.
|
|
545
|
+
*/
|
|
546
|
+
nonce: string;
|
|
547
|
+
/**
|
|
548
|
+
* Computed hash value of the transaction.
|
|
549
|
+
*/
|
|
550
|
+
txHash: string;
|
|
551
|
+
/**
|
|
552
|
+
* Internal transaction identifier
|
|
553
|
+
*/
|
|
554
|
+
txId: string;
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
type TxCompleteRequestBody = {
|
|
558
|
+
/**
|
|
559
|
+
* This attribute contains the authenticator data returned by the authenticator.
|
|
560
|
+
*/
|
|
561
|
+
authenticatorData: string;
|
|
562
|
+
/**
|
|
563
|
+
* Base64 encoded byte array which is a JSON-compatible serialization of client data
|
|
564
|
+
* passed to the authenticator by the client in order to generate this assertion.
|
|
565
|
+
* The exact JSON serialization MUST be preserved, as the hash of the serialized
|
|
566
|
+
* client data has been computed over it.
|
|
567
|
+
*/
|
|
568
|
+
clientData: string;
|
|
569
|
+
/**
|
|
570
|
+
* Identified of the passkey credential.
|
|
571
|
+
*/
|
|
572
|
+
keyHandle: string;
|
|
573
|
+
/**
|
|
574
|
+
* An opaque object containing session data.
|
|
575
|
+
*/
|
|
576
|
+
session: string;
|
|
577
|
+
/**
|
|
578
|
+
* Base64 encoded the raw signature returned from the authenticator.
|
|
579
|
+
*/
|
|
580
|
+
signature: string;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
type TxInit = {
|
|
584
|
+
assertionOptions: PublicKeyCredentialRequestOptions;
|
|
585
|
+
/**
|
|
586
|
+
* An opaque object containing session data.
|
|
587
|
+
*/
|
|
588
|
+
session: string;
|
|
589
|
+
/**
|
|
590
|
+
* Internal transaction identifier
|
|
591
|
+
*/
|
|
592
|
+
txId: string;
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
type TxInitRequestBody = {
|
|
596
|
+
/**
|
|
597
|
+
* Random string
|
|
598
|
+
*/
|
|
599
|
+
nonce: string;
|
|
600
|
+
/**
|
|
601
|
+
* Payload of transaction
|
|
602
|
+
*/
|
|
603
|
+
txPayload: string;
|
|
604
|
+
/**
|
|
605
|
+
* Type of transaction
|
|
606
|
+
*/
|
|
607
|
+
txType: string;
|
|
608
|
+
/**
|
|
609
|
+
* Username of user
|
|
610
|
+
*/
|
|
611
|
+
username: string;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
declare class TxService {
|
|
615
|
+
readonly httpRequest: BaseHttpRequest;
|
|
616
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
617
|
+
/**
|
|
618
|
+
* Complete transaction confirmation
|
|
619
|
+
* @returns TxComplete OK response.
|
|
620
|
+
* @throws ApiError
|
|
621
|
+
*/
|
|
622
|
+
txTxComplete({ requestBody, }: {
|
|
623
|
+
requestBody: TxCompleteRequestBody;
|
|
624
|
+
}): CancelablePromise<TxComplete>;
|
|
625
|
+
/**
|
|
626
|
+
* Start transaction confirmation flow
|
|
627
|
+
* @returns TxInit OK response.
|
|
628
|
+
* @throws ApiError
|
|
629
|
+
*/
|
|
630
|
+
txTxInit({ requestBody, }: {
|
|
631
|
+
requestBody: TxInitRequestBody;
|
|
632
|
+
}): CancelablePromise<TxInit>;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
type Version = {
|
|
636
|
+
/**
|
|
637
|
+
* Version hash
|
|
638
|
+
*/
|
|
639
|
+
hash?: string;
|
|
640
|
+
/**
|
|
641
|
+
* Software version
|
|
642
|
+
*/
|
|
643
|
+
version: string;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
declare class VersionService {
|
|
647
|
+
readonly httpRequest: BaseHttpRequest;
|
|
648
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
649
|
+
/**
|
|
650
|
+
* Show software version
|
|
651
|
+
* @returns Version OK response.
|
|
652
|
+
* @throws ApiError
|
|
653
|
+
*/
|
|
654
|
+
versionVersionShow(): CancelablePromise<Version>;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
658
|
+
declare class LoginIDService {
|
|
659
|
+
readonly auth: AuthService;
|
|
660
|
+
readonly passkeys: PasskeysService;
|
|
661
|
+
readonly reg: RegService;
|
|
662
|
+
readonly token: TokenService;
|
|
663
|
+
readonly tx: TxService;
|
|
664
|
+
readonly version: VersionService;
|
|
665
|
+
readonly request: BaseHttpRequest;
|
|
666
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
type ApiResult = {
|
|
670
|
+
readonly url: string;
|
|
671
|
+
readonly ok: boolean;
|
|
672
|
+
readonly status: number;
|
|
673
|
+
readonly statusText: string;
|
|
674
|
+
readonly body: any;
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
declare class ApiError extends Error {
|
|
678
|
+
readonly url: string;
|
|
679
|
+
readonly status: number;
|
|
680
|
+
readonly statusText: string;
|
|
681
|
+
readonly body: any;
|
|
682
|
+
readonly request: ApiRequestOptions;
|
|
683
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
type UsernameType = User['usernameType'];
|
|
687
|
+
type DeviceInfoRequestBody = DeviceInfo;
|
|
688
|
+
type MFA = RegInitRequestBody['mfa'];
|
|
689
|
+
type Transports = CreationResult['transports'];
|
|
690
|
+
interface LoginIDConfig {
|
|
691
|
+
baseUrl: string;
|
|
692
|
+
appId: string;
|
|
693
|
+
}
|
|
694
|
+
interface PasskeyOptions {
|
|
695
|
+
token?: string;
|
|
696
|
+
displayName?: string;
|
|
697
|
+
usernameType?: UsernameType;
|
|
698
|
+
}
|
|
699
|
+
interface AuthenticateWithPasskeysOptions extends PasskeyOptions {
|
|
700
|
+
autoFill?: boolean;
|
|
701
|
+
abortSignal?: AbortSignal;
|
|
702
|
+
}
|
|
703
|
+
interface RegisterWithPasskeyOptions extends PasskeyOptions {
|
|
704
|
+
mfa?: MFA;
|
|
705
|
+
}
|
|
706
|
+
interface ConfirmTransactionOptions extends Partial<Pick<TxInitRequestBody, 'txType'>> {
|
|
707
|
+
}
|
|
708
|
+
interface PasskeyResult {
|
|
709
|
+
jwtAccess: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Provides a base class for integrating with the LoginID API services.
|
|
714
|
+
* This class initializes the common configuration and service needed for derived classes to interact with LoginID services.
|
|
715
|
+
*/
|
|
716
|
+
declare class LoginIDBase {
|
|
717
|
+
/**
|
|
718
|
+
* Holds the configuration settings for the LoginID integration, including API base URL.
|
|
719
|
+
*/
|
|
720
|
+
protected readonly config: LoginIDConfig;
|
|
721
|
+
/**
|
|
722
|
+
* Instance of LoginIDService, providing access to the LoginID API methods.
|
|
723
|
+
*/
|
|
724
|
+
protected readonly service: LoginIDService;
|
|
725
|
+
/**
|
|
726
|
+
* Constructs a new instance of the LoginIDBase class, initializing the service with the provided configuration.
|
|
727
|
+
* @param {LoginIDConfig} config Configuration object for LoginID API, including the base URL.
|
|
728
|
+
*/
|
|
729
|
+
constructor(config: LoginIDConfig);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Extends LoginIDBase to support creation, registration, and authentication of passkeys.
|
|
734
|
+
*/
|
|
735
|
+
declare class Passkeys extends LoginIDBase {
|
|
736
|
+
private jwtAccess;
|
|
737
|
+
/**
|
|
738
|
+
* Initializes a new Passkeys instance with the provided configuration.
|
|
739
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
740
|
+
*/
|
|
741
|
+
constructor(config: LoginIDConfig);
|
|
742
|
+
/**
|
|
743
|
+
* Creates a navigator credential using WebAuthn.
|
|
744
|
+
* @param {RegInit} regInitResponseBody The response body from registration initialization.
|
|
745
|
+
* @returns {Promise<RegRegCompleteRequestBody>} Completion request body for registration.
|
|
746
|
+
*/
|
|
747
|
+
createNavigatorCredential(regInitResponseBody: RegInit): Promise<RegCompleteRequestBody>;
|
|
748
|
+
/**
|
|
749
|
+
* Registers a user with a passkey.
|
|
750
|
+
* @param {string} username Username to register.
|
|
751
|
+
* @param {RegisterWithPasskeysOptions} options Additional registration options.
|
|
752
|
+
* @returns {Promise<any>} Result of the registration operation.
|
|
753
|
+
*/
|
|
754
|
+
registerWithPasskey(username: string, options?: RegisterWithPasskeyOptions): Promise<PasskeyResult>;
|
|
755
|
+
/**
|
|
756
|
+
* Retrieves a navigator credential for authentication.
|
|
757
|
+
* @param {AuthInit} authInitResponseBody The response body from authentication initialization.
|
|
758
|
+
* @param {AuthenticateWithPasskeysOptions} options Additional options for authentication.
|
|
759
|
+
* @returns {Promise<AuthAuthCompleteRequestBody>} Completion request body for authentication.
|
|
760
|
+
*/
|
|
761
|
+
getNavigatorCredential(authInitResponseBody: AuthInit, options?: AuthenticateWithPasskeysOptions): Promise<AuthCompleteRequestBody>;
|
|
762
|
+
/**
|
|
763
|
+
* Authenticates a user with a passkey.
|
|
764
|
+
* @param {string} username Username to authenticate.
|
|
765
|
+
* @param {AuthenticateWithPasskeysOptions} options Additional authentication options.
|
|
766
|
+
* @returns {Promise<any>} Result of the authentication operation.
|
|
767
|
+
*/
|
|
768
|
+
authenticateWithPasskey(username?: string, options?: AuthenticateWithPasskeysOptions): Promise<PasskeyResult>;
|
|
769
|
+
/**
|
|
770
|
+
* Confirms a transaction using a passkey.
|
|
771
|
+
*
|
|
772
|
+
* This method initiates a transaction confirmation process by generating a transaction-specific challenge
|
|
773
|
+
* and then expects the client to provide an assertion response using a passkey.
|
|
774
|
+
* This method is useful for confirming actions such as payments
|
|
775
|
+
* or changes to sensitive account information, ensuring that the transaction is being authorized
|
|
776
|
+
* by the rightful owner of the passkey.
|
|
777
|
+
*
|
|
778
|
+
* @param {string} username The username of the user confirming the transaction.
|
|
779
|
+
* @param {string} txPayload The transaction-specific payload, which could include details
|
|
780
|
+
* such as the transaction amount, recipient, and other metadata necessary for the transaction.
|
|
781
|
+
* @param {ConfirmTransactionOptions} [options={}] Optional parameters for transaction confirmation.
|
|
782
|
+
* @returns {Promise<any>} A promise that resolves with the result of the transaction confirmation operation.
|
|
783
|
+
* The result includes details about the transaction's details and includes a new JWT access token.
|
|
784
|
+
*/
|
|
785
|
+
confirmTransaction(username: string, txPayload: string, nonce: string, options?: ConfirmTransactionOptions): Promise<TxComplete>;
|
|
786
|
+
/**
|
|
787
|
+
* Retrieves the JWT access token.
|
|
788
|
+
* @returns {string} The JWT access token.
|
|
789
|
+
*/
|
|
790
|
+
getJWTAccess(): string;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Extends LoginIDBase to manage Passkeys, including listing, renaming, and deleting passkeys.
|
|
795
|
+
*/
|
|
796
|
+
declare class PasskeyManager extends LoginIDBase {
|
|
797
|
+
/**
|
|
798
|
+
* Initializes a new instance of PasskeyManager with the provided configuration.
|
|
799
|
+
* @param {LoginIDConfig} config Configuration object for LoginID.
|
|
800
|
+
*/
|
|
801
|
+
constructor(config: LoginIDConfig);
|
|
802
|
+
/**
|
|
803
|
+
* Lists all passkeys associated with the account identified by the authToken.
|
|
804
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
805
|
+
* @returns {Promise<PasskeysPasskeyResponseCollection>} A collection of passkeys.
|
|
806
|
+
*/
|
|
807
|
+
listPasskeys(authToken: string): Promise<PasskeyCollection>;
|
|
808
|
+
/**
|
|
809
|
+
* Renames a specified passkey.
|
|
810
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
811
|
+
* @param {string} id The ID of the passkey to rename.
|
|
812
|
+
* @param {string} name The new name for the passkey.
|
|
813
|
+
* @returns {Promise<null>} A promise that resolves to null upon successful completion.
|
|
814
|
+
*/
|
|
815
|
+
renamePasskey(authToken: string, id: string, name: string): Promise<null>;
|
|
816
|
+
/**
|
|
817
|
+
* Deletes a specified passkey.
|
|
818
|
+
* @param {string} authToken Authorization token to authenticate the request.
|
|
819
|
+
* @param {string} id The ID of the passkey to delete.
|
|
820
|
+
* @returns {Promise<null>} A promise that resolves to null upon successful deletion.
|
|
821
|
+
*/
|
|
822
|
+
deletePasskey(authToken: string, id: string): Promise<null>;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
interface LoginIDWebSDK extends Passkeys, PasskeyManager {
|
|
826
|
+
}
|
|
827
|
+
declare class LoginIDWebSDK extends LoginIDBase {
|
|
828
|
+
constructor(config: LoginIDConfig);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
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';
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Error class for passkey-related errors.
|
|
835
|
+
*/
|
|
836
|
+
declare class PasskeyError extends Error {
|
|
837
|
+
readonly code: PasskeyErrorCode;
|
|
838
|
+
/**
|
|
839
|
+
* Initializes a new instance of PasskeyError with the provided message, code, and original error.
|
|
840
|
+
*
|
|
841
|
+
* @type {Error}
|
|
842
|
+
* @memberof PasskeyError
|
|
843
|
+
*/
|
|
844
|
+
constructor(message: string, code: PasskeyErrorCode, originalError: Error);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* Asynchronously creates a passkey credential using the provided registration response.
|
|
849
|
+
*
|
|
850
|
+
* @param {IRegisterPasskeyInitResponse} init - The registration initiation response.
|
|
851
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
852
|
+
* @throws {LoginIdError} If any errors occur during credential creation or if the credential type is invalid.
|
|
853
|
+
*/
|
|
854
|
+
declare const createPasskeyCredential: (init: PublicKeyCredentialCreationOptions) => Promise<PublicKeyCredential>;
|
|
855
|
+
/**
|
|
856
|
+
* Asynchronously retrieves a passkey credential for authentication using the provided request options.
|
|
857
|
+
*
|
|
858
|
+
* @param {publicKeyCredentialRequestOptionsResponseBody} init - The authentication initiation response.
|
|
859
|
+
* @param {AuthenticateWithPasskeysOptions} options - Additional options for the authentication request.
|
|
860
|
+
* @returns {Promise<PublicKeyCredential>} A promise that resolves to the passkey credential.
|
|
861
|
+
*/
|
|
862
|
+
declare const getPasskeyCredential: (init: PublicKeyCredentialRequestOptions, options?: AuthenticateWithPasskeysOptions) => Promise<PublicKeyCredential>;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Checks if platform authenticator available
|
|
866
|
+
* */
|
|
867
|
+
declare function isPlatformAuthenticatorAvailable(): Promise<boolean>;
|
|
868
|
+
/**
|
|
869
|
+
* Checks if conditional UI is available
|
|
870
|
+
* */
|
|
871
|
+
declare function isConditionalUIAvailable(): Promise<boolean>;
|
|
872
|
+
interface DoesDeviceSupportPasskeysResponse {
|
|
873
|
+
solution: string;
|
|
874
|
+
deviceSupported: boolean;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Attempts to provide a solution for missing platform authenticator
|
|
878
|
+
*/
|
|
879
|
+
declare function doesDeviceSupportPasskeys(): Promise<DoesDeviceSupportPasskeysResponse>;
|
|
880
|
+
|
|
881
|
+
export { ApiError, type AuthenticateWithPasskeysOptions, type ConfirmTransactionOptions, 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 };
|