export type TransformFunc = (input: any) => any; export declare class Obfuscator { static defaultReplaceString: string; static defaultReplaceTypes: Array>; /** * Obfuscate a value based on a JSON schema. * * @remarks * Defaults to any value of type 'password' or type 'string' with format 'password'. * * @static * @param value The value to obfuscate. * @param schema The JSON schema describing the value. * @param replace The string to replace/obfuscate with, can be function. * @param types The types of values to replace. * @returns The obfuscated value. * @memberof Obfuscator */ static value(value: any, schema: any, replace?: string | TransformFunc, types?: Array | string>): any; /** * Obfuscate an object based on a JSON schema. * This is an alias for the "value" method * * @remarks * Defaults to any value of type 'password' or type 'string' with format 'password'. * * @static * @param obj The object to obfuscate. * @param schema The JSON schema describing the object. * @param replace The string to replace/obfuscate with, can be function. * @param types The types of values to replace. * @returns The obfuscated object. * @memberof Obfuscator */ static object(obj: any, schema: any, replace?: string | TransformFunc, types?: Array | string>): any; /** * Obfuscate an array based on a JSON schema. * This is an alias for the "value" method * * @remarks * Defaults to any value of type 'password' or type 'string' with format 'password'. * * @static * @param arr The array to obfuscate. * @param schema The JSON schema describing the array. * @param replace The string to replace/obfuscate with, can be function. * @param types The types of values to replace. * @returns The obfuscated array. * @memberof Obfuscator */ static array(arr: any, schema: any, replace?: string | TransformFunc, types?: Array | string>): any; /** * Normalize a replace string/function. * * @static * @param replace String or function to replace values. * @returns Transform function to replace values. * @memberof Obfuscator */ static wrapReplace(replace: string | TransformFunc): TransformFunc; /** * Check if schema is one of type and optionally format. * * @static * @param schema The JSON schema describing a field. * @param types Types and optionally format to check that schema is. * @returns If schema matches any of the types provided returns true, otherwise false. * @memberof Obfuscator */ static predicateTypeFormat(schema: any, types: Array | string>): boolean; /** * Replaces obfuscated text with the previous value. * * @remarks * Useful when accepting a modified object that contains obfuscated values that you wish to store * the unobfuscated values (basically an unobfuscator). * * @static * @param newValue The value to search for replacement string. * @param prevValue The value to replace the new value if replacement string. * @param replaceString The replacement string to search for. * @returns The unobfuscated value. * @memberof Obfuscator */ static unObfuscate(newValue: any, prevValue: any, replaceString?: string): any; }