mindroot.coreplugins.api_keys package

Submodules

mindroot.coreplugins.api_keys.api_key_manager module

class mindroot.coreplugins.api_keys.api_key_manager.APIKeyManager(keys_dir: str = 'data/apikeys')[source]

Bases: object

create_key(username: str, description: str = '') Dict[source]

Create a new API key for a user

Parameters:
  • username – The username to associate with the key

  • description – Optional description for the key

Returns:

Dict containing the key details

delete_key(api_key: str) bool[source]

Delete an API key

Parameters:

api_key – The API key to delete

Returns:

True if key was deleted, False if key not found

Return type:

bool

list_keys(username: str | None = None) List[Dict][source]

List all API keys or keys for specific user

Parameters:

username – Optional username to filter keys by

Returns:

List of key data dictionaries

validate_key(api_key: str) Dict | None[source]

Validate an API key and return associated data if valid

Parameters:

api_key – The API key to validate

Returns:

Dict containing the key details if valid, None otherwise

mindroot.coreplugins.api_keys.cli module

mindroot.coreplugins.api_keys.mod module

async mindroot.coreplugins.api_keys.mod.startup(app, context)[source]

mindroot.coreplugins.api_keys.router module

class mindroot.coreplugins.api_keys.router.APIKeyCreate(*, username: str, description: str | None = '')[source]

Bases: BaseModel

description: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

username: str
class mindroot.coreplugins.api_keys.router.APIKeyList(*, success: bool, data: List[APIKeyResponse])[source]

Bases: BaseModel

data: List[APIKeyResponse]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

success: bool
class mindroot.coreplugins.api_keys.router.APIKeyResponse(*, key: str, username: str, description: str, created_at: str)[source]

Bases: BaseModel

created_at: str
description: str
key: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

username: str
async mindroot.coreplugins.api_keys.router.create_api_key(request: APIKeyCreate)[source]
async mindroot.coreplugins.api_keys.router.delete_api_key(api_key: str)[source]
async mindroot.coreplugins.api_keys.router.list_api_keys()[source]

Module contents