package version import ( "fmt" "os" "gitgud.io/mike/mpv-manager/internal/recoverytrust" ) func validateUpdateRecoveryDirectory(path string, protectedLevels int) error { if err := recoverytrust.ValidateDirectory(path, protectedLevels); err != nil { return fmt.Errorf("untrusted update recovery directory: %w", err) } return nil } func validateUpdateRecoveryFile(path string) error { if err := recoverytrust.ValidateFile(path); err != nil { return fmt.Errorf("untrusted update recovery file: %w", err) } return nil } func validateJournalKeyPermissions(path string, _ os.FileInfo) error { if err := recoverytrust.ValidatePrivateFile(path); err != nil { return fmt.Errorf("update journal authentication key %s must be private to its owner: %w", path, err) } return nil } func createJournalKeyFile(path string) (*os.File, error) { return recoverytrust.CreatePrivateFile(path) }