feat(package): download and verify prebuilt binary variants
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 1m5s

This commit is contained in:
faumaray committed 2026-12-03 20:17:17 +03:00
1 parent 118c0dc860
commit 9b405ce772
9 files changed
+199 -3

No files matched your search

+13
View File
@@ -67,6 +67,19 @@ select_compatible_signed_binary(const BinaryCompatibilityKey &key,
const std::vector<BinaryVariantMeta> &available,
const std::vector<std::string> &trusted_public_keys_hex);
struct BinaryFetchOptions {
std::filesystem::path cache_dir;
std::vector<std::string> trusted_public_keys;
};
// Selects a compatible binary variant (verifying its trusted signature when keys are supplied),
// downloads the artifact into `<cache_dir>/binaries/<sha256>` with SHA-256 verification, and
// reuses a cached artifact only when its digest still matches.
[[nodiscard]] Void::Result::Result<BinaryVariantMeta, Void::Result::Error>
materialize_binary_variant(const BinaryCompatibilityKey &key,
const std::vector<BinaryVariantMeta> &available,
const BinaryFetchOptions &options);
// Acquires and verifies a source dependency (local path, exact pinned Git SHA, or
// SHA-256 verified archive) into managed storage without ever modifying external checkouts.
[[nodiscard]] Void::Result::Result<MaterializedSource, Void::Result::Error>
@@ -47,6 +47,12 @@ download_release_archive(std::string_view registry_url, std::string_view package
std::string_view version, std::string_view expected_sha256,
const std::filesystem::path &dest_file, const RegistryAuth &auth = {});
// Downloads a prebuilt binary artifact from an absolute http(s) URL into `dest_file`,
// rejecting any content whose SHA-256 differs from `expected_sha256` (verified before writing).
[[nodiscard]] Void::Result::Result<std::filesystem::path, Void::Result::Error>
download_binary_artifact(std::string_view url, std::string_view expected_sha256,
const std::filesystem::path &dest_file);
// Publishes a verified deterministic archive via PUT /api/v1/packages/<name>/<version>.
[[nodiscard]] Void::Result::Result<PublishReceipt, Void::Result::Error>
publish_package_archive(const PublishOptions &options);