safe_rel (rebar_safe v1.0.1)

View Source

Summary

Functions

Compute SHA256 checksum of binary data, returns lowercase hex binary.

Download specific SAFE version with checksum verification.

Fetch available versions from S3 manifest. The versions.json format is: {"1.0.0": {"macos-x86_64": "sha256", "linux-x86_64": "sha256"}, ...}

Get latest version satisfying a constraint, optionally including prereleases. Constraint format: <<"~> 1.3">> (>= 1.3.0, < 2.0.0) or <<"~> 1.3.1">> (>= 1.3.1, < 1.4.0)

Get path to safe binary

Sort versions descending (highest first) using semver comparison.

Verify checksum matches expected value (case-insensitive, trimmed).

Functions

compute_checksum_data(Data)

-spec compute_checksum_data(binary()) -> binary().

Compute SHA256 checksum of binary data, returns lowercase hex binary.

detect_arch()

-spec detect_arch() -> string().

detect_os()

-spec detect_os() -> string().

download_version(Dir, Version, Checksums)

-spec download_version(string(), binary(), map()) -> {ok, string()} | {error, term()}.

Download specific SAFE version with checksum verification.

fetch_versions()

-spec fetch_versions() -> {ok, map()} | {error, term()}.

Fetch available versions from S3 manifest. The versions.json format is: {"1.0.0": {"macos-x86_64": "sha256", "linux-x86_64": "sha256"}, ...}

get_latest_compatible_version(Constraint)

-spec get_latest_compatible_version(Constraint :: binary()) -> {ok, binary(), map()} | {error, term()}.

Get latest version satisfying a constraint, optionally including prereleases. Constraint format: <<"~> 1.3">> (>= 1.3.0, < 2.0.0) or <<"~> 1.3.1">> (>= 1.3.1, < 1.4.0)

get_safe_binary_path(ProjectDir)

Get path to safe binary

sort_versions_desc(Versions)

-spec sort_versions_desc([binary()]) -> [binary()].

Sort versions descending (highest first) using semver comparison.

verify_checksum(Actual, Expected)

-spec verify_checksum(binary(), binary()) -> boolean().

Verify checksum matches expected value (case-insensitive, trimmed).