示例#1
0
        static public void convertTextToByteFile(string relPathTxt, string relPath)
        {
            string path    = IOFacilitator.homePath();
            string command = "xxd -r " + path + relPathTxt + " > " + path + relPath;

            ShellFacilitator.Bash(command);
        }
示例#2
0
        static public string convertByteToTextFile(string relPath)
        {
            string path    = IOFacilitator.homePath() + relPath;
            string command = "xxd " + path + " > " + path + ".txt";

            ShellFacilitator.Bash(command);
            return(path + ".txt");
        }
示例#3
0
        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");
        }
示例#4
0
        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());
        }