Skip to content

API Reference parrot.handlers.studio.storage.byok_store

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.handlers.studio.storage.byok_store

View source

BYOK keys in Postgres (spec §2.10, M11). Same AAD as DocumentDB, so ciphertexts copy verbatim.

Class PgUserLLMKeyStore

Per-user provider keys over the host pool. Keys are per user, never per tenant (spec Q4).

Parameter Type Default Description
pool Any

Method PgUserLLMKeyStore.get

Return the decrypted key, None when absent. Raises on a keyring or decrypt failure.

get(user_id: Any, provider: str) -> str | None

Parameter Type Default Description
user_id Any
provider str

Returns: str | None

Method PgUserLLMKeyStore.put

Upsert the sealed key; created_at survives a rotation of the same (user, provider).

put(user_id: Any, provider: str, api_key: str) -> None

Parameter Type Default Description
user_id Any
provider str
api_key str

Method PgUserLLMKeyStore.delete

Remove the key; True when a row existed.

delete(user_id: Any, provider: str) -> bool

Parameter Type Default Description
user_id Any
provider str

Returns: bool

Method PgUserLLMKeyStore.list_masked

Masked previews (no decryption), in StudioKeysHandler.get item shape.

list_masked(user_id: Any) -> list[dict[str, Any]]

Parameter Type Default Description
user_id Any

Returns: list[dict[str, Any]]

Alias QUARANTINE_MARK

Re-exported from parrot.handlers.studio.storage.vault_targets.QUARANTINE_MARK.

Attribute STUDIO_BYOK_STORE_APP_KEY

Alias decrypt_credential

Re-exported from parrot.security.credentials_utils.decrypt_credential.

Alias encrypt_credential

Re-exported from parrot.security.credentials_utils.encrypt_credential.

Function get_byok_store

The store registered for app at startup (ensure_studio_storage); never creates one lazily.

get_byok_store(app: Any) -> PgUserLLMKeyStore

Parameter Type Default Description
app Any

Returns: PgUserLLMKeyStore

Alias get_vault_keyring

Re-exported from parrot.security.vault_utils.get_vault_keyring.

Function install_byok_store

Startup: build the store over pool, remember it on app and register it with the core resolver.

install_byok_store(app: Any, pool: Any) -> PgUserLLMKeyStore

Parameter Type Default Description
app Any
pool Any

Returns: PgUserLLMKeyStore

Alias llm_key_context

Re-exported from parrot.security.credentials_utils.llm_key_context.

Attribute logger

Function register_byok_store

Called by the server at startup when BYOK_STORE=postgres; read by the core resolver.

register_byok_store(store: 'PgUserLLMKeyStore | None') -> None

Parameter Type Default Description
store 'PgUserLLMKeyStore | None'

Function release_byok_store

Unregister store from the core resolver, but only while it is still the registered one.

release_byok_store(store: 'PgUserLLMKeyStore | None') -> None

Parameter Type Default Description
store 'PgUserLLMKeyStore | None'

Alias set_user_llm_key_store

Re-exported from parrot.auth.broker.set_user_llm_key_store.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally