EndPointBlank.Management.Credentials (end_point_blank_elixir v0.12.0)

Copy Markdown View Source

/api/v1/credentials: runtime client credentials, the client_id and client_secret an application environment's SDK authenticates with. Through EndPointBlank.Management.for_managed_client/2, a managed client's.

A credential is %{"id", "client_id", "secret_last_4", "application_environment_id", "application_id", "environment", "previous_secret", "expired_at", "created_at", "updated_at"}: metadata only. The secret itself, "client_secret", is in the answer to create/3 and rotate/3 and nowhere else, ever: store it then. This module never logs it.

If that answer is lost, a retry with the same Idempotency-Key is refused with "idempotency_replay_unavailable" (the API does not keep the secret to replay it). Get or list the credential to see where it stands, and rotate it for a new secret.

Summary

Functions

Issues a credential for an application environment. attrs: application_environment_id (required). The answer carries "client_secret", shown this once. Options: idempotency_key:.

Revokes credential id: %{"id", "deleted" => true}. Refused with "delete_refused" when intake revoked it but its record could not be removed: retry the call.

One credential (metadata only).

One page of credentials (metadata only). Options: limit:, after:, application_environment_id:.

Issues a new secret for credential id; the old one keeps working for the grace window ("previous_secret"). The answer carries the new "client_secret", shown this once. Options: idempotency_key:.

Every credential, with list/2's filter. Raises EndPointBlank.Management.Error.

Functions

create(client, attrs, opts \\ [])

Issues a credential for an application environment. attrs: application_environment_id (required). The answer carries "client_secret", shown this once. Options: idempotency_key:.

delete(client, id)

Revokes credential id: %{"id", "deleted" => true}. Refused with "delete_refused" when intake revoked it but its record could not be removed: retry the call.

get(client, id)

One credential (metadata only).

list(client, opts \\ [])

One page of credentials (metadata only). Options: limit:, after:, application_environment_id:.

revoke(client, id)

Same as delete/2.

rotate(client, id, opts \\ [])

Issues a new secret for credential id; the old one keeps working for the grace window ("previous_secret"). The answer carries the new "client_secret", shown this once. Options: idempotency_key:.

stream(client, opts \\ [])

@spec stream(
  EndPointBlank.Management.t(),
  keyword()
) :: Enumerable.t()

Every credential, with list/2's filter. Raises EndPointBlank.Management.Error.