# `Lockspire.Admin`

Operator-facing service boundary for Lockspire admin workflows.

# `activate_key`

```elixir
@spec activate_key(integer(), map() | keyword()) ::
  {:ok, Lockspire.Admin.Keys.key_view()} | {:error, term()}
```

Activates a key as the current active signing key.

# `create_client`

```elixir
@spec create_client(map() | keyword()) ::
  {:ok, Lockspire.Clients.RegistrationResult.t()}
  | {:error, [Lockspire.Clients.error_detail()] | term()}
```

Creates a new client.

# `disable_client`

```elixir
@spec disable_client(String.t(), map() | keyword()) ::
  {:ok, Lockspire.Domain.Client.t()} | {:error, :not_found | term()}
```

Disables a client.

# `enable_client`

```elixir
@spec enable_client(String.t(), map() | keyword()) ::
  {:ok, Lockspire.Domain.Client.t()} | {:error, :not_found | term()}
```

Enables a client.

# `encryption_status`

```elixir
@spec encryption_status() ::
  {:ok, Lockspire.Admin.Keys.encryption_status()}
  | {:error,
     :repo_not_started | :storage_unavailable | {:invalid_config, String.t()}}
```

Reports how many stored signing keys still need re-encryption.

See `Lockspire.Admin.Keys.encryption_status/0`.

# `generate_key`

```elixir
@spec generate_key(Lockspire.Domain.SigningKey.use_type()) ::
  {:ok, Lockspire.Admin.Keys.key_view()}
  | {:error, :key_encryption_not_configured | term()}
```

Generates a new signing key.

Returns `{:error, :key_encryption_not_configured}` when no key-encryption key is configured.

# `get_client`

```elixir
@spec get_client(String.t()) ::
  {:ok, Lockspire.Domain.Client.t()} | {:error, :not_found | term()}
```

Gets a client by ID.

# `get_consent`

```elixir
@spec get_consent(integer()) ::
  {:ok, Lockspire.Admin.Consents.consent_view() | nil} | {:error, term()}
```

Gets a consent by ID.

# `get_dcr_policy`

```elixir
@spec get_dcr_policy() :: {:ok, Lockspire.Domain.ServerPolicy.t()} | {:error, term()}
```

Gets the Dynamic Client Registration (DCR) policy.

# `get_key`

```elixir
@spec get_key(integer()) ::
  {:ok, Lockspire.Admin.Keys.key_view() | nil} | {:error, term()}
```

Gets a key by its ID.

# `get_server_policy`

```elixir
@spec get_server_policy() ::
  {:ok, Lockspire.Domain.ServerPolicy.t()} | {:error, term()}
```

Gets the server policy.

# `get_token`

```elixir
@spec get_token(integer()) ::
  {:ok, Lockspire.Admin.Tokens.token_detail() | nil} | {:error, term()}
```

Gets token details by ID.

# `list_clients`

```elixir
@spec list_clients(keyword()) ::
  {:ok, [Lockspire.Domain.Client.t()]} | {:error, term()}
```

Lists registered clients.

# `list_consents`

```elixir
@spec list_consents(keyword()) ::
  {:ok, [Lockspire.Admin.Consents.consent_view()]} | {:error, term()}
```

Lists all consents.

# `list_consents_for_account`

```elixir
@spec list_consents_for_account(String.t()) ::
  {:ok, [Lockspire.Admin.Consents.consent_view()]} | {:error, term()}
```

Lists consents for a specific account.

# `list_device_authorizations`

```elixir
@spec list_device_authorizations(keyword()) ::
  {:ok, [Lockspire.Domain.DeviceAuthorization.t()]} | {:error, term()}
```

Lists device authorizations.

# `list_interactions`

```elixir
@spec list_interactions(keyword()) ::
  {:ok, [Lockspire.Domain.Interaction.t()]} | {:error, term()}
```

Lists authorization interactions for operator review.

# `list_keys`

```elixir
@spec list_keys(keyword()) ::
  {:ok, [Lockspire.Admin.Keys.key_view()]} | {:error, term()}
```

Lists all signing keys.

# `list_logout_deliveries`

```elixir
@spec list_logout_deliveries() ::
  {:ok, [Lockspire.Domain.LogoutDelivery.t()]} | {:error, term()}
```

Lists durable logout deliveries for operator review.

# `list_tokens`

```elixir
@spec list_tokens(keyword()) ::
  {:ok, [Lockspire.Admin.Tokens.token_view()]} | {:error, term()}
```

Lists all active tokens.

# `publish_key`

```elixir
@spec publish_key(integer(), map() | keyword()) ::
  {:ok, Lockspire.Admin.Keys.key_view()} | {:error, term()}
```

Publishes a key for external use.

# `put_dcr_policy`

```elixir
@spec put_dcr_policy(map()) ::
  {:ok, Lockspire.Domain.ServerPolicy.t()}
  | {:error, [Lockspire.Admin.ServerPolicy.error_detail()]}
  | {:error, term()}
```

Updates the DCR policy.

# `put_dpop_policy`

```elixir
@spec put_dpop_policy(atom() | String.t()) ::
  {:ok, Lockspire.Domain.ServerPolicy.t()}
  | {:error, [Lockspire.Admin.ServerPolicy.error_detail()]}
  | {:error, term()}
```

Updates the DPoP policy mode.

# `put_security_profile`

```elixir
@spec put_security_profile(atom() | String.t()) ::
  {:ok, Lockspire.Domain.ServerPolicy.t()}
  | {:error, [Lockspire.Admin.ServerPolicy.error_detail()]}
  | {:error, term()}
```

Updates the security profile.

# `put_server_policy`

```elixir
@spec put_server_policy(atom() | String.t()) ::
  {:ok, Lockspire.Domain.ServerPolicy.t()}
  | {:error, [Lockspire.Admin.ServerPolicy.error_detail()]}
  | {:error, term()}
```

Updates the server policy mode.

# `reencrypt`

```elixir
@spec reencrypt(keyword()) ::
  {:ok, Lockspire.Admin.Keys.reencrypt_report()}
  | {:error,
     :key_encryption_not_configured
     | :repo_not_started
     | {:invalid_config, String.t()}}
```

Converts stored signing-key material to the current key-encryption key.

See `Lockspire.Admin.Keys.reencrypt/1` for options and behavior.

# `retire_key`

```elixir
@spec retire_key(integer(), map() | keyword()) ::
  {:ok, Lockspire.Admin.Keys.key_view()} | {:error, term()}
```

Retires a key so it is no longer used for signing.

# `revoke_consent`

```elixir
@spec revoke_consent(integer(), map()) ::
  {:ok, Lockspire.Admin.Consents.consent_view()} | {:error, term()}
```

Revokes a specific consent.

# `revoke_token`

```elixir
@spec revoke_token(integer(), map()) ::
  {:ok, Lockspire.Admin.Tokens.token_detail()} | {:error, term()}
```

Revokes a specific token.

# `revoke_token_family`

```elixir
@spec revoke_token_family(integer(), map()) ::
  {:ok,
   %{count: non_neg_integer(), token: Lockspire.Admin.Tokens.token_detail()}}
  | {:error, term()}
```

Revokes a token and its entire family (e.g. refresh token chains).

# `rotate_client_secret`

```elixir
@spec rotate_client_secret(String.t(), map() | keyword()) ::
  {:ok, %{client: Lockspire.Domain.Client.t(), client_secret: String.t()}}
  | {:error, [Lockspire.Clients.error_detail()]}
  | {:error, term()}
```

Rotates the client secret for a given client.

# `update_client`

```elixir
@spec update_client(String.t(), map() | keyword()) ::
  {:ok, Lockspire.Domain.Client.t()}
  | {:error, [Lockspire.Clients.error_detail()]}
  | {:error, term()}
```

Updates an existing client.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
