Karta.Domains.Domain (Karta v1.0.0)

A domain an organisation sends mail from.

name is kept in lower-case ASCII form (A-labels, Karta.Mail.Punycode), without a trailing dot. A domain is verified when verified_at is set: only verified domains may appear as the author or envelope sender of the organisation's mail, and only their DKIM keys sign. A name is verified for at most one organisation at a time.

Ownership. verification_token is a random value (160 bits, base32) that the organisation publishes in a TXT record to prove that it controls the name (Karta.Domains.check_ownership/2). verified_by says how the domain was verified: :dns (by that record) or :operator (by an administrator of the instance). The last check of the record is kept:

  • ownership_result - :found, :missing (no record with the token), :taken (found, but another organisation has verified the name) or :failed (the lookup failed); nil before the first check;
  • ownership_checked_at - when;
  • ownership_missing_since - for a domain verified by its record, when checks first stopped finding it (cleared when one finds it again).

Publishing (Karta.DNS.Publish, where the instance publishes the domain's zone): dns_synced_at is when the last publication finished; dns_failure what failed or was left alone then, or why a later one could not finish (dns_failed_at); nil when all went well.

tls_rpt_rua is where senders send the domain's TLS reports (Karta.Domains.TLSReporting).

Summary

Functions

Only the name comes from input; the organisation, token and verification are set by the context.

Marks the domain verified at now by by (:dns or :operator), or keeps the time and the way it was verified.

Types

t()

@type t() :: %Karta.Domains.Domain{
  __meta__: term(),
  dkim_keys: term(),
  dns_failed_at: term(),
  dns_failure: term(),
  dns_synced_at: term(),
  id: term(),
  inserted_at: term(),
  name: term(),
  organisation: term(),
  organisation_id: term(),
  ownership_checked_at: term(),
  ownership_missing_since: term(),
  ownership_result: term(),
  tls_rpt_rua: term(),
  updated_at: term(),
  verification_token: term(),
  verified_at: term(),
  verified_by: term()
}

Functions

changeset(domain, attrs)

Only the name comes from input; the organisation, token and verification are set by the context.

verify_changeset(domain, by, now \\ DateTime.utc_now())

Marks the domain verified at now by by (:dns or :operator), or keeps the time and the way it was verified.