// SPDX-License-Identifier: GPL-2.0-only
/*
 *  ppm/include/ppm/archive.h
 *
 *  Copyright (C) 2026 Project Tick
 */

#ifndef PPM_ARCHIVE_H
#define PPM_ARCHIVE_H

#include <ppm/error.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Archive — thin libarchive wrapper specialised for the tar.zst format ppm
 * uses for every published package.
 *
 * Extraction is sandboxed: absolute paths, symlink escapes, and ".." entries
 * are rejected. The destination directory must be empty when extraction begins.
 */

ppm_error_t ppm_archive_extract(const char *tarball_path,
                                const char *dest_dir);

#ifdef __cplusplus
}
#endif

#endif /* PPM_ARCHIVE_H */
