func getRestorePathsCommands(inputDir string, outputDir string, doc *models.Document) ([]string, uint64) { out := []string{} var noFiles uint64 sortedKeys := doc.GetSortedFilesKeys() for _, shortPath := range sortedKeys { file := doc.Files[shortPath] if len(*restorePattern) != 0 && len(shortPath) != 0 && !glob.Glob(*restorePattern, shortPath) { continue } noFiles++ var cmds []string if len(shortPath) == 0 { shortPath = "." } if file.IsDirectory { cmds = getRestoreDirectoryCommands(inputDir, outputDir, shortPath, file) } else { cmds = getRestoreFileCommands(inputDir, outputDir, shortPath, file) } out = append(out, cmds...) out = append(out, "") } return out, noFiles }
func encryptIndexKey(doc *models.Document, password string) { key := utils.EncryptDataArmored([]byte(doc.KeyUnencrypted), password) doc.KeyEncrypted = string(key) }
func decryptIndexKey(doc *models.Document, password string) { doc.KeyUnencrypted = string(utils.DecryptDataArmored([]byte(doc.KeyEncrypted), password)) }