@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
65 lines (64 loc) • 3.49 kB
TypeScript
import { DecryptionOptions } from "../types";
/**
* @class data
* @memberof util
*/
export declare class Data {
private vlf;
private ErrorHandler;
private _alreadyDecryptedData;
/**
* @function getData
* @memberOf util.data
* @description Returns the data object with the given filename (JSON, stored in data folder).
* @param {String} filename - The name of the data file.
* @param {String} [source=data] - The source key defined under params.import of the config file.
* @returns {Object} The data object.
* @example const data = util.data.getData("myTest");
*/
getData(filename: string, source?: string): object;
/**
* @function getSecureData
* @memberOf util.data
* @description Returns and encrypts the data object with the given filename (JSON, stored in data folder). Will return the local file object if private key is not accessible.
* @param {String} filename - The name of the data file (without suffix '.secure' or '.local').
* @param {String} [source=data] - The source key defined under params.import of the config file.
* @param {Object} [options] - The options object.
* @returns {Object} The encrypted or local data object.
* @example const secureData = util.data.getSecureData("myTest");
*/
getSecureData(filename: string, source?: string, options?: DecryptionOptions): object;
/**
* @function readDataFromFile
* @memberOf util.data
* @description Reads the data object from the given filepath.
* @param {String} filePath - The filepath.
* @returns {Object} The data object.
* @example const data = util.data.readDataFromFile("./data/myData.json");
*/
readDataFromFile(filePath: string): Promise<any>;
/**
* @function writeDataToFile
* @memberOf util.data
* @description Writes the data object to the given filepath.
* @param {String} filePath - The filepath.
* @param {Object} data - The data object to write.
* @example const data = util.data.writeDataToFile("myTest");
*/
writeDataToFile(filePath: string, data: any): Promise<void>;
/**
* @function decrypt
* @memberOf util.data
* @description Decrypts the passed input data.
* @param {String | Array<String>} data - The encrypted data to decrypt. Single value or array of values for different keys.
* @param {Object} options - The decryption options.
* @returns {String} The decrypted data.
* @example const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7bef334d26a391a1934cf47338b749d99426980ee4cc7a81deaef21439c6894ab0324cdb29b9b6332635baca442651c5d37847f52bb90b8868e037271a7d456024b39b65fdf4dc62e8d82a3d5683a72e4324c59d339742fc79749f0ee74abef916d38e306218adc48e3547a2b346962249320c962d22cb46d9998de36d8219a2496c0997d0fc389f76fb1431a9b57c317886e9c9795c0a09ad98d9fa0b7687d10814dc7973397f3f72a227a04ead4c3d1d428c096a51922ffc4d7afc3952df1c130def5c5fb3e834605cbf1454885966cc65c77046343f4c678e74931fb2dd6cac8dae17837cf674f288d6550dd7fa6b01f5b7ea68aa6bd27d79dd5d53edb5fd4b4edce824bd31b3939352ad7a71a16bab8c54025c2bb92c54e022fcd23ff08bc54a17fc50d00dc3b884cadbfdefe1e75901fdf80e7324ad02a891f2c4863fa120ca238520b79126c65a03");
*/
decrypt(data: string | Array<string>, options: DecryptionOptions): string;
private _decryptRecursively;
private _isHex;
private _isBase64EncodedHex;
}
declare const _default: Data;
export default _default;