ApiKeyAuth

interface ApiKeyAuth

Exposes functionality for a user to manage API keys under their control.

Functions

create
Link copied to clipboard
abstract suspend fun create(name: String): ApiKey

Creates a user API key that can be used to authenticate as the user. The value of the key must be persisted at this time as this is the only time it is visible. The key is enabled when created. It can be disabled by calling the disable method.

delete
Link copied to clipboard
abstract suspend fun delete(id: <ERROR CLASS>)
abstract suspend fun delete(id: <ERROR CLASS>)

Deletes a specific API key created by the user. Returns silently if no key is deleted.

disable
Link copied to clipboard
abstract suspend fun disable(id: <ERROR CLASS>)
abstract suspend fun disable(id: <ERROR CLASS>)

Deletes a specific API key created by the user. The function would complete normally if the provided key does not exist.

enable
Link copied to clipboard
abstract suspend fun enable(id: <ERROR CLASS>)
abstract suspend fun enable(id: <ERROR CLASS>)

Enables a specific API key created by the user.

fetch
Link copied to clipboard
abstract suspend fun fetch(id: <ERROR CLASS>): ApiKey?
abstract suspend fun fetch(id: <ERROR CLASS>): ApiKey?

Fetches a specific user API key associated with the user.

fetchAll
Link copied to clipboard
abstract suspend fun fetchAll(): List<ApiKey>

Fetches all API keys associated with the user. Returns an empty list if no key is found.

Properties

app
Link copied to clipboard
abstract val app: App

The App that this instance in associated with.

user
Link copied to clipboard
abstract val user: User

The User that this instance in associated with.