Karta. Provisioning. Keys
(Karta v1.0.0)
Creating and checking the keys of the provisioning API.
A key reads kprov_ + an 8-character lookup prefix + _ + a 32-character
secret (lower-case base32). Like an API key of a mail server
(Karta.Credentials) it is shown once, and kept as an Argon2id hash. A
key made here is useless on every other API, and no other key works on
the provisioning API.
Summary
Functions
The key a key text belongs to, when it is not revoked; otherwise :error.
Makes a key named name (at most 100 characters) with scopes (default:
["provisioning"]). Returns it with the key text, which is shown once.
True when the key has the scope. provisioning includes provisioning:read.
Revokes the key with this prefix or id; {:error, :not_found} when there is none.
Functions
@spec authenticate(String.t()) :: {:ok, Karta.Provisioning.Key.t()} | :error
The key a key text belongs to, when it is not revoked; otherwise :error.
@spec create(String.t(), [String.t()]) :: {:ok, Karta.Provisioning.Key.t(), String.t()} | {:error, String.t()}
Makes a key named name (at most 100 characters) with scopes (default:
["provisioning"]). Returns it with the key text, which is shown once.
@spec has_scope?(Karta.Provisioning.Key.t(), String.t()) :: boolean()
True when the key has the scope. provisioning includes provisioning:read.
@spec revoke(String.t()) :: {:ok, Karta.Provisioning.Key.t()} | {:error, :not_found}
Revokes the key with this prefix or id; {:error, :not_found} when there is none.