UNPKG

@contentstack/cli-auth

Version:

Contentstack CLI plugin for authentication activities

49 lines (48 loc) 1.69 kB
import { User } from '../interfaces'; /** * @class * Auth handler */ declare class AuthHandler { private _client; private _host; set client(contentStackClient: any); set host(contentStackHost: any); /** * * * Login into Contentstack * @param {string} email Contentstack email address * @param {string} password User's password for contentstack account * @returns {Promise} Promise object returns authtoken on success * TBD: take out the otp implementation from login and create a new method/function to handle otp */ /** * Handle the OTP flow for 2FA authentication * @param tfaToken Optional pre-provided TFA token * @param loginPayload Login payload containing user credentials * @returns Promise<string> The TFA token to use for authentication */ private handleOTPFlow; /** * Request SMS OTP for 2FA authentication * @param loginPayload Login payload containing user credentials * @throws CLIError if SMS request fails */ private requestSMSOTP; login(email: string, password: string, tfaToken?: string): Promise<User>; /** * Logout from Contentstack * @param {string} authtoken authtoken that needs to invalidated when logging out * @returns {Promise} Promise object returns response object from Contentstack */ logout(authtoken: string): Promise<object>; /** * Validate token * @param {string} authtoken * @returns {Promise} Promise object returns response object from Contentstack */ validateAuthtoken(authtoken: string): Promise<object>; } declare const _default: AuthHandler; export default _default;