@yeci226/hoyoapi
Version:
HoYoAPI is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.
42 lines (41 loc) • 1.44 kB
TypeScript
import { IActionTicket, IAuthLoginResult, ILoginByPasswordOptions } from './auth.interface';
/**
* Authentication module used to retrieve special tokens (stoken_v2)
* via App Login mechanisms.
*
* @class
* @category Main
*/
export declare class AuthClient {
/**
* Login to HoyoVerse by account/password securely to fetch stoken_v2.
*
* @async
* @param {ILoginByPasswordOptions} options - Contains account, password and optional aigis headers
* @returns {Promise<IAuthLoginResult>} The object dictating the authentication progress
*/
loginByPassword(options: ILoginByPasswordOptions): Promise<IAuthLoginResult>;
/**
* Send email verification code for a new device login.
*/
sendVerificationCode(actionTicket: IActionTicket, deviceId: string): Promise<{
status: 'sent' | 'error' | 'rate_limited';
message?: string;
}>;
/**
* Verify email code to complete new device login.
*/
verifyActionTicket(actionTicket: IActionTicket, code: string, deviceId: string): Promise<{
status: 'success' | 'error';
message?: string;
}>;
/**
* Exchange stoken_v2 to ltoken_v2 and cookie_token_v2.
*
* @async
* @param {string} stokenV2 - The stoken_v2 value.
* @param {string} mid - The mid value.
* @returns {Promise<{ ltokenV2: string, cookieTokenV2: string } | null>}
*/
private exchangeTokens;
}