UNPKG

1.32 kBTypeScriptView Raw
1/// <reference types="node" />
2export declare type APIUtilsEncoding = BufferEncoding | "urlsafe";
3export declare class APIUtils {
4 static getRawTypeName(obj: any): any;
5 static generateShortID(): any;
6 static generateLongID(length?: number): string;
7 static slugify(text: string): string;
8 static convertToType(value: any, convertToType: string): any;
9 static toBoolean(input: any): boolean;
10 static coalesce(...inputArgs: any[]): any;
11 static getFunctionParamNames(fn: Function): string[];
12 private static _IV_LENGTH;
13 private static _CRYPTO_ALG;
14 private static _HASH_ALG;
15 static bufferToString(buffer: Buffer, encoding: APIUtilsEncoding): string;
16 static stringToBuffer(theString: string, encoding: APIUtilsEncoding): Buffer;
17 static encrypt(content: string | Buffer, password?: string, encoding?: APIUtilsEncoding): string;
18 static decrypt(content: string | Buffer, password?: string, encoding?: APIUtilsEncoding): string;
19 static hashString(text: string, encoding?: APIUtilsEncoding): string;
20 static hashMD5(text: string, encoding?: APIUtilsEncoding): string;
21 /**
22 * Creates an expiration date in seconds since UNIX epoch from now.
23 * @param expirationInSeconds
24 */
25 static createExpirationInSeconds(expirationInSeconds: number): number;
26}