AshHooks.InboundSource

Copy Markdown View Source

A host-owned resource for inbound webhook keys, provider selection and pause.

Sources use opaque keys through AshHooks.Custody. The host owns the data layer, policies and migrations. Source and ledger resources must have the same tenancy and non-nullable scope attributes. Provider aliases select modules from a compile-time allowlist. Each ledger declaration's source_record must name a source whose ledger is that declaring resource.

The extension injects the following attributes for host migrations:

  • The declaration-name attribute (:source by default) is a required atom. Each locally declared scope attribute is required. :provider is a required atom constrained to the allowlist's aliases.
  • :secret_ref and :previous_secret_ref are nullable opaque reference strings. :secret_kind and :previous_secret_kind are nullable terms.
  • :public_key and :public_key_kind are nullable terms for pinned sender verification material outside custody. Its kind must be one of AshHooks.Custody.PublicKey's closed asymmetric kinds, and the material must decode under that kind before creation or registration. :paused is a required boolean defaulting to false.
  • :secret_created_at, :secret_first_used_at, :previous_secret_created_at, :previous_secret_first_used_at and :previous_secret_retired_at are nullable microsecond UTC datetimes.

Without a host primary key, the extension adds a writable UUID :id with a generated default. The :unique_source identity comprises the declaration-name attribute and scope attributes, under the resource's tenancy. Host attributes with injected names must match their type, constraints and nullability.

Lifecycle functions are system writes using authorize?: false. Authorize callers before invoking them and restrict direct access to injected machine actions. Generated disclosures are returned once and must be delivered to the sender securely. They are never stored on the source.

Injected machine actions are :roll_secret, :schedule_previous_retirement, :expire_previous_secret, :register_public_key, :pause, :unpause, :mark_current_secret_used, :mark_previous_secret_used, :set_custody_keys and :read_custody_owner. Secret-bearing arguments are sensitive. Direct kind input is refused on host create and update actions. Direct reference input is always refused; use create_source/3 to issue and attach references through the key registry.

inbound_source

An inbound source with custody keys and a durable provider allowlist.

Options

NameTypeDefaultDocs
ledger requiredmoduleThe InboundDelivery resource this source feeds.
providers requiredkeywordProvider alias to module allowlist. Rows store aliases.
custodian requiredmoduleThe AshHooks.Custody implementation. Sources have no byte resolver path.
key_registry requiredmoduleKeyRegistry resource with the same transactional data layer and repository for writes, and matching attribute tenancy.
source_attributeatom:sourceAttribute holding the inbound declaration name.
scopelist({atom, any, keyword})[]Locally declared {name, type, constraints} scope attributes, matching the ledger's scope_identity.
custody_tenant_keymfaCanonical custody tenant hook for a tenant type without built-in canonicalization.
max_overlap_secondspos_integerMaximum permitted overlap in seconds, at least the effective default.
default_overlap_secondsnon_neg_integerDefault overlap in seconds. Defaults to 86,400; zero is a hard cut.