static public void convertTextToByteFile(string relPathTxt, string relPath) { string path = IOFacilitator.homePath(); string command = "xxd -r " + path + relPathTxt + " > " + path + relPath; ShellFacilitator.Bash(command); }
static public string convertByteToTextFile(string relPath) { string path = IOFacilitator.homePath() + relPath; string command = "xxd " + path + " > " + path + ".txt"; ShellFacilitator.Bash(command); return(path + ".txt"); }
static public void setupFolderStructure() { string command = "mkdir " + IOFacilitator.homePath(); // create env folder ShellFacilitator.Bash(command + "/env"); // create wallet_export folder ShellFacilitator.Bash(command + "/wallet_export"); }
static public async Task <string> backupEHR(string walletId, string ehrJson) { // encrypt ehr data CipherFacilitator cipher = new CipherFacilitator(); string encryptedEHR = cipher.encrypt(ehrJson); string relPath = walletId + "ESjson.temp"; IOFacilitator.createFile(encryptedEHR, relPath); IpfsFacilitator ipfs = new IpfsFacilitator(); string localPath = IOFacilitator.homePath() + relPath; string ipfsPath = await ipfs.addFile(localPath); ShellFacilitator.Bash("rm -f " + localPath); EHRBackupModel model = new EHRBackupModel(ipfsPath, cipher.getKey(), cipher.getIV()); model.exportToJsonFile(walletId); return(model.toJson()); }