Durable, downloadable artifacts an actor produces for a principal (e.g. a
CSV). An export is a blob persisted to cyclium_exports, fetched on demand
via a signed, expiring link — scoped to the principal that requested it.
This is the framework half; a web app mounts a small controller that verifies
the token (valid_token?/2), loads the export (fetch_valid/1), checks the
caller owns it, and streams the content. Any actor in any app can create
exports (see Cyclium.Tools.CsvExport).
Configuration
config :cyclium, :export_signing_secret, "<a long random secret>"
config :cyclium, :export_ttl_seconds, 604_800 # optional, default 7 daysThe token is an HMAC of the export id (no external signing dep); the TTL is
enforced server-side via expires_at, so the token itself carries no expiry.
Summary
Functions
Create an export. Required: :principal_type, :principal_id, :filename,
:content. Optional: :type (default "csv"), :content_type,
:episode_id, :conversation_id, :ttl_seconds. Stamps created_at,
expires_at, and byte_size.
Fetch an export by id only if it exists and has not expired.
Delete all expired exports. Returns the number deleted. Schedule periodically.
An opaque HMAC token binding a download link to one export id.
Constant-time check that token was issued by sign/1 for id.
Functions
@spec create(map()) :: {:ok, Cyclium.Schemas.Export.t()} | {:error, Ecto.Changeset.t()}
Create an export. Required: :principal_type, :principal_id, :filename,
:content. Optional: :type (default "csv"), :content_type,
:episode_id, :conversation_id, :ttl_seconds. Stamps created_at,
expires_at, and byte_size.
@spec fetch_valid(binary()) :: Cyclium.Schemas.Export.t() | nil
Fetch an export by id only if it exists and has not expired.
@spec purge_expired() :: non_neg_integer()
Delete all expired exports. Returns the number deleted. Schedule periodically.
An opaque HMAC token binding a download link to one export id.
Constant-time check that token was issued by sign/1 for id.