@signalhouse-sms/sdk 1.6.0 → 1.8.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,391 @@ 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 - "microsoft", "apple" or "sso"; must be linked to the account. Google is
321
+ * refused with a 400 because it can't confirm a fresh sign-in; confirm with a code instead
322
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
323
+ * @returns {Promise<Object>} The response from the server ({ reauthTicket, reauthSecret, expiresInSeconds }). Keep
324
+ * `reauthSecret` in the client that started the flow: it is returned only here, and confirmOAuthReauth needs it
325
+ */
326
+ createOAuthReauth({ provider, options }: {
327
+ provider: string;
328
+ options?: import("../SignalHouseSDK.js").RequestOptions;
329
+ }): Promise<any>;
330
+ /**
331
+ * Finish signing in again with a linked provider. The round trip started with createOAuthReauth returns the
332
+ * browser to /Settings/Security with a single-use `pendingReauth` (valid 5 minutes); this redeems it, but only
333
+ * for the same account and the same session that called createOAuthReauth, so a re-sign-in completed in
334
+ * someone else's browser confirms nothing. Fails with 400 when it expired or was used, 403 for another account or session.
335
+ * @async
336
+ * @roles admin, developer, billing, user
337
+ * @param {Object} params
338
+ * @param {string} params.pendingReauth - The `pendingReauth` query parameter from the redirect
339
+ * @param {string} params.reauthSecret - The `reauthSecret` createOAuthReauth returned; a wrong or missing secret is refused (403) and uses up the pending re-sign-in
340
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
341
+ * @returns {Promise<Object>} The response from the server: { identityConfirmed } (true when 2FA is off, so it counts as a confirmed identity)
342
+ */
343
+ confirmOAuthReauth({ pendingReauth, reauthSecret, options }: {
344
+ pendingReauth: string;
345
+ reauthSecret: string;
346
+ options?: import("../SignalHouseSDK.js").RequestOptions;
347
+ }): Promise<any>;
348
+ /**
349
+ * Finish linking a provider. The provider round trip started with createOAuthLink returns the browser to
350
+ * /Settings/Security with a single-use `pendingLink`; this links it, but only for the account the link was
351
+ * started for, so a link URL opened in someone else's browser can't attach their provider to your account.
352
+ * @async
353
+ * @roles admin, developer, billing, user
354
+ * @param {Object} params
355
+ * @param {string} params.pendingLink - The `pendingLink` query parameter from the redirect
356
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
357
+ * @returns {Promise<Object>} The response from the server: the caller's { passwordKnown, links }
358
+ */
359
+ confirmOAuthLink({ pendingLink, options }: {
360
+ pendingLink: string;
361
+ options?: import("../SignalHouseSDK.js").RequestOptions;
362
+ }): Promise<any>;
363
+ /**
364
+ * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in. With 2FA on and no password, the last linked Microsoft, Apple or SSO sign-in is refused (400) too.
365
+ * Requires a fresh confirmTwoFactorIdentity from the same session.
366
+ * @async
367
+ * @roles admin, developer, billing, user
368
+ * @param {Object} params
369
+ * @param {string} params.provider - "google", "microsoft", "apple" or "sso"
370
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
371
+ * @returns {Promise<Object>} The response from the server: the remaining { passwordKnown, links }
372
+ */
373
+ deleteOAuthLink({ provider, options }: {
374
+ provider: string;
375
+ options?: import("../SignalHouseSDK.js").RequestOptions;
376
+ }): Promise<any>;
377
+ /**
378
+ * Read what a single-use OAuth ticket resolves to, without consuming it: a `session` (ready to
379
+ * exchange), a `select` (pick one of several accounts) or a `signup` (finish registration)
380
+ * @async
381
+ * @roles public
382
+ * @param {Object} params
383
+ * @param {string} params.ticket - The ticket from the OAuth callback redirect
384
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
385
+ * @returns {Promise<Object>} The response from the server ({ kind, provider, profile?, accounts? })
386
+ */
387
+ readOAuthTicket({ ticket, options }: {
388
+ ticket: string;
389
+ options?: import("../SignalHouseSDK.js").RequestOptions;
390
+ }): Promise<any>;
391
+ /**
392
+ * Exchange a single-use `session` or `select` OAuth ticket for a JWT Bearer token. Consumes the ticket.
393
+ * @async
394
+ * @roles public
395
+ * @param {Object} params
396
+ * @param {string} params.ticket - The ticket from the OAuth callback redirect
397
+ * @param {string} [params.userId] - Required for a `select` ticket: the chosen account from `accounts`
398
+ * @param {string} [params.deviceToken] - A trusted-device token from an earlier verifyTwoFactorChallenge; skips 2FA while valid
399
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
400
+ * @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
401
+ */
402
+ exchangeOAuthTicket({ ticket, userId, deviceToken, options }: {
403
+ ticket: string;
404
+ userId?: string;
405
+ deviceToken?: string;
406
+ options?: import("../SignalHouseSDK.js").RequestOptions;
407
+ }): Promise<any>;
408
+ /**
409
+ * Get the caller's two-factor authentication settings: enrolled methods (targets masked), the default
410
+ * method, backup-code counts and trusted devices. Never returns secrets or codes.
411
+ * @async
412
+ * @roles admin, developer, billing, user
413
+ * @param {Object} [params]
414
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
415
+ * @returns {Promise<Object>} The response from the server (the settings object)
416
+ */
417
+ getTwoFactorSettings({ options }?: {
418
+ options?: import("../SignalHouseSDK.js").RequestOptions;
419
+ }): Promise<any>;
420
+ /**
421
+ * Confirm it's really the account owner before a sensitive change: startTwoFactorEnrollment,
422
+ * removeTwoFactorMethod, regenerateBackupCodes, disableTwoFactor, createOAuthLink, deleteOAuthLink, or
423
+ * groups.saveSsoConnection / groups.deleteSsoConnection. With 2FA on, pass a current `code` (or a backup
424
+ * code); with 2FA off, pass the account `password`, or, for an account without a password of its own
425
+ * (getOAuthLinks returns passwordKnown: false), the `code` from sendTwoFactorIdentityCode({ method: "email" })
426
+ * with method "email". A confirmation lasts 5 minutes, belongs to the session that made it, and unlocks
427
+ * exactly one change.
428
+ * @async
429
+ * @roles admin, developer, billing, user
430
+ * @param {Object} [params]
431
+ * @param {string} [params.password] - The account password. Required while 2FA is off
432
+ * @param {string} [params.code] - A code from an enrolled method, or a backup code. Required while 2FA is on
433
+ * @param {string} [params.method] - The method the code came from; defaults to the primary method
434
+ * @param {boolean} [params.usingBackupCode] - True when `code` is a backup code
435
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
436
+ * @returns {Promise<Object>} The response from the server ({ confirmed: true, expiresInSeconds })
437
+ */
438
+ confirmTwoFactorIdentity({ password, code, method, usingBackupCode, options }?: {
439
+ password?: string;
440
+ code?: string;
441
+ method?: string;
442
+ usingBackupCode?: boolean;
443
+ options?: import("../SignalHouseSDK.js").RequestOptions;
444
+ }): Promise<any>;
445
+ /**
446
+ * Send a code by text or email to use with confirmTwoFactorIdentity. An authenticator app needs no send.
447
+ * @async
448
+ * @roles admin, developer, billing, user
449
+ * @param {Object} params
450
+ * @param {string} params.method - An enrolled "sms" or "email" method, or "email" for an account without a password of its own
451
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
452
+ * @returns {Promise<Object>} The response from the server ({ sent, target, expiresInSeconds? })
453
+ */
454
+ sendTwoFactorIdentityCode({ method, options }: {
455
+ method: string;
456
+ options?: import("../SignalHouseSDK.js").RequestOptions;
457
+ }): Promise<any>;
458
+ /**
459
+ * Start enrolling a two-factor method. For "app" the response carries the setup secret and otpauth URI
460
+ * (render it as a QR code); for "sms" and "email" a code is sent to the given phone or address.
461
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
462
+ * @async
463
+ * @roles admin, developer, billing, user
464
+ * @param {Object} params
465
+ * @param {string} params.method - "app", "sms" or "email"
466
+ * @param {string} [params.phone] - Required for "sms": the mobile number to send codes to
467
+ * @param {string} [params.address] - Required for "email": the address to send codes to
468
+ * @param {string} [params.deviceName] - Optional label for an authenticator app
469
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
470
+ * @returns {Promise<Object>} The response from the server ({ enrollmentId, secret?, otpauthUri?, sentTo? })
471
+ */
472
+ startTwoFactorEnrollment({ method, phone, address, deviceName, options }: {
473
+ method: string;
474
+ phone?: string;
475
+ address?: string;
476
+ deviceName?: string;
477
+ options?: import("../SignalHouseSDK.js").RequestOptions;
478
+ }): Promise<any>;
479
+ /**
480
+ * Confirm a pending enrollment with the code from the app, text or email. The first method enrolled turns
481
+ * 2FA on and returns a set of backup codes, shown only this once.
482
+ * @async
483
+ * @roles admin, developer, billing, user
484
+ * @param {Object} params
485
+ * @param {string} params.enrollmentId - From startTwoFactorEnrollment
486
+ * @param {string} params.code - The 6-digit code
487
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
488
+ * @returns {Promise<Object>} The response from the server ({ settings, backupCodes })
489
+ */
490
+ confirmTwoFactorEnrollment({ enrollmentId, code, options }: {
491
+ enrollmentId: string;
492
+ code: string;
493
+ options?: import("../SignalHouseSDK.js").RequestOptions;
494
+ }): Promise<any>;
495
+ /**
496
+ * Choose which enrolled method is offered first at sign-in
497
+ * @async
498
+ * @roles admin, developer, billing, user
499
+ * @param {Object} params
500
+ * @param {string} params.method - An enrolled method: "app", "sms" or "email"
501
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
502
+ * @returns {Promise<Object>} The response from the server (the settings object)
503
+ */
504
+ setTwoFactorPrimaryMethod({ method, options }: {
505
+ method: string;
506
+ options?: import("../SignalHouseSDK.js").RequestOptions;
507
+ }): Promise<any>;
508
+ /**
509
+ * Remove an enrolled two-factor method. Removing the last one turns 2FA off.
510
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
511
+ * @async
512
+ * @roles admin, developer, billing, user
513
+ * @param {Object} params
514
+ * @param {string} params.method - "app", "sms" or "email"
515
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
516
+ * @returns {Promise<Object>} The response from the server (the settings object)
517
+ */
518
+ removeTwoFactorMethod({ method, options }: {
519
+ method: string;
520
+ options?: import("../SignalHouseSDK.js").RequestOptions;
521
+ }): Promise<any>;
522
+ /**
523
+ * Replace all backup codes with a new set. The previous codes stop working; the new ones are shown only once.
524
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
525
+ * @async
526
+ * @roles admin, developer, billing, user
527
+ * @param {Object} [params]
528
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
529
+ * @returns {Promise<Object>} The response from the server ({ codes, settings })
530
+ */
531
+ regenerateBackupCodes({ options }?: {
532
+ options?: import("../SignalHouseSDK.js").RequestOptions;
533
+ }): Promise<any>;
534
+ /**
535
+ * Stop trusting a device, so its next sign-in asks for the second factor again
536
+ * @async
537
+ * @roles admin, developer, billing, user
538
+ * @param {Object} params
539
+ * @param {string} params.deviceId - The trusted device's id from getTwoFactorSettings
540
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
541
+ * @returns {Promise<Object>} The response from the server (the settings object)
542
+ */
543
+ revokeTrustedDevice({ deviceId, options }: {
544
+ deviceId: string;
545
+ options?: import("../SignalHouseSDK.js").RequestOptions;
546
+ }): Promise<any>;
547
+ /**
548
+ * Turn two-factor authentication off: removes every method, backup code and trusted device.
549
+ * Requires a fresh confirmTwoFactorIdentity from the same session (403 otherwise); each confirmation unlocks one change.
550
+ * @async
551
+ * @roles admin, developer, billing, user
552
+ * @param {Object} [params]
553
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
554
+ * @returns {Promise<Object>} The response from the server (the settings object)
555
+ */
556
+ disableTwoFactor({ options }?: {
557
+ options?: import("../SignalHouseSDK.js").RequestOptions;
558
+ }): Promise<any>;
559
+ /**
560
+ * Whether the "secure your account" enrollment prompt is due for the caller
561
+ * @async
562
+ * @roles admin, developer, billing, user
563
+ * @param {Object} [params]
564
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
565
+ * @returns {Promise<Object>} The response from the server ({ due })
566
+ */
567
+ getTwoFactorPrompt({ options }?: {
568
+ options?: import("../SignalHouseSDK.js").RequestOptions;
569
+ }): Promise<any>;
570
+ /**
571
+ * Dismiss the enrollment prompt ("Set up later") until the next sign-in. It stops for good after three dismissals.
572
+ * @async
573
+ * @roles admin, developer, billing, user
574
+ * @param {Object} [params]
575
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
576
+ * @returns {Promise<Object>} The response from the server ({ due: false })
577
+ */
578
+ dismissTwoFactorPrompt({ options }?: {
579
+ options?: import("../SignalHouseSDK.js").RequestOptions;
580
+ }): Promise<any>;
581
+ /**
582
+ * Send a sign-in code by text or email for a pending two-factor challenge. Not needed for "app".
583
+ * @async
584
+ * @roles public
585
+ * @param {Object} params
586
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
587
+ * @param {string} params.method - "sms" or "email"
588
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
589
+ * @returns {Promise<Object>} The response from the server ({ sent, target, expiresInSeconds })
590
+ */
591
+ sendTwoFactorChallengeCode({ challengeId, method, options }: {
592
+ challengeId: string;
593
+ method: string;
594
+ options?: import("../SignalHouseSDK.js").RequestOptions;
595
+ }): Promise<any>;
596
+ /**
597
+ * Verify a sign-in code (or a backup code) for a pending two-factor challenge and receive the session JWT.
598
+ * With rememberDevice the response also carries a deviceToken to pass on later logins.
599
+ * @async
600
+ * @roles public
601
+ * @param {Object} params
602
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
603
+ * @param {string} params.code - The 6-digit code, or a backup code (xxxx-xxxx)
604
+ * @param {string} [params.method] - The method the code came from ("app", "sms" or "email"); defaults to the primary method
605
+ * @param {boolean} [params.usingBackupCode] - True when code is a backup code
606
+ * @param {boolean} [params.rememberDevice] - Trust this device for 30 days
607
+ * @param {string} [params.deviceName] - Label for the trusted device (e.g. "Chrome on Windows")
608
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
609
+ * @returns {Promise<Object>} The response from the server ({ token, deviceToken? })
610
+ */
611
+ verifyTwoFactorChallenge({ challengeId, code, method, usingBackupCode, rememberDevice, deviceName, options }: {
612
+ challengeId: string;
613
+ code: string;
614
+ method?: string;
615
+ usingBackupCode?: boolean;
616
+ rememberDevice?: boolean;
617
+ deviceName?: string;
618
+ options?: import("../SignalHouseSDK.js").RequestOptions;
619
+ }): Promise<any>;
620
+ /**
621
+ * Cancel a pending two-factor challenge (e.g. "Back to sign in")
622
+ * @async
623
+ * @roles public
624
+ * @param {Object} params
625
+ * @param {string} params.challengeId - From the mfaRequired login or exchange response
626
+ * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
627
+ * @returns {Promise<Object>} The response from the server ({ cancelled: true })
628
+ */
629
+ cancelTwoFactorChallenge({ challengeId, options }: {
630
+ challengeId: string;
631
+ options?: import("../SignalHouseSDK.js").RequestOptions;
632
+ }): Promise<any>;
228
633
  }
229
634
  export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
230
635
  export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
@@ -165,6 +165,46 @@ export class Brands {
165
165
  client: any;
166
166
  multipartClient: any;
167
167
  enableAdmin: any;
168
+ admin: {
169
+ /**
170
+ * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
171
+ * subgroups are separate businesses. Each subgroup gets an account and business verifications of its own under it.
172
+ * Staff only.
173
+ * @async
174
+ * @roles signalhouse_api, signalhouse_admin, signalhouse_user
175
+ * @param {Object} params - The parameters for getting the toll-free ISV account
176
+ * @param {string} params.groupId - The ID of the group whose toll-free ISV account to get
177
+ * @param {RequestOptions} [params.options] - Additional options for the request
178
+ * @throws {Error} Throws an error if the groupId parameter is missing
179
+ * @returns {Promise<SdkResponse<TollFreeIsvAccount|null>>} The group's toll-free ISV account, or null when it has none. The API key secret is never returned. The API returns 404 when the group does not exist or is not active.
180
+ */
181
+ getTollFreeIsvAccount: ({ groupId, options }: {
182
+ groupId: string;
183
+ options?: RequestOptions;
184
+ }) => Promise<SdkResponse<TollFreeIsvAccount | null>>;
185
+ /**
186
+ * Register a group's toll-free ISV account, or replace the API key of the account it already has. Staff only. The
187
+ * toll-free provider checks the account and key before they are stored. Register it before the group has any toll-free
188
+ * records at the provider; after that, only the API key of the same account can be replaced.
189
+ * @async
190
+ * @roles signalhouse_admin
191
+ * @param {Object} params - The parameters for setting the toll-free ISV account
192
+ * @param {string} params.groupId - The ID of the group whose toll-free ISV account to set
193
+ * @param {string} params.accountSid - The SID of the group's own top-level account at the toll-free provider (AC followed by 32 lowercase hexadecimal characters)
194
+ * @param {string} params.apiKeySid - The SID of a Main API key in that account, which can create subaccounts (SK followed by 32 lowercase hexadecimal characters)
195
+ * @param {string} params.apiKeySecret - The API key's secret (1 to 128 characters), stored encrypted and never returned
196
+ * @param {RequestOptions} [params.options] - Additional options for the request
197
+ * @throws {Error} Throws an error if the groupId, accountSid, apiKeySid or apiKeySecret parameter is missing
198
+ * @returns {Promise<SdkResponse<TollFreeIsvAccount>>} The stored toll-free ISV account, without the API key secret. The API returns 400 when the provider refuses the account or its key, and 404 when the group does not exist or is not active.
199
+ */
200
+ setTollFreeIsvAccount: ({ groupId, accountSid, apiKeySid, apiKeySecret, options }: {
201
+ groupId: string;
202
+ accountSid: string;
203
+ apiKeySid: string;
204
+ apiKeySecret: string;
205
+ options?: RequestOptions;
206
+ }) => Promise<SdkResponse<TollFreeIsvAccount>>;
207
+ };
168
208
  /**
169
209
  * Get a list of brands with optional filters
170
210
  * @async
@@ -363,44 +403,6 @@ export class Brands {
363
403
  details: BusinessVerificationDetails;
364
404
  options?: RequestOptions;
365
405
  }): Promise<SdkResponse<BusinessVerification>>;
366
- /**
367
- * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
368
- * subgroups are separate businesses. Each subgroup gets an account and business verifications of its own under it.
369
- * Staff only.
370
- * @async
371
- * @roles signalhouse_api, signalhouse_admin, signalhouse_user
372
- * @param {Object} params - The parameters for getting the toll-free ISV account
373
- * @param {string} params.groupId - The ID of the group whose toll-free ISV account to get
374
- * @param {RequestOptions} [params.options] - Additional options for the request
375
- * @throws {Error} Throws an error if the groupId parameter is missing
376
- * @returns {Promise<SdkResponse<TollFreeIsvAccount|null>>} The group's toll-free ISV account, or null when it has none. The API key secret is never returned. The API returns 404 when the group does not exist or is not active.
377
- */
378
- getTollFreeIsvAccount({ groupId, options }: {
379
- groupId: string;
380
- options?: RequestOptions;
381
- }): Promise<SdkResponse<TollFreeIsvAccount | null>>;
382
- /**
383
- * Register a group's toll-free ISV account, or replace the API key of the account it already has. Staff only. The
384
- * toll-free provider checks the account and key before they are stored. Register it before the group has any toll-free
385
- * records at the provider; after that, only the API key of the same account can be replaced.
386
- * @async
387
- * @roles signalhouse_admin
388
- * @param {Object} params - The parameters for setting the toll-free ISV account
389
- * @param {string} params.groupId - The ID of the group whose toll-free ISV account to set
390
- * @param {string} params.accountSid - The SID of the group's own top-level account at the toll-free provider (AC followed by 32 lowercase hexadecimal characters)
391
- * @param {string} params.apiKeySid - The SID of a Main API key in that account, which can create subaccounts (SK followed by 32 lowercase hexadecimal characters)
392
- * @param {string} params.apiKeySecret - The API key's secret (1 to 128 characters), stored encrypted and never returned
393
- * @param {RequestOptions} [params.options] - Additional options for the request
394
- * @throws {Error} Throws an error if the groupId, accountSid, apiKeySid or apiKeySecret parameter is missing
395
- * @returns {Promise<SdkResponse<TollFreeIsvAccount>>} The stored toll-free ISV account, without the API key secret. The API returns 400 when the provider refuses the account or its key, and 404 when the group does not exist or is not active.
396
- */
397
- setTollFreeIsvAccount({ groupId, accountSid, apiKeySid, apiKeySecret, options }: {
398
- groupId: string;
399
- accountSid: string;
400
- apiKeySid: string;
401
- apiKeySecret: string;
402
- options?: RequestOptions;
403
- }): Promise<SdkResponse<TollFreeIsvAccount>>;
404
406
  /**
405
407
  * Create a local Short Code brand for manual Signal House review.
406
408
  * @async
@@ -382,6 +382,20 @@ export class Campaigns {
382
382
  campaignId: string;
383
383
  options?: RequestOptions;
384
384
  }): Promise<SdkResponse<any>>;
385
+ /**
386
+ * Get today's T-Mobile usage against the daily limit for every active campaign in a group that has one. The same limits and counter as getCampaignThroughputLimits, for the whole group in one call.
387
+ * @async
388
+ * @roles api, admin, developer, billing, user
389
+ * @param {Object} params - Parameters for reading group throughput usage
390
+ * @param {string} params.groupId - Group identifier
391
+ * @param {RequestOptions} [params.options] - Additional request options
392
+ * @throws {Error} Throws an error if the groupId parameter is missing
393
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
394
+ */
395
+ getGroupThroughputUsage({ groupId, options }: {
396
+ groupId: string;
397
+ options?: RequestOptions;
398
+ }): Promise<SdkResponse<any>>;
385
399
  /**
386
400
  * Create a new campaign
387
401
  * @async