Karta.Domains.DKIMKey (Karta v1.0.0)

A DKIM key of a domain. The private key is encrypted at rest (Karta.Auth.DKIM.EncryptedKey); public_key is the record to publish at record_name/2 (<selector>._domainkey.<domain>).

State:

  • :pending - generated, not used yet (publish its record first);
  • :active - signs the domain's mail; at most one per algorithm, so a domain with an Ed25519 and an RSA key signs twice;
  • :retiring - replaced by a newer key; no longer signs, but its record stays published while mail signed with it may still be checked (retiring_at says since when);
  • :retired - done; its record can be removed.

Rotation (Karta.Domains.rotate_dkim_key/1, Karta.Domains.Rotation): a pending key with replaces_id set replaces that active key. Its record is looked up every hour: record_checked_at is the last lookup that answered, record_seen_at when the record was first found since it was last missing.

Summary

Functions

The choices that come from input: algorithm, bits (RSA only: 2048, 3072 or 4096, default 2048) and selector (default karta- and eight random characters). The key itself is generated by the context.

Where the public key is published.

Types

t()

@type t() :: %Karta.Domains.DKIMKey{
  __meta__: term(),
  activated_at: term(),
  algorithm: term(),
  bits: term(),
  domain: term(),
  domain_id: term(),
  id: term(),
  inserted_at: term(),
  private_key: term(),
  public_key: term(),
  record_checked_at: term(),
  record_seen_at: term(),
  replaces: term(),
  replaces_id: term(),
  retiring_at: term(),
  selector: term(),
  state: term(),
  updated_at: term()
}

Functions

changeset(key, attrs)

The choices that come from input: algorithm, bits (RSA only: 2048, 3072 or 4096, default 2048) and selector (default karta- and eight random characters). The key itself is generated by the context.

record_name(dkim_key, map)

@spec record_name(t(), Karta.Domains.Domain.t()) :: String.t()

Where the public key is published.