Manages downloading, verifying, and caching the SAFE binary.
The binary is stored at <project_root>/_build/safe/safe. A SHA-256
checksum is verified against the manifest before the tarball is extracted.
Summary
Functions
Returns the expected path of the SAFE binary for the given project.
Computes a lowercase hex SHA-256 digest of binary_data.
Detects the CPU architecture and normalises it to the string used in SAFE
release filenames. Returns {:ok, "x86_64"} on all supported architectures
(Intel, AMD, ARM64/Apple Silicon), or {:error, :unsupported_arch}.
Detects the current OS. Returns {:ok, "linux"}, {:ok, "macos"}, or
{:error, :unsupported_platform}.
Ensures the SAFE binary is present at _build/safe/safe.
Normalises an architecture string to the value used in SAFE release filenames.
Returns true when actual and expected represent the same checksum.
Comparison is case-insensitive and trims surrounding whitespace.
Functions
Returns the expected path of the SAFE binary for the given project.
Computes a lowercase hex SHA-256 digest of binary_data.
Detects the CPU architecture and normalises it to the string used in SAFE
release filenames. Returns {:ok, "x86_64"} on all supported architectures
(Intel, AMD, ARM64/Apple Silicon), or {:error, :unsupported_arch}.
SAFE ships a universal macOS binary and an x86_64 Linux binary, so all common architectures map to "x86_64".
Detects the current OS. Returns {:ok, "linux"}, {:ok, "macos"}, or
{:error, :unsupported_platform}.
Ensures the SAFE binary is present at _build/safe/safe.
If the binary already exists, returns :ok immediately.
Otherwise resolves the version (from safe.lock or the S3 manifest),
downloads the tarball, verifies its checksum, extracts it, and writes
safe.lock.
Normalises an architecture string to the value used in SAFE release filenames.
Returns true when actual and expected represent the same checksum.
Comparison is case-insensitive and trims surrounding whitespace.