コード例 #1
0
ファイル: restore.go プロジェクト: srhnsn/securefilearchiver
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
}
コード例 #2
0
ファイル: index.go プロジェクト: srhnsn/securefilearchiver
func encryptIndexKey(doc *models.Document, password string) {
	key := utils.EncryptDataArmored([]byte(doc.KeyUnencrypted), password)
	doc.KeyEncrypted = string(key)
}
コード例 #3
0
ファイル: index.go プロジェクト: srhnsn/securefilearchiver
func decryptIndexKey(doc *models.Document, password string) {
	doc.KeyUnencrypted = string(utils.DecryptDataArmored([]byte(doc.KeyEncrypted), password))
}