MingaAgent.Tool.Output.Reference (Minga v0.1.0)

Copy Markdown View Source

An address for immutable captured bytes, with no filesystem path or source replay instruction.

Summary

Functions

Hashes the exact captured bytes.

Computes the namespace identity without exposing the durable session ID.

Builds a reference from validated persisted facts.

Decodes a token without granting authorization to its namespace.

Builds a token from a durable namespace and a random artifact ID.

Types

t()

@type t() :: %MingaAgent.Tool.Output.Reference{
  bytes: non_neg_integer(),
  items: non_neg_integer() | nil,
  media_type: String.t(),
  sha256: String.t(),
  token: String.t()
}

Functions

digest(bytes)

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

Hashes the exact captured bytes.

namespace(session_id)

@spec namespace(String.t()) :: String.t()

Computes the namespace identity without exposing the durable session ID.

new(attrs)

@spec new(keyword()) :: {:ok, t()} | {:error, :invalid_reference}

Builds a reference from validated persisted facts.

parse(token)

@spec parse(String.t()) ::
  {:ok, String.t(), String.t()} | {:error, :invalid_reference}

Decodes a token without granting authorization to its namespace.

token(session_id, artifact_id)

@spec token(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, :invalid_reference}

Builds a token from a durable namespace and a random artifact ID.