@signalhouse-sms/sdk 1.5.1 → 1.7.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.
@@ -23,6 +23,21 @@ export class Auth {
23
23
  groupId: string;
24
24
  options?: RequestOptions;
25
25
  }) => Promise<SdkResponse<any>>;
26
+ /**
27
+ * Turn off two-factor authentication for a user who has lost every factor (lockout recovery).
28
+ * Clears their methods, backup codes and trusted devices. Audited.
29
+ * @async
30
+ * @roles signalhouse
31
+ * @param {Object} params - The parameters for resetting a user's two-factor authentication
32
+ * @param {string} params.userId - The id of the user to reset
33
+ * @param {RequestOptions} [params.options] - Additional options for the request
34
+ * @throws {Error} Throws an error if the userId parameter is missing
35
+ * @returns {Promise<SdkResponse<any>>} - The response ({ reset: true })
36
+ */
37
+ resetUserTwoFactor: ({ userId, options }: {
38
+ userId: string;
39
+ options?: RequestOptions;
40
+ }) => Promise<SdkResponse<any>>;
26
41
  };
27
42
  /**
28
43
  * Login with email and password
@@ -31,12 +46,14 @@ export class Auth {
31
46
  * @param {Object} params
32
47
  * @param {string} params.email - The user's email address
33
48
  * @param {string} params.password - The user's password
49
+ * @param {string} [params.deviceToken] - A trusted-device token from an earlier verifyTwoFactorChallenge; skips 2FA while valid
34
50
  * @param {RequestOptions} [params.options] - Additional options for the request
35
- * @returns {Promise<SdkResponse<any>>} The response from the server
51
+ * @returns {Promise<SdkResponse<any>>} The response from the server: { token }, or { mfaRequired: true, challengeId, methods, primaryMethod, hasBackupCodes } when the account has 2FA on; or { token, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
36
52
  */
37
- login({ email, password, options }: {
53
+ login({ email, password, deviceToken, options }: {
38
54
  email: string;
39
55
  password: string;
56
+ deviceToken?: string;
40
57
  options?: RequestOptions;
41
58
  }): Promise<SdkResponse<any>>;
42
59
  /**
@@ -47,7 +64,8 @@ export class Auth {
47
64
  * @param {string} params.businessName - The business / group name
48
65
  * @param {string} params.fullName - The owner's full name
49
66
  * @param {string} params.email - The owner's work email
50
- * @param {string} params.password - The owner's password (min 8 characters)
67
+ * @param {string} [params.password] - The owner's password (min 8 characters). Required unless `oauthTicket` is provided
68
+ * @param {string} [params.oauthTicket] - A `signup` ticket from a provider sign-in (see readOAuthTicket). Replaces the password; `email` must match the provider's email
51
69
  * @param {string} [params.phone] - National phone number
52
70
  * @param {string} [params.dialCode] - Country dial code (e.g. "1")
53
71
  * @param {string} [params.country] - Country ISO code (e.g. "US")
@@ -66,11 +84,12 @@ export class Auth {
66
84
  * @param {RequestOptions} [params.options] - Additional options for the request
67
85
  * @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
68
86
  */
69
- register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, options }: {
87
+ register({ businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, options }: {
70
88
  businessName: string;
71
89
  fullName: string;
72
90
  email: string;
73
- password: string;
91
+ password?: string;
92
+ oauthTicket?: string;
74
93
  phone?: string;
75
94
  dialCode?: string;
76
95
  country?: string;
@@ -96,8 +115,9 @@ export class Auth {
96
115
  * The response carries a session JWT (`token`) for the user the link was emailed to, so a click
97
116
  * from any device establishes a session — use it exactly as you would the token from `login`.
98
117
  * `token` is omitted when the link cannot establish a session (issued before auto-login shipped,
99
- * or the account is inactive/ineligible); `verified` is still true in that case, so treat a
100
- * missing token as "verified, ask them to log in" rather than as a failure.
118
+ * the account is inactive/ineligible, or the account has two-factor authentication on, since the
119
+ * link is not a second factor); `verified` is still true in that case, so treat a missing token as
120
+ * "verified, ask them to log in" rather than as a failure.
101
121
  *
102
122
  * Rate limited per source IP. The token is single-use and expires 24 hours after it is issued.
103
123
  * @async
@@ -225,6 +245,390 @@ export class Auth {
225
245
  product: string;
226
246
  options?: RequestOptions;
227
247
  }): Promise<SdkResponse<any>>;
248
+ /**
249
+ * List the OAuth sign-in providers enabled on this API (only providers with credentials configured)
250
+ * @async
251
+ * @roles public
252
+ * @param {Object} [params]
253
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
254
+ * @returns {Promise<Object>} The response from the server ([{ id, label }])
255
+ */
256
+ getOAuthProviders({ options }?: {
257
+ options?: import("../SignalHouseSDK.js").RequestOptions;
258
+ }): Promise<any>;
259
+ /**
260
+ * Build the URL that starts an OAuth sign-in. Navigate the browser to it (it is a redirect, not an
261
+ * API call); the API returns the user to the portal's /auth/callback with a single-use ticket.
262
+ * With a `linkTicket` (from createOAuthLink) it links the provider to the signed-in account instead,
263
+ * and the API returns the user to /Settings/Security with `pendingLink` (finish with confirmOAuthLink) or `linkError`.
264
+ * With a `reauthTicket` (from createOAuthReauth) the signed-in user signs in again with a linked provider to
265
+ * confirm it's them, and the API returns them to /Settings/Security with a single-use `pendingReauth` (the session that started it redeems it with confirmOAuthReauth) or `reauthError`.
266
+ * @roles public
267
+ * @param {Object} params
268
+ * @param {string} params.provider - The provider id ("google", "microsoft", "apple" or "sso" for Enterprise SSO)
269
+ * @param {string} [params.next] - A same-site path (e.g. "/oauth/consent?request=abc") to return the user to
270
+ * after sign-in. The API hands it back on the /auth/callback redirect as `next`; anything that isn't a
271
+ * rooted path on the portal is dropped
272
+ * @param {string} [params.email] - Required for "sso" sign-in: the user's work email, whose domain picks the organization's identity provider. Not needed with a reauthTicket
273
+ * @param {string} [params.linkTicket] - Link the provider to the signed-in account that requested this ticket
274
+ * @param {string} [params.reauthTicket] - Sign in again with a linked provider to confirm it's the account that requested this ticket
275
+ * @returns {string} The absolute authorization URL
276
+ */
277
+ getOAuthAuthorizationUrl({ provider, next, email, linkTicket, reauthTicket }: {
278
+ provider: string;
279
+ next?: string;
280
+ email?: string;
281
+ linkTicket?: string;
282
+ reauthTicket?: string;
283
+ }): string;
284
+ /**
285
+ * List the caller's sign-in methods: whether they chose their own password (`passwordKnown` is false for
286
+ * an account created through a provider or Enterprise SSO), and every provider linked to the account
287
+ * @async
288
+ * @roles admin, developer, billing, user
289
+ * @param {Object} [params]
290
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
291
+ * @returns {Promise<Object>} The response from the server ({ passwordKnown, links: [{ provider, email, linkedAt, lastLoginAt }] })
292
+ */
293
+ getOAuthLinks({ options }?: {
294
+ options?: import("../SignalHouseSDK.js").RequestOptions;
295
+ }): Promise<any>;
296
+ /**
297
+ * Start linking Google, Microsoft or Apple to the caller's account. Returns a single-use link ticket
298
+ * (valid 2 minutes): navigate the browser to getOAuthAuthorizationUrl({ provider, linkTicket }).
299
+ * Requires a fresh confirmTwoFactorIdentity from the same session, which this spends.
300
+ * @async
301
+ * @roles admin, developer, billing, user
302
+ * @param {Object} params
303
+ * @param {string} params.provider - "google", "microsoft" or "apple"
304
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
305
+ * @returns {Promise<Object>} The response from the server ({ linkTicket, expiresInSeconds })
306
+ */
307
+ createOAuthLink({ provider, options }: {
308
+ provider: string;
309
+ options?: import("../SignalHouseSDK.js").RequestOptions;
310
+ }): Promise<any>;
311
+ /**
312
+ * Start signing in again with a provider already linked to the caller's account, to confirm it's them.
313
+ * Returns a single-use ticket (valid 2 minutes): navigate the browser to getOAuthAuthorizationUrl({ provider, reauthTicket }).
314
+ * The provider is asked for a fresh sign-in, and the API returns the browser to /Settings/Security with
315
+ * a single-use `pendingReauth` (the session that started it redeems it with confirmOAuthReauth) or `reauthError` (reauth_wrong_account, reauth_unsupported, reauth_stale, invalid_state,
316
+ * sso_not_configured, access_denied or provider_error). Spends nothing.
317
+ * @async
318
+ * @roles admin, developer, billing, user
319
+ * @param {Object} params
320
+ * @param {string} params.provider - "google", "microsoft", "apple" or "sso"; must be linked to the account
321
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
322
+ * @returns {Promise<Object>} The response from the server ({ reauthTicket, reauthSecret, expiresInSeconds }). Keep
323
+ * `reauthSecret` in the client that started the flow: it is returned only here, and confirmOAuthReauth needs it
324
+ */
325
+ createOAuthReauth({ provider, options }: {
326
+ provider: string;
327
+ options?: import("../SignalHouseSDK.js").RequestOptions;
328
+ }): Promise<any>;
329
+ /**
330
+ * Finish signing in again with a linked provider. The round trip started with createOAuthReauth returns the
331
+ * browser to /Settings/Security with a single-use `pendingReauth` (valid 5 minutes); this redeems it, but only
332
+ * for the same account and the same session that called createOAuthReauth, so a re-sign-in completed in
333
+ * someone else's browser confirms nothing. Fails with 400 when it expired or was used, 403 for another account or session.
334
+ * @async
335
+ * @roles admin, developer, billing, user
336
+ * @param {Object} params
337
+ * @param {string} params.pendingReauth - The `pendingReauth` query parameter from the redirect
338
+ * @param {string} params.reauthSecret - The `reauthSecret` createOAuthReauth returned; a wrong or missing secret is refused (403) and uses up the pending re-sign-in
339
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
340
+ * @returns {Promise<Object>} The response from the server: { identityConfirmed } (true when 2FA is off, so it counts as a confirmed identity)
341
+ */
342
+ confirmOAuthReauth({ pendingReauth, reauthSecret, options }: {
343
+ pendingReauth: string;
344
+ reauthSecret: string;
345
+ options?: import("../SignalHouseSDK.js").RequestOptions;
346
+ }): Promise<any>;
347
+ /**
348
+ * Finish linking a provider. The provider round trip started with createOAuthLink returns the browser to
349
+ * /Settings/Security with a single-use `pendingLink`; this links it, but only for the account the link was
350
+ * started for, so a link URL opened in someone else's browser can't attach their provider to your account.
351
+ * @async
352
+ * @roles admin, developer, billing, user
353
+ * @param {Object} params
354
+ * @param {string} params.pendingLink - The `pendingLink` query parameter from the redirect
355
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
356
+ * @returns {Promise<Object>} The response from the server: the caller's { passwordKnown, links }
357
+ */
358
+ confirmOAuthLink({ pendingLink, options }: {
359
+ pendingLink: string;
360
+ options?: import("../SignalHouseSDK.js").RequestOptions;
361
+ }): Promise<any>;
362
+ /**
363
+ * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in.
364
+ * Requires a fresh confirmTwoFactorIdentity from the same session.
365
+ * @async
366
+ * @roles admin, developer, billing, user
367
+ * @param {Object} params
368
+ * @param {string} params.provider - "google", "microsoft", "apple" or "sso"
369
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
370
+ * @returns {Promise<Object>} The response from the server: the remaining { passwordKnown, links }
371
+ */
372
+ deleteOAuthLink({ provider, options }: {
373
+ provider: string;
374
+ options?: import("../SignalHouseSDK.js").RequestOptions;
375
+ }): Promise<any>;
376
+ /**
377
+ * Read what a single-use OAuth ticket resolves to, without consuming it: a `session` (ready to
378
+ * exchange), a `select` (pick one of several accounts) or a `signup` (finish registration)
379
+ * @async
380
+ * @roles public
381
+ * @param {Object} params
382
+ * @param {string} params.ticket - The ticket from the OAuth callback redirect
383
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
384
+ * @returns {Promise<Object>} The response from the server ({ kind, provider, profile?, accounts? })
385
+ */
386
+ readOAuthTicket({ ticket, options }: {
387
+ ticket: string;
388
+ options?: import("../SignalHouseSDK.js").RequestOptions;
389
+ }): Promise<any>;
390
+ /**
391
+ * Exchange a single-use `session` or `select` OAuth ticket for a JWT Bearer token. Consumes the ticket.
392
+ * @async
393
+ * @roles public
394
+ * @param {Object} params
395
+ * @param {string} params.ticket - The ticket from the OAuth callback redirect
396
+ * @param {string} [params.userId] - Required for a `select` ticket: the chosen account from `accounts`
397
+ * @param {string} [params.deviceToken] - A trusted-device token from an earlier verifyTwoFactorChallenge; skips 2FA while valid
398
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
399
+ * @returns {Promise<Object>} The response from the server: { token }, or { mfaRequired: true, challengeId, ... } when the account has 2FA on; or { token, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
400
+ */
401
+ exchangeOAuthTicket({ ticket, userId, deviceToken, options }: {
402
+ ticket: string;
403
+ userId?: string;
404
+ deviceToken?: string;
405
+ options?: import("../SignalHouseSDK.js").RequestOptions;
406
+ }): Promise<any>;
407
+ /**
408
+ * Get the caller's two-factor authentication settings: enrolled methods (targets masked), the default
409
+ * method, backup-code counts and trusted devices. Never returns secrets or codes.
410
+ * @async
411
+ * @roles admin, developer, billing, user
412
+ * @param {Object} [params]
413
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
414
+ * @returns {Promise<Object>} The response from the server (the settings object)
415
+ */
416
+ getTwoFactorSettings({ options }?: {
417
+ options?: import("../SignalHouseSDK.js").RequestOptions;
418
+ }): Promise<any>;
419
+ /**
420
+ * Confirm it's really the account owner before a sensitive change: startTwoFactorEnrollment,
421
+ * removeTwoFactorMethod, regenerateBackupCodes, disableTwoFactor, createOAuthLink, deleteOAuthLink, or
422
+ * groups.saveSsoConnection / groups.deleteSsoConnection. With 2FA on, pass a current `code` (or a backup
423
+ * code); with 2FA off, pass the account `password`, or, for an account without a password of its own
424
+ * (getOAuthLinks returns passwordKnown: false), the `code` from sendTwoFactorIdentityCode({ method: "email" })
425
+ * with method "email". A confirmation lasts 5 minutes, belongs to the session that made it, and unlocks
426
+ * exactly one change.
427
+ * @async
428
+ * @roles admin, developer, billing, user
429
+ * @param {Object} [params]
430
+ * @param {string} [params.password] - The account password. Required while 2FA is off
431
+ * @param {string} [params.code] - A code from an enrolled method, or a backup code. Required while 2FA is on
432
+ * @param {string} [params.method] - The method the code came from; defaults to the primary method
433
+ * @param {boolean} [params.usingBackupCode] - True when `code` is a backup code
434
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
435
+ * @returns {Promise<Object>} The response from the server ({ confirmed: true, expiresInSeconds })
436
+ */
437
+ confirmTwoFactorIdentity({ password, code, method, usingBackupCode, options }?: {
438
+ password?: string;
439
+ code?: string;
440
+ method?: string;
441
+ usingBackupCode?: boolean;
442
+ options?: import("../SignalHouseSDK.js").RequestOptions;
443
+ }): Promise<any>;
444
+ /**
445
+ * Send a code by text or email to use with confirmTwoFactorIdentity. An authenticator app needs no send.
446
+ * @async
447
+ * @roles admin, developer, billing, user
448
+ * @param {Object} params
449
+ * @param {string} params.method - An enrolled "sms" or "email" method, or "email" for an account without a password of its own
450
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
451
+ * @returns {Promise<Object>} The response from the server ({ sent, target, expiresInSeconds? })
452
+ */
453
+ sendTwoFactorIdentityCode({ method, options }: {
454
+ method: string;
455
+ options?: import("../SignalHouseSDK.js").RequestOptions;
456
+ }): Promise<any>;
457
+ /**
458
+ * Start enrolling a two-factor method. For "app" the response carries the setup secret and otpauth URI
459
+ * (render it as a QR code); for "sms" and "email" a code is sent to the given phone or address.
460
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
461
+ * @async
462
+ * @roles admin, developer, billing, user
463
+ * @param {Object} params
464
+ * @param {string} params.method - "app", "sms" or "email"
465
+ * @param {string} [params.phone] - Required for "sms": the mobile number to send codes to
466
+ * @param {string} [params.address] - Required for "email": the address to send codes to
467
+ * @param {string} [params.deviceName] - Optional label for an authenticator app
468
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
469
+ * @returns {Promise<Object>} The response from the server ({ enrollmentId, secret?, otpauthUri?, sentTo? })
470
+ */
471
+ startTwoFactorEnrollment({ method, phone, address, deviceName, options }: {
472
+ method: string;
473
+ phone?: string;
474
+ address?: string;
475
+ deviceName?: string;
476
+ options?: import("../SignalHouseSDK.js").RequestOptions;
477
+ }): Promise<any>;
478
+ /**
479
+ * Confirm a pending enrollment with the code from the app, text or email. The first method enrolled turns
480
+ * 2FA on and returns a set of backup codes, shown only this once.
481
+ * @async
482
+ * @roles admin, developer, billing, user
483
+ * @param {Object} params
484
+ * @param {string} params.enrollmentId - From startTwoFactorEnrollment
485
+ * @param {string} params.code - The 6-digit code
486
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
487
+ * @returns {Promise<Object>} The response from the server ({ settings, backupCodes })
488
+ */
489
+ confirmTwoFactorEnrollment({ enrollmentId, code, options }: {
490
+ enrollmentId: string;
491
+ code: string;
492
+ options?: import("../SignalHouseSDK.js").RequestOptions;
493
+ }): Promise<any>;
494
+ /**
495
+ * Choose which enrolled method is offered first at sign-in
496
+ * @async
497
+ * @roles admin, developer, billing, user
498
+ * @param {Object} params
499
+ * @param {string} params.method - An enrolled method: "app", "sms" or "email"
500
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
501
+ * @returns {Promise<Object>} The response from the server (the settings object)
502
+ */
503
+ setTwoFactorPrimaryMethod({ method, options }: {
504
+ method: string;
505
+ options?: import("../SignalHouseSDK.js").RequestOptions;
506
+ }): Promise<any>;
507
+ /**
508
+ * Remove an enrolled two-factor method. Removing the last one turns 2FA off.
509
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
510
+ * @async
511
+ * @roles admin, developer, billing, user
512
+ * @param {Object} params
513
+ * @param {string} params.method - "app", "sms" or "email"
514
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
515
+ * @returns {Promise<Object>} The response from the server (the settings object)
516
+ */
517
+ removeTwoFactorMethod({ method, options }: {
518
+ method: string;
519
+ options?: import("../SignalHouseSDK.js").RequestOptions;
520
+ }): Promise<any>;
521
+ /**
522
+ * Replace all backup codes with a new set. The previous codes stop working; the new ones are shown only once.
523
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
524
+ * @async
525
+ * @roles admin, developer, billing, user
526
+ * @param {Object} [params]
527
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
528
+ * @returns {Promise<Object>} The response from the server ({ codes, settings })
529
+ */
530
+ regenerateBackupCodes({ options }?: {
531
+ options?: import("../SignalHouseSDK.js").RequestOptions;
532
+ }): Promise<any>;
533
+ /**
534
+ * Stop trusting a device, so its next sign-in asks for the second factor again
535
+ * @async
536
+ * @roles admin, developer, billing, user
537
+ * @param {Object} params
538
+ * @param {string} params.deviceId - The trusted device's id from getTwoFactorSettings
539
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
540
+ * @returns {Promise<Object>} The response from the server (the settings object)
541
+ */
542
+ revokeTrustedDevice({ deviceId, options }: {
543
+ deviceId: string;
544
+ options?: import("../SignalHouseSDK.js").RequestOptions;
545
+ }): Promise<any>;
546
+ /**
547
+ * Turn two-factor authentication off: removes every method, backup code and trusted device.
548
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
549
+ * @async
550
+ * @roles admin, developer, billing, user
551
+ * @param {Object} [params]
552
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
553
+ * @returns {Promise<Object>} The response from the server (the settings object)
554
+ */
555
+ disableTwoFactor({ options }?: {
556
+ options?: import("../SignalHouseSDK.js").RequestOptions;
557
+ }): Promise<any>;
558
+ /**
559
+ * Whether the "secure your account" enrollment prompt is due for the caller
560
+ * @async
561
+ * @roles admin, developer, billing, user
562
+ * @param {Object} [params]
563
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
564
+ * @returns {Promise<Object>} The response from the server ({ due })
565
+ */
566
+ getTwoFactorPrompt({ options }?: {
567
+ options?: import("../SignalHouseSDK.js").RequestOptions;
568
+ }): Promise<any>;
569
+ /**
570
+ * Dismiss the enrollment prompt ("Set up later") until the next sign-in. It stops for good after three dismissals.
571
+ * @async
572
+ * @roles admin, developer, billing, user
573
+ * @param {Object} [params]
574
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
575
+ * @returns {Promise<Object>} The response from the server ({ due: false })
576
+ */
577
+ dismissTwoFactorPrompt({ options }?: {
578
+ options?: import("../SignalHouseSDK.js").RequestOptions;
579
+ }): Promise<any>;
580
+ /**
581
+ * Send a sign-in code by text or email for a pending two-factor challenge. Not needed for "app".
582
+ * @async
583
+ * @roles public
584
+ * @param {Object} params
585
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
586
+ * @param {string} params.method - "sms" or "email"
587
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
588
+ * @returns {Promise<Object>} The response from the server ({ sent, target, expiresInSeconds })
589
+ */
590
+ sendTwoFactorChallengeCode({ challengeId, method, options }: {
591
+ challengeId: string;
592
+ method: string;
593
+ options?: import("../SignalHouseSDK.js").RequestOptions;
594
+ }): Promise<any>;
595
+ /**
596
+ * Verify a sign-in code (or a backup code) for a pending two-factor challenge and receive the session JWT.
597
+ * With rememberDevice the response also carries a deviceToken to pass on later logins.
598
+ * @async
599
+ * @roles public
600
+ * @param {Object} params
601
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
602
+ * @param {string} params.code - The 6-digit code, or a backup code (xxxx-xxxx)
603
+ * @param {string} [params.method] - The method the code came from ("app", "sms" or "email"); defaults to the primary method
604
+ * @param {boolean} [params.usingBackupCode] - True when code is a backup code
605
+ * @param {boolean} [params.rememberDevice] - Trust this device for 30 days
606
+ * @param {string} [params.deviceName] - Label for the trusted device (e.g. "Chrome on Windows")
607
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
608
+ * @returns {Promise<Object>} The response from the server ({ token, deviceToken? })
609
+ */
610
+ verifyTwoFactorChallenge({ challengeId, code, method, usingBackupCode, rememberDevice, deviceName, options }: {
611
+ challengeId: string;
612
+ code: string;
613
+ method?: string;
614
+ usingBackupCode?: boolean;
615
+ rememberDevice?: boolean;
616
+ deviceName?: string;
617
+ options?: import("../SignalHouseSDK.js").RequestOptions;
618
+ }): Promise<any>;
619
+ /**
620
+ * Cancel a pending two-factor challenge (e.g. "Back to sign in")
621
+ * @async
622
+ * @roles public
623
+ * @param {Object} params
624
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
625
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
626
+ * @returns {Promise<Object>} The response from the server ({ cancelled: true })
627
+ */
628
+ cancelTwoFactorChallenge({ challengeId, options }: {
629
+ challengeId: string;
630
+ options?: import("../SignalHouseSDK.js").RequestOptions;
631
+ }): Promise<any>;
228
632
  }
229
633
  export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
230
634
  export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;