![]() |
BSB Developer Docs
|
Manages HTTP access tokens. More...
Go to the source code of this file.
Data Structures | |
| struct | ApiTokensEntry |
| Information about an HTTP API access token. More... | |
Macros | |
| #define | RECORD_API_TOKENS "api_tokens" |
| #define | API_TOKENS_LENGTH (32) |
| #define | API_TOKENS_SHORT_ID_LENGTH (8) |
Typedefs | |
| typedef struct ApiTokens | ApiTokens |
| typedef void(* | ApiTokenInfoCallback) (const ApiTokensEntry *entry, void *context) |
Enumerations | |
| enum | ApiApiTokensEntryType { ApiApiTokensEntryTypeHashed , ApiApiTokensEntryTypeFull , ApiApiTokensEntryTypeMax } |
Functions | |
| void | api_tokens_mint (ApiTokens *tokens, const char *owner, ApiTokenInfoCallback callback, void *context) |
| Generates a new HTTP API access token. | |
| void | api_tokens_list (ApiTokens *tokens, ApiTokenInfoCallback callback, void *context) |
| List all HTTP API access tokens. | |
| bool | api_tokens_revoke (ApiTokens *tokens, const char *short_id) |
| Revoke one HTTP API access token. | |
| void | api_tokens_reset_all (ApiTokens *tokens) |
| Revoke all HTTP API access tokens. | |
| bool | api_tokens_validate_and_record_usage (ApiTokens *tokens, const char *full_token) |
Check that the provided access token is valid, and update its last_used_at property. | |
Manages HTTP access tokens.
| void api_tokens_list | ( | ApiTokens * | tokens, |
| ApiTokenInfoCallback | callback, | ||
| void * | context ) |
List all HTTP API access tokens.
| [in] | tokens | ApiTokens service |
| [in] | callback | Callback, called for each listed token |
| [in] | context | Custom context to pass to callback verbatim |
| void api_tokens_mint | ( | ApiTokens * | tokens, |
| const char * | owner, | ||
| ApiTokenInfoCallback | callback, | ||
| void * | context ) |
Generates a new HTTP API access token.
| [in,out] | tokens | ApiTokens service |
| [in] | owner | Human-readable name for the token |
| [in] | callback | Callback with info about the generated token |
| [in] | context | Custom context to pass to callback verbatim |
| void api_tokens_reset_all | ( | ApiTokens * | tokens | ) |
Revoke all HTTP API access tokens.
| [in,out] | tokens | ApiTokens service |
| bool api_tokens_revoke | ( | ApiTokens * | tokens, |
| const char * | short_id ) |
Revoke one HTTP API access token.
| [in,out] | tokens | ApiTokens service |
| [in] | short_id | Token short ID |
false if requested token was not found | bool api_tokens_validate_and_record_usage | ( | ApiTokens * | tokens, |
| const char * | full_token ) |
Check that the provided access token is valid, and update its last_used_at property.
| [in,out] | tokens | ApiTokens service |
| [in] | full_token | Full access token |
true if access should be granted