SmolBox.Files (SmolBox v0.1.0)

Copy Markdown View Source

Guest workspace paths and byte digests.

File operations are confined lexically to /workspace. This validation does not resolve guest symlinks; the file transport and host artifact store must enforce their own filesystem boundary. Percent signs, backslashes, traversal, repeated separators, and non-UTF-8 paths are deliberately unsupported.

Summary

Functions

Encode a validated guest path for the worker's wildcard file route.

Compute a lowercase SHA-256 digest of file bytes.

Functions

encode_path(path)

@spec encode_path(term()) :: {:ok, String.t()} | {:error, SmolBox.Error.t()}

Encode a validated guest path for the worker's wildcard file route.

sha256(bytes)

@spec sha256(binary()) :: String.t()

Compute a lowercase SHA-256 digest of file bytes.

validate_path(path)

@spec validate_path(term()) :: :ok | {:error, SmolBox.Error.t()}