feat: add mfa code completion from TOTP key

This commit is contained in:
TheDevYellowy
2025-01-20 03:48:11 -06:00
parent c1f6f5e78c
commit 5fbca25c45
4 changed files with 224 additions and 3 deletions

24
typings/index.d.ts vendored
View File

@@ -3428,6 +3428,29 @@ export class ThreadMemberFlags extends BitField<ThreadMemberFlagsString> {
public static resolve(bit?: BitFieldResolvable<ThreadMemberFlagsString, number>): number;
}
export class TOTP {
private static hex2dec(hex: string): number;
private static dec2hex(dec: number): string;
private static base32ToBuffer(str: string): ArrayBuffer;
private static asciiToBuffer(str: string): ArrayBuffer;
private static hex2buf(hex: string): ArrayBuffer;
private static buf2hex(buf: ArrayBuffer): string;
private static readonly base32: { [key: number]: number };
private static readonly crypto: SubtleCrypto;
static generate(key: string, options?: generateOptions): Promise<{ otp: string; expires: number}>;
}
export type TOTPAlgorithm = "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512";
export type TOTPEncoding = "hex" | "ascii";
export interface generateOptions {
digits: number;
algorithm: TOTPAlgorithm;
encoding: TOTPEncoding;
period: number;
timestamp: number;
}
export class Typing extends Base {
private constructor(channel: TextBasedChannel, user: PartialUser, data?: RawTypingData);
public channel: TextBasedChannel;
@@ -5711,6 +5734,7 @@ export interface ClientOptions {
ws?: WebSocketOptions;
http?: HTTPOptions;
rejectOnRateLimit?: string[] | ((data: RateLimitData) => boolean | Promise<boolean>);
TOTPKey?: string;
}
export type ClientPresenceStatus = 'online' | 'idle' | 'dnd';