Spectre.GAM.Principal (Spectre v0.4.0)

Copy Markdown View Source

Portable identity named by a domain's genesis or later governance acts.

A principal identifies a participant; it does not, by itself, grant any authority. Authority is carried exclusively by mandates.

Summary

Functions

Returns the plain, string-keyed ledger representation.

Returns the content-derived reference, independent of an assigned ref.

Returns the stable digest of the complete canonical record.

Restores a principal from its canonical map.

Builds and validates a principal.

Types

t()

@type t() :: %Spectre.GAM.Principal{
  attributes: map(),
  display_name: String.t() | nil,
  kind: :human | :organization | :service | :agent | :system,
  ref: String.t(),
  schema_version: 1
}

Functions

canonical(principal)

@spec canonical(t()) :: map()

Returns the plain, string-keyed ledger representation.

content_ref(principal)

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

Returns the content-derived reference, independent of an assigned ref.

digest(principal)

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

Returns the stable digest of the complete canonical record.

from_canonical(value)

@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}

Restores a principal from its canonical map.

new(principal)

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

Builds and validates a principal.