Kantoor.ApiKeys.ApiKey (Kantoor v1.0.0)

An operator API key: the credential of an external system that provisions customers through /api/v1/provisioning.

The row keeps an 8-character prefix, to find it, and an Argon2id hash of the secret; the key itself (kprov_<prefix>_<secret>) is shown once, when it is created. scopes say what it may do, operator names who owns the resources it provisions (keys with the same operator see the same domains and users, no other key sees them). A revoked or expired key never authenticates.

Summary

Functions

What input may set; the prefix, hash and dates are set by Kantoor.ApiKeys.

Every scope a key can have.

Types

t()

@type t() :: %Kantoor.ApiKeys.ApiKey{
  __meta__: term(),
  created_by: term(),
  created_by_id: term(),
  expires_at: term(),
  id: term(),
  inserted_at: term(),
  last_used_at: term(),
  name: term(),
  operator: term(),
  prefix: term(),
  rate_limit_per_minute: term(),
  revoked_at: term(),
  scopes: term(),
  secret_hash: term(),
  updated_at: term()
}

Functions

changeset(key, attrs)

What input may set; the prefix, hash and dates are set by Kantoor.ApiKeys.

scopes()

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

Every scope a key can have.