UNPKG

adba

Version:
44 lines (43 loc) 1.83 kB
export declare function encrypt(text: string, password: string, ivString: string): { encryptedData: string; iv: string; }; export declare function decrypt(encryptedData: string, password: string, ivString: string): string; /** * Generates a unique 6-digit code. * @returns {string} A 6-digit unique code. */ export declare function generateCode(): string; /** * Build a secure token * * @param {Object} data - The payload data * @param {string} pass - The encryption key * @param {string} ivString - ivString * @param {number|string} expiresIn - The expiration time for the token * @returns {string} - Returns the URL-safe encrypted token */ export declare const buildToken: (data: { payload: any; }, pass: string, ivString: string, expiresIn: string) => string; /** * Decrypt a secure token to get the payload data * @param {string} encryptedToken - The encrypted token * @param {string} pass - The decryption key * @param {string} ivString - ivString * @returns {Object|null} - Returns the decrypted payload data, or null if decryption fails */ export declare const readToken: (encryptedToken: string, pass: string, ivString: string) => any; export declare function generatePasswordHash(password: string): Promise<unknown>; export declare function verifyPasswordHash(password: string, hash: string): Promise<unknown>; export declare function getClientType(userAgent: string, device?: string): string; declare const _default: { buildToken: (data: { payload: any; }, pass: string, ivString: string, expiresIn: string) => string; readToken: (encryptedToken: string, pass: string, ivString: string) => any; generatePasswordHash: typeof generatePasswordHash; verifyPasswordHash: typeof verifyPasswordHash; getClientType: typeof getClientType; }; export default _default;