SaltDns.Credentials.Credential (Salt v1.0.0)

An API token or a TSIG key of an organisation, with its grants.

API tokens keep only the SHA-256 of their secret (secret_hash) next to a clear token_id. TSIG keys keep the shared secret encrypted at rest (tsig_secret, SaltDns.Vault, context "tsig_key"). Both are redacted from inspect/1. grants is a list of SaltDns.Auth.Grants grants, or :invalid when the stored value does not validate (see SaltDns.Credentials.GrantList).

Summary

Functions

True when the credential may be used at now: not revoked, not expired.

True when the credential's registrar level is at least level (:read or :purchase; :purchase includes :read).

The levels of access to the registrar module, lowest first.

Types

t()

@type t() :: %SaltDns.Credentials.Credential{
  __meta__: term(),
  created_by_user: term(),
  created_by_user_id: term(),
  expires_at: term(),
  grants: term(),
  id: term(),
  inserted_at: term(),
  kind: term(),
  last_used_at: term(),
  name: term(),
  organisation: term(),
  organisation_id: term(),
  provisioning: term(),
  registrar: term(),
  revoked_at: term(),
  secret_hash: term(),
  token_id: term(),
  tsig_algorithm: term(),
  tsig_key_name: term(),
  tsig_secret: term(),
  updated_at: term()
}

Functions

active?(credential, now \\ DateTime.utc_now())

@spec active?(t(), DateTime.t()) :: boolean()

True when the credential may be used at now: not revoked, not expired.

registrar?(credential, level)

@spec registrar?(t(), :read | :purchase) :: boolean()

True when the credential's registrar level is at least level (:read or :purchase; :purchase includes :read).

registrar_levels()

@spec registrar_levels() :: [atom()]

The levels of access to the registrar module, lowest first.