UNPKG

browserify-steam-totp

Version:
53 lines (52 loc) 2.06 kB
export declare class SteamAuthenticator { private readonly _DIGITS; private readonly _PERIOD; private readonly _ALPHABET; /** * Get the current time in seconds, optionally with a time offset * @param timeOffset Time offset in seconds (optional) * @returns The current time in seconds `number` */ getTime(timeOffset?: number): number; /** * Generate a one-time authentication code (TOTP) * @param secret The secret key as a string * @param timeOffset Time offset in seconds (optional) * @returns The generated one-time authentication code `string` */ generateAuthCode(secret: string, timeOffset?: number): string; /** * Generate a confirmation key for Steam * @param identitySecret The secret key for Steam authentication * @param time Unix time in seconds * @param tag The tag for the key (e.g., 'conf') * @returns The confirmation key `string` */ generateConfirmationKey(identitySecret: string, time: number, tag: string): string; /** * Generate the device ID based on the SteamID * @param steamid The user's SteamID * @returns The device ID `string` */ getDeviceId(steamid: string): string; /** * Asynchronously get the time offset from Steam servers * @returns An object with the time offset and the request time */ getTimeOffsetAsync(): Promise<{ offset: number; time: number; }>; /** * Get the time offset from Steam servers using a callback * @param callback The callback function to return the error or result */ getTimeOffset(callback: (error?: Error, offset?: number, time?: number) => void): void; /** * Convert the secret string into a format that can be used by CryptoJS * @param secret The secret string (in hex or base64) * @returns The parsed secret as a CryptoJS `WordArray` */ private bufferizeSecret; } export declare const SteamTotp: SteamAuthenticator;