SaltDns.Registrar (Salt v1.0.0)

The optional registrar module: Salt DNS holds accounts at domain registrars and buys, renews and manages domain names through them. An outside billing system only coordinates: it asks Salt, and registrar credentials never leave Salt. Off unless SALT_DNS_REGISTRAR=on; an installation without it is unchanged. See docs/registrar.md.

The registrar is reached through an adapter (SaltDns.Registrar.Adapter, the plug-in point); SaltDns.Registrar.Openprovider is the one Salt ships. Adapters are registered by name and each provider row names its adapter:

config :salt_dns, SaltDns.Registrar,
  adapters: %{"openprovider" => SaltDns.Registrar.Openprovider}

Creating zones is not part of this module: it only sets the name servers of a registered name.

Name servers and glue

A name server is a plain host name or a map with :name and the optional :ipv4 and :ipv6. A name server that is the domain itself or under it (in bailiwick) must have an address (glue); an address on one outside the domain is refused, because the registry ignores or refuses it. See SaltDns.Registrar.NameServers. The addresses a domain is read with are kept in domain.name_server_addresses and carried forward by a later set_name_servers/4 that names the same server without an address.

Money

Money is always an integer in minor units (cents) next to an ISO currency code: %{minor: 1117, currency: "USD"}. See SaltDns.Registrar.Money.

Calls that spend money

register/3, transfer/3, renew/4 and restore/3 spend money; nothing else in this module does. Each has three guards:

  1. An operation reference (:reference, chosen by the caller, unique per organisation). The same reference never buys twice. A row of the operations ledger (SaltDns.Registrar.Operation) is inserted before the registrar is called. The same reference with the same request (the fingerprint: kind, name, years, owner contact, privacy, ceiling, currency, and the name servers with their glue when there is any) returns the stored operation and buys nothing, also when the first call is still with the registrar. The same reference with another request is :reference_reuse.
  2. A price ceiling (:max_cost_minor and :currency). Salt reads the price from the registrar immediately before buying and refuses with :price_above_ceiling if it is higher or in another currency.
  3. Premium names are refused (:invalid with premium: true) unless the call has allow_premium: true; the premium price must still be within the ceiling.

What a caller gets

{:ok, operation} with operation.state :done, :pending (the registrar has not finished; sync_domain/2 resolves it) or :started (a repeat of a call that is still with the registrar), and operation.domain (nil until the registrar has taken the order), or {:error, {kind, message}}. A repeat of a failed operation returns the same error.

When a call ends without a final answer (the registrar was not reached, or the process died), the operation stays :started. The next call with the same reference first looks the name up at the registrar (lookup/2 of the adapter) and completes the operation from what it finds; only when the name is not there does it order. A :started operation that ended with an error is resumed at once; one that just sits there is left alone for :stale_after seconds (default 600, longer than the slowest execution can take, see default_stale_after/0) so a call that is still running is not doubled.

Errors

{:error, {kind, message}} with kind one of :insufficient_funds, :name_unavailable, :price_above_ceiling, :reference_reuse, :invalid, :rate_limited, :registrar_unavailable, :not_found, :locked, :unauthorized and :provider. message is a string, or a map with a :message and extras: :current_minor, :current_currency, :ceiling_minor and :ceiling_currency (:price_above_ceiling), :fields (:invalid), :retry_after in seconds (:rate_limited).

Contacts

A contact (the registrant) goes to the registrar and Salt keeps only the caller's reference, its version and the registrar's handle (SaltDns.Registrar.Contact). Admin, tech and billing contacts of every name are the provider's company_handle.

History

Every operation and connection test leaves a SaltDns.Registrar.Event. Events hold names, amounts and error kinds; never credentials, auth codes or personal data. (The zone audit table is for zone changes and does not fit here; certificates keep their own events table in the same way.)

Summary

Functions

Gives up an operation that is stuck at :started, so that its name is free again (the live-acquisition index of an operation in flight blocks every other order for the name). It never abandons blindly: it first looks the name up at the registrar.

The account at the registrar: {:ok, %{balance: minor, reserved: minor, currency: "USD"}}.

The currency of the registrar account, read from it and kept a few minutes. The API refuses a request in another currency instead of converting.

The provider an organisation's calls go to (the organisation of an API token; a provisioning token's customers are served through its own organisation): its own provider that is not disabled (the oldest), else a shared provider (one of no organisation) that is not disabled and that lists the organisation as allowed (see allow_organisation/2), else nil. A shared provider is never used by an organisation the operator has not allowed, at any level, including reading the account.

The adapter module of a provider, or nil when its name is not registered.

The names of the registered adapters, sorted.

The registered adapters, by name.

Lets an organisation use a shared provider (one of no organisation). Only the operator does this, from the command line (SaltDns.Release.registrar_allow/2); no console page and no API call reaches it. Returns the provider.

The transfer authorisation code. It is returned and never stored or logged; only the fact that it was asked for is recorded.

Changeset for the provider form.

Whether names are free, with what they cost for period years (option period, default 1). One map per name

The one thing the background work does to an operation that is :started: look the name up at the registrar and complete the operation from what is found. The adapter calls made here are lookup/2 and nothing else (no price read, no register, transfer, renew or restore), so this function cannot place an order. Returns :completed, :nothing_ordered (the registrar does not have the name, or not as ordered; the operation is left open so the caller's next call with the reference orders it), :open (the lookup failed) or :busy (another call has the operation).

The state of the e-mail verification of a contact: {:ok, %{state: :verified | :pending | :failed | :none, status: String.t() | nil}}.

Adds a provider to an organisation (nil for one shared by the whole installation). Nothing is sent to the registrar; test_connection/1 does that.

The names of the API tokens that asked for these operations, by credential id.

The default number of seconds after which an operation that sits at :started with no error is taken for dead. It is longer than the slowest execution (a lookup, a price read and the order, each at most 4 requests of 40 s); the clock is restarted just before the order. Change it with config :salt_dns, SaltDns.Registrar, stale_after: seconds.

Deletes a provider that no domain, operation or contact uses.

Turns a provider off: nothing is sent to it until enable_provider/1.

Takes an organisation off the list of a shared provider (operator, command line).

Turns a disabled provider on again (status :new: test the connection).

True when the module is switched on (SALT_DNS_REGISTRAR=on).

Fails one operation that stayed :started although the registrar answered with its own error code: a refusal (a non-zero code in the registrar's envelope, HTTP 500 included) means nothing was ordered, so the operation must not keep its name held or be resumed. Only an operation in :started whose recorded error is such a refusal is changed; anything else is refused. Writes the same operation.failed event as any other failure.

The contact stored under the caller's reference, or nil.

A domain of the organisation by id (an integer or its text), or nil.

A domain of the organisation by name, or nil.

The operation the organisation stored under a reference (with its domain), or nil.

A provider the organisation may use (see list_providers/1), or nil. id is an integer or its text.

A provider by id, without an organisation check (internal).

The domains of an organisation, by name.

The latest history of a domain, newest first.

The latest operations of an organisation, newest first.

The providers an organisation may use: its own, and the shared ones (those of no organisation) it has been allowed to use by the operator. A shared provider the organisation is not allowed to use is not listed at all.

The price of one operation on a domain for period years, read from the registrar now and stored nowhere: :create, :renew, :transfer or :restore. This is the price shown before a renewal; renew/4 reads it again just before it buys and refuses above the ceiling the caller gives.

The price list of an extension ("com") for period years (option period, default 1): see SaltDns.Registrar.Adapter.price_list/0. The totals are the registrar's own for that period. The list has :fetched_at, when the registrar was asked. Cached for a few minutes per extension and period; fresh: true skips the cache.

Creates or updates a registrant contact at the registrar. ref is the caller's reference for it (unique per organisation) and version the number the caller keeps: the contact is created the first time, updated when version is higher than the stored one, and left alone (nothing is sent) when it is the same. An older version is :invalid. contact is a map with :name (%{first_name:, last_name:}), :company_name, :email, :phone (%{country_code:, area_code:, subscriber_number:}), :address (%{street:, number:, zipcode:, city:, country:}) and :locale. Salt does not keep it; only the registrar does.

Reads again every domain the registrar holds for us that has not been read for 20 hours: expiry, status, lock, name servers. Returns how many were read.

Registers a name. params: :name, :years (1 to 10), :owner_contact (the reference of a contact from put_contact/5, at this provider), :name_servers (host names; empty means the registrar's default), :privacy (default false) and :autorenew (default false). opts: :organisation (the owner of the domain), :reference, :max_cost_minor, :currency, :allow_premium (default false). Admin, tech and billing contacts are the provider's company_handle, which must be set. See the module documentation for the guards and the return values.

Renews a domain of the organisation for years (1 to 10); a domain of another organisation is :not_found. opts: :reference, :max_cost_minor, :currency, :allow_premium.

Sends the verification e-mail of a contact again.

Restores a domain in its redemption period. opts as for renew/4.

Looks at every operation that has been :started for longer than the stale time (a crash or a timeout in the middle). It never orders anything. For each one it asks the registrar whether the name is there (complete_from_lookup/1), completes the operation if it is, and leaves it for the caller's retry if it is not. Returns %{completed: n, open: n}.

Sends the expiry reminders that are due (60, 30 and 7 days before a domain expires) to the owners and admins of its organisation. See SaltDns.Registrar.Reminders; returns its counts.

True when the registrar account of via (the organisation of the API token, see active_provider/1) is the one the domain is held at. Only then may a call that reaches the registrar, or hands out a secret, be made through the domain; otherwise only the stored record may be read.

Sets automatic renewal at the registrar, then stores it.

Turns DNSSEC on or off at the registrar. dnssec is %{enabled: boolean, keys: [%{flags:, protocol:, alg:, pub_key:}]}: the DNSKEY fields of the zone's keys, not a DS record.

Sets the transfer lock at the registrar, then stores it.

Replaces the name servers at the registrar, then stores them. Each entry is a host name or a map with :name and the optional :ipv4 and :ipv6 (see SaltDns.Registrar.NameServers). An in-bailiwick name server needs an address; an address on an out-of-bailiwick one is refused. An address stored with the domain is kept when its name server is given again without one.

Turns WHOIS privacy at the registrar on or off, then stores it. Whether the extension allows it is the registrar's answer: {:error, {:invalid, message}} when it does not.

Reads again every operation that is :pending (the registrar had not finished), by syncing its domain. Returns how many were looked at.

Reads the domain again from the registrar and stores what it says: status, dates, renewal, lock, privacy, name servers, DNSSEC. When the registrar now says the name is active, operations of it that were :pending become :done; when it says the order failed, they become :failed. A domain with no registrar reference cannot be read.

Logs in and reads the account, then stores the result: status :ok with the last error cleared, or :error with the registrar's message in last_error. Returns the provider as stored and the account (see account/1), or the provider as stored and the error.

Starts a transfer in. params as for register/3, with :auth_code (the code the current registrar gave; it is sent and never stored or logged) and :years defaulting to 1. The operation is usually :pending; sync_domain/2 resolves it.

Changes a provider's name, adapter, user name, company handle, password (blank keeps the old one) or mode. A change of the adapter, credentials or mode sets the status back to :new until the connection is tested again.

Types

error()

@type error() :: {:error, {atom(), String.t() | map()}}

Functions

abandon_operation(organisation, reference, opts \\ [])

@spec abandon_operation(SaltDns.Accounts.Organisation.t(), String.t(), keyword()) ::
  {:ok, SaltDns.Registrar.Operation.t()} | error()

Gives up an operation that is stuck at :started, so that its name is free again (the live-acquisition index of an operation in flight blocks every other order for the name). It never abandons blindly: it first looks the name up at the registrar.

  • the registrar holds the name as ordered (or the renewal is shown to have gone through): the operation is completed, not abandoned;
  • the registrar does not hold the name, or holds it without the order having happened: the operation becomes :failed with the kind :provider and the message "abandoned";
  • the lookup fails, or the renewal cannot be shown either way: nothing changes and the error is returned.

An operation that is still within :stale_after seconds of its last sign of life, and has no error recorded, is taken to be running and is refused. Whatever its error, "nothing was ordered" is concluded only when the last attempt is at least :stale_after seconds old (after a timeout the registrar may still complete the order); before that, when the lookup finds nothing, the call is refused with :invalid and nothing changes. A name that is found is completed at any age. Returns the operation.

account(provider)

@spec account(SaltDns.Registrar.Provider.t()) :: {:ok, map()} | error()

The account at the registrar: {:ok, %{balance: minor, reserved: minor, currency: "USD"}}.

account_currency(provider)

@spec account_currency(SaltDns.Registrar.Provider.t()) :: {:ok, String.t()} | error()

The currency of the registrar account, read from it and kept a few minutes. The API refuses a request in another currency instead of converting.

active_provider(organisation)

The provider an organisation's calls go to (the organisation of an API token; a provisioning token's customers are served through its own organisation): its own provider that is not disabled (the oldest), else a shared provider (one of no organisation) that is not disabled and that lists the organisation as allowed (see allow_organisation/2), else nil. A shared provider is never used by an organisation the operator has not allowed, at any level, including reading the account.

adapter(provider)

@spec adapter(SaltDns.Registrar.Provider.t()) :: module() | nil

The adapter module of a provider, or nil when its name is not registered.

adapter_names()

@spec adapter_names() :: [String.t()]

The names of the registered adapters, sorted.

adapters()

@spec adapters() :: %{required(String.t()) => module()}

The registered adapters, by name.

allow_organisation(provider, organisation_id)

@spec allow_organisation(SaltDns.Registrar.Provider.t(), integer()) ::
  {:ok, SaltDns.Registrar.Provider.t()} | {:error, :not_shared}

Lets an organisation use a shared provider (one of no organisation). Only the operator does this, from the command line (SaltDns.Release.registrar_allow/2); no console page and no API call reaches it. Returns the provider.

auth_code(organisation, domain, opts \\ [])

The transfer authorisation code. It is returned and never stored or logged; only the fact that it was asked for is recorded.

change_provider(provider, attrs \\ %{})

@spec change_provider(SaltDns.Registrar.Provider.t(), map()) :: Ecto.Changeset.t()

Changeset for the provider form.

check(provider, names, opts \\ [])

@spec check(SaltDns.Registrar.Provider.t(), [String.t()], keyword()) ::
  {:ok, [map()]} | error()

Whether names are free, with what they cost for period years (option period, default 1). One map per name:

%{name: "example.org",
  status: :free | :taken | :premium | :unavailable,
  period: years,
  costs: %{create: money, renew: money, transfer: money, restore: money,
           renew_yearly: money},
  promotion: nil | %{ends_on: Date | nil, non_promotion: money},
  min_period: years, max_period: years, privacy_allowed: boolean,
  quarantine_days: days, soft_quarantine_days: days, fetched_at: DateTime}

create, renew and transfer are totals for the period, read from the registrar for that period and never multiplied; renew_yearly is the price of renewing for one year. For a period of one year create is the registrar's price for that very name (it differs for premium names); for longer periods it is the price of the extension, and the price of the name itself is read again when it is ordered. The price list is cached for a few minutes per extension and period. A cost the registrar did not give is nil. Options: fresh: true skips the cache. A period the extension does not allow is :invalid naming the field "period". At most 100 names; they are normalised and repeated names are asked once.

complete_from_lookup(operation)

@spec complete_from_lookup(SaltDns.Registrar.Operation.t()) ::
  :completed | :nothing_ordered | :open | :busy

The one thing the background work does to an operation that is :started: look the name up at the registrar and complete the operation from what is found. The adapter calls made here are lookup/2 and nothing else (no price read, no register, transfer, renew or restore), so this function cannot place an order. Returns :completed, :nothing_ordered (the registrar does not have the name, or not as ordered; the operation is left open so the caller's next call with the reference orders it), :open (the lookup failed) or :busy (another call has the operation).

contact_verification(provider, organisation, ref, opts \\ [])

@spec contact_verification(
  SaltDns.Registrar.Provider.t(),
  SaltDns.Accounts.Organisation.t(),
  String.t(),
  keyword()
) :: {:ok, map()} | error()

The state of the e-mail verification of a contact: {:ok, %{state: :verified | :pending | :failed | :none, status: String.t() | nil}}.

create_provider(organisation, attrs)

@spec create_provider(SaltDns.Accounts.Organisation.t() | nil, map()) ::
  {:ok, SaltDns.Registrar.Provider.t()} | {:error, Ecto.Changeset.t()}

Adds a provider to an organisation (nil for one shared by the whole installation). Nothing is sent to the registrar; test_connection/1 does that.

credential_names(operations)

@spec credential_names([SaltDns.Registrar.Operation.t()]) :: %{
  required(integer()) => String.t()
}

The names of the API tokens that asked for these operations, by credential id.

default_stale_after()

@spec default_stale_after() :: pos_integer()

The default number of seconds after which an operation that sits at :started with no error is taken for dead. It is longer than the slowest execution (a lookup, a price read and the order, each at most 4 requests of 40 s); the clock is restarted just before the order. Change it with config :salt_dns, SaltDns.Registrar, stale_after: seconds.

delete_provider(provider)

@spec delete_provider(SaltDns.Registrar.Provider.t()) ::
  {:ok, SaltDns.Registrar.Provider.t()} | {:error, :in_use}

Deletes a provider that no domain, operation or contact uses.

disable_provider(provider)

@spec disable_provider(SaltDns.Registrar.Provider.t()) ::
  {:ok, SaltDns.Registrar.Provider.t()}

Turns a provider off: nothing is sent to it until enable_provider/1.

disallow_organisation(provider, organisation_id)

@spec disallow_organisation(SaltDns.Registrar.Provider.t(), integer()) ::
  {:ok, SaltDns.Registrar.Provider.t()} | {:error, :not_shared}

Takes an organisation off the list of a shared provider (operator, command line).

enable_provider(provider)

@spec enable_provider(SaltDns.Registrar.Provider.t()) ::
  {:ok, SaltDns.Registrar.Provider.t()}

Turns a disabled provider on again (status :new: test the connection).

enabled?()

@spec enabled?() :: boolean()

True when the module is switched on (SALT_DNS_REGISTRAR=on).

fail_refused_operation(organisation, id)

@spec fail_refused_operation(SaltDns.Accounts.Organisation.t(), integer()) ::
  {:ok, SaltDns.Registrar.Operation.t()} | error()

Fails one operation that stayed :started although the registrar answered with its own error code: a refusal (a non-zero code in the registrar's envelope, HTTP 500 included) means nothing was ordered, so the operation must not keep its name held or be resumed. Only an operation in :started whose recorded error is such a refusal is changed; anything else is refused. Writes the same operation.failed event as any other failure.

get_contact(organisation, ref)

The contact stored under the caller's reference, or nil.

get_domain(organisation, id)

A domain of the organisation by id (an integer or its text), or nil.

get_domain_by_fqdn(organisation, fqdn)

@spec get_domain_by_fqdn(SaltDns.Accounts.Organisation.t(), String.t()) ::
  SaltDns.Registrar.Domain.t() | nil

A domain of the organisation by name, or nil.

get_operation(organisation, reference)

The operation the organisation stored under a reference (with its domain), or nil.

get_provider(organisation, id)

A provider the organisation may use (see list_providers/1), or nil. id is an integer or its text.

get_provider!(id)

@spec get_provider!(integer()) :: SaltDns.Registrar.Provider.t()

A provider by id, without an organisation check (internal).

list_domains(organisation)

The domains of an organisation, by name.

list_events(domain, limit \\ 50)

The latest history of a domain, newest first.

list_operations(organisation, limit \\ 100)

The latest operations of an organisation, newest first.

list_providers(organisation)

The providers an organisation may use: its own, and the shared ones (those of no organisation) it has been allowed to use by the operator. A shared provider the organisation is not allowed to use is not listed at all.

price(organisation, domain, operation, period)

The price of one operation on a domain for period years, read from the registrar now and stored nowhere: :create, :renew, :transfer or :restore. This is the price shown before a renewal; renew/4 reads it again just before it buys and refuses above the ceiling the caller gives.

prices(provider, extension, opts \\ [])

@spec prices(SaltDns.Registrar.Provider.t(), String.t(), keyword()) ::
  {:ok, map()} | error()

The price list of an extension ("com") for period years (option period, default 1): see SaltDns.Registrar.Adapter.price_list/0. The totals are the registrar's own for that period. The list has :fetched_at, when the registrar was asked. Cached for a few minutes per extension and period; fresh: true skips the cache.

put_contact(provider, organisation, ref, version, contact, opts \\ [])

Creates or updates a registrant contact at the registrar. ref is the caller's reference for it (unique per organisation) and version the number the caller keeps: the contact is created the first time, updated when version is higher than the stored one, and left alone (nothing is sent) when it is the same. An older version is :invalid. contact is a map with :name (%{first_name:, last_name:}), :company_name, :email, :phone (%{country_code:, area_code:, subscriber_number:}), :address (%{street:, number:, zipcode:, city:, country:}) and :locale. Salt does not keep it; only the registrar does.

Returns {:ok, %SaltDns.Registrar.Contact{}} (the handle is contact.handle).

refresh_domains()

@spec refresh_domains() :: non_neg_integer()

Reads again every domain the registrar holds for us that has not been read for 20 hours: expiry, status, lock, name servers. Returns how many were read.

register(provider, params, opts)

Registers a name. params: :name, :years (1 to 10), :owner_contact (the reference of a contact from put_contact/5, at this provider), :name_servers (host names; empty means the registrar's default), :privacy (default false) and :autorenew (default false). opts: :organisation (the owner of the domain), :reference, :max_cost_minor, :currency, :allow_premium (default false). Admin, tech and billing contacts are the provider's company_handle, which must be set. See the module documentation for the guards and the return values.

renew(organisation, domain, years, opts)

Renews a domain of the organisation for years (1 to 10); a domain of another organisation is :not_found. opts: :reference, :max_cost_minor, :currency, :allow_premium.

resend_contact_verification(provider, organisation, ref, opts \\ [])

@spec resend_contact_verification(
  SaltDns.Registrar.Provider.t(),
  SaltDns.Accounts.Organisation.t(),
  String.t(),
  keyword()
) :: :ok | error()

Sends the verification e-mail of a contact again.

restore(organisation, domain, opts)

Restores a domain in its redemption period. opts as for renew/4.

resume_stuck()

@spec resume_stuck() :: %{completed: non_neg_integer(), open: non_neg_integer()}

Looks at every operation that has been :started for longer than the stale time (a crash or a timeout in the middle). It never orders anything. For each one it asks the registrar whether the name is there (complete_from_lookup/1), completes the operation if it is, and leaves it for the caller's retry if it is not. Returns %{completed: n, open: n}.

send_expiry_reminders()

@spec send_expiry_reminders() :: %{
  sent: non_neg_integer(),
  failed: non_neg_integer(),
  skipped: non_neg_integer()
}

Sends the expiry reminders that are due (60, 30 and 7 days before a domain expires) to the owners and admins of its organisation. See SaltDns.Registrar.Reminders; returns its counts.

served?(via, provider_id)

True when the registrar account of via (the organisation of the API token, see active_provider/1) is the one the domain is held at. Only then may a call that reaches the registrar, or hands out a secret, be made through the domain; otherwise only the stored record may be read.

set_autorenew(organisation, domain, on, opts \\ [])

Sets automatic renewal at the registrar, then stores it.

set_dnssec(organisation, domain, dnssec, opts \\ [])

Turns DNSSEC on or off at the registrar. dnssec is %{enabled: boolean, keys: [%{flags:, protocol:, alg:, pub_key:}]}: the DNSKEY fields of the zone's keys, not a DS record.

set_lock(organisation, domain, locked, opts \\ [])

Sets the transfer lock at the registrar, then stores it.

set_name_servers(organisation, domain, name_servers, opts \\ [])

Replaces the name servers at the registrar, then stores them. Each entry is a host name or a map with :name and the optional :ipv4 and :ipv6 (see SaltDns.Registrar.NameServers). An in-bailiwick name server needs an address; an address on an out-of-bailiwick one is refused. An address stored with the domain is kept when its name server is given again without one.

set_privacy(organisation, domain, private, opts \\ [])

Turns WHOIS privacy at the registrar on or off, then stores it. Whether the extension allows it is the registrar's answer: {:error, {:invalid, message}} when it does not.

sweep_pending()

@spec sweep_pending() :: non_neg_integer()

Reads again every operation that is :pending (the registrar had not finished), by syncing its domain. Returns how many were looked at.

sync_domain(organisation, domain, opts \\ [])

Reads the domain again from the registrar and stores what it says: status, dates, renewal, lock, privacy, name servers, DNSSEC. When the registrar now says the name is active, operations of it that were :pending become :done; when it says the order failed, they become :failed. A domain with no registrar reference cannot be read.

test_connection(provider)

@spec test_connection(SaltDns.Registrar.Provider.t()) ::
  {:ok, SaltDns.Registrar.Provider.t(), map()}
  | {:error, SaltDns.Registrar.Provider.t(), {atom(), String.t() | map()}}

Logs in and reads the account, then stores the result: status :ok with the last error cleared, or :error with the registrar's message in last_error. Returns the provider as stored and the account (see account/1), or the provider as stored and the error.

transfer(provider, params, opts)

Starts a transfer in. params as for register/3, with :auth_code (the code the current registrar gave; it is sent and never stored or logged) and :years defaulting to 1. The operation is usually :pending; sync_domain/2 resolves it.

update_provider(provider, attrs)

@spec update_provider(SaltDns.Registrar.Provider.t(), map()) ::
  {:ok, SaltDns.Registrar.Provider.t()} | {:error, Ecto.Changeset.t()}

Changes a provider's name, adapter, user name, company handle, password (blank keeps the old one) or mode. A change of the adapter, credentials or mode sets the status back to :new until the connection is tested again.