import { AxiosResponse } from 'axios'; import { AuthCredential } from '../../models/auth/AuthCredential'; import { RettiwtConfig } from '../../models/RettiwtConfig'; /** * The services that handles authentication. * * @internal */ export declare class AuthService { /** The config object. */ private readonly _config; /** * @param config - The config for Rettiwt. */ constructor(config: RettiwtConfig); /** * Splits the cookie header into a list of key=value pairs. * * @param cookieHeader - The value of the cookie header. * * @returns The list of key=value pairs in the cookies. */ private static _splitCookieHeader; /** * Decodes the encoded cookie string. * * @param encodedCookies - The encoded cookie string to decode. * @returns The decoded cookie string. */ static decodeCookie(encodedCookies: string): string; /** * Encodes the given cookie string. * * @param cookieString - The cookie string to encode. * @returns The encoded cookie string. */ static encodeCookie(cookieString: string): string; /** * Gets a new API key from an HTTP response. * * @param response - The HTTP response received. * @param config - The current Rettiwt config. * * @returns The new API key. */ static getApiKeyFromReponse(response: AxiosResponse, config?: RettiwtConfig): string | undefined; /** * Gets the user's id from the given API key. * * @param apiKey - The API key. * @returns The user id associated with the API key. */ static getUserId(apiKey: string): string; /** * Fetches a fresh CSRF from Twitter by making a lightweight * authenticated request, then rotates the apiKey with the updated cookie. * * @param config - The current Rettiwt config. */ static refreshCsrfToken(config: RettiwtConfig): Promise; /** * Login to twitter as guest. * * @returns A new guest key. * * @example * ``` * import { Rettiwt } from 'rettiwt-api'; * * // Creating a new Rettiwt instance * const rettiwt = new Rettiwt(); * * // Logging in an getting a new guest key * rettiwt.auth.guest() * .then(guestKey => { * // Use the guest key * ... * }) * .catch(err => { * console.log(err); * }); * ``` */ guest(): Promise; }