import { APIResource } from "../../core/resource.js"; import { APIPromise } from "../../core/api-promise.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Mfa extends APIResource { /** * Unset MFA for the current user by removing TOTP secret. * * This endpoint removes the user's TOTP secret to disable MFA in StackAuth. * * Args: deps (tuple[AdminUserService, StackAuthClient, str]): Common dependencies * containing: - AdminUserService: Service for user operations. - StackAuthClient: * Client for auth operations. - str: Tenant ID for the current request. * current_user (CurrentUser): Current authenticated user. token (str): Bearer * token from Authorization header (required for MFA endpoints). cache_manager * (CacheManager): Cache manager instance for invalidating auth cache. * * Returns: MfaResponse: Response containing: - success (bool): Whether MFA was * successfully removed. - message (str): Success message confirming MFA was unset. * * Raises: HTTPException: - 401: If Bearer token is not provided. - 404: If current * user is not found. - 500: If MFA removal fails due to system error. */ delete(params?: MfaDeleteParams | null | undefined, options?: RequestOptions): APIPromise; /** * Generate a TOTP secret and store it temporarily in cache. * * Rejects the request with 409 if the user already has MFA enabled. Idempotently * returns the same pending secret if one was already issued and hasn't expired * yet. * * Args: deps (tuple[AdminUserService, StackAuthClient, str]): Service, StackAuth * client, tenant id. current_user (CurrentUser): Authenticated user. * * Returns: GenerateMfaSecretResponse: Provision id and base32 secret. */ provision(params?: MfaProvisionParams | null | undefined, options?: RequestOptions): APIPromise; /** * Enable MFA for the current user. * * Requires `provision_id` from `POST /admin/users/mfa/provision` and the matching * 6-digit TOTP code. On success, persists MFA to StackAuth and clears the * provision cache entry. * * Args: request (EnableMfaRequest): Request body with `provision_id` and `code`. * deps (tuple[AdminUserService, StackAuthClient, str]): Common dependencies * containing: - AdminUserService: Service for user operations. - StackAuthClient: * Client for auth operations. - str: Tenant ID for the current request. * current_user (CurrentUser): Current authenticated user. token (str): Bearer * token from Authorization header (required for MFA endpoints). cache_manager * (CacheManager): Cache manager instance for invalidating auth cache. * * Returns: MfaResponse: Response containing: - success (bool): Whether MFA was * successfully set. - message (str): Success message confirming MFA was set. * * Raises: HTTPException: - 400: If the provision is missing/expired, the TOTP code * is invalid, or the verification attempt cap for this provision has been * exceeded. - 401: If Bearer token is not provided. - 404: If current user is not * found. - 422: If request body validation fails. - 500: If MFA setup fails due to * system error. */ set(params: MfaSetParams, options?: RequestOptions): APIPromise; } /** * Response model for MFA operations. * * Attributes: success (bool): Whether MFA operation was successful. message (str): * Success message. */ export interface MfaResponse { /** * Success message */ message: string; /** * Whether MFA operation was successful */ success: boolean; } /** * Response model for generating an MFA secret (TOTP provisioning). * * Attributes: provision_id (str): Provision identifier to be used during confirm. * secret_base32 (str): Base32 secret without padding for manual entry and * client-side otpauth URI. */ export interface MfaProvisionResponse { /** * Provision id used for confirm */ provision_id: string; /** * TOTP secret base32 (no padding) for manual entry */ secret_base32: string; } export interface MfaDeleteParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export interface MfaProvisionParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export interface MfaSetParams { /** * Body param: 6-digit TOTP code */ code: string; /** * Body param: Provision id from /mfa/provision */ provision_id: string; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace Mfa { export { type MfaResponse as MfaResponse, type MfaProvisionResponse as MfaProvisionResponse, type MfaDeleteParams as MfaDeleteParams, type MfaProvisionParams as MfaProvisionParams, type MfaSetParams as MfaSetParams, }; } //# sourceMappingURL=mfa.d.ts.map