acapy_agent.multitenant package

Subpackages

Submodules

acapy_agent.multitenant.base module

acapy_agent.multitenant.cache module

Cache for multitenancy profiles.

class acapy_agent.multitenant.cache.ProfileCache(capacity: int)[source]

Bases: object

Profile cache that caches based on LRU strategy.

get(key: str) Profile | None[source]

Get profile with associated key from cache.

If a profile is open but has been evicted from the cache, this will reinsert the profile back into the cache. This prevents attempting to open a profile that is already open. Triggers clean up.

Parameters:

key (str) – the key to get the profile for.

Returns:

Profile if found in cache.

Return type:

Optional[Profile]

has(key: str) bool[source]

Check whether there is a profile with associated key in the cache.

Parameters:

key (str) – the key to check for a profile

Returns:

Whether the key exists in the cache

Return type:

bool

put(key: str, value: Profile) None[source]

Add profile with associated key to the cache.

If new profile exceeds the cache capacity least recently used profiles that are not used will be removed from the cache.

Parameters:
  • key (str) – the key to set

  • value (Profile) – the profile to set

remove(key: str)[source]

Remove profile with associated key from the cache.

Parameters:

key (str) – The key to remove from the cache.

acapy_agent.multitenant.error module

Multitenant error classes.

exception acapy_agent.multitenant.error.InvalidTokenError(message: str = 'Token not valid')[source]

Bases: MultitenantManagerError

Exception raised for invalid tokens.

exception acapy_agent.multitenant.error.MissingProfileError(message: str = 'Missing profile')[source]

Bases: MultitenantManagerError

Exception raised when a profile is missing.

exception acapy_agent.multitenant.error.MultitenantManagerError(*args, error_code: str | None = None, **kwargs)[source]

Bases: BaseError

Generic multitenant error.

exception acapy_agent.multitenant.error.WalletAlreadyExistsError(wallet_name: str)[source]

Bases: MultitenantManagerError

Exception raised when a wallet already exists.

exception acapy_agent.multitenant.error.WalletKeyMissingError(message: str = 'Missing key to open wallet')[source]

Bases: MultitenantManagerError

Wallet key missing exception.

acapy_agent.multitenant.manager module

acapy_agent.multitenant.manager_provider module

Profile manager for multitenancy.

class acapy_agent.multitenant.manager_provider.MultitenantManagerProvider(root_profile)[source]

Bases: BaseProvider

Multitenant manager provider.

Decides which manager to use based on the settings.

MANAGER_TYPES = {'basic': 'acapy_agent.multitenant.manager.MultitenantManager', 'single-wallet-askar': 'acapy_agent.multitenant.single_wallet_askar_manager.SingleWalletAskarMultitenantManager', 'single-wallet-kanon': 'acapy_agent.multitenant.single_wallet_kanon_manager.SingleWalletKanonMultitenantManager'}
provide(settings: BaseSettings, injector: BaseInjector)[source]

Create the multitenant manager instance.

single_wallet_askar_manager_path = 'acapy_agent.multitenant.single_wallet_askar_manager.SingleWalletAskarMultitenantManager'
single_wallet_kanon_manager_path = 'acapy_agent.multitenant.single_wallet_kanon_manager.SingleWalletKanonMultitenantManager'

acapy_agent.multitenant.route_manager module

acapy_agent.multitenant.single_wallet_askar_manager module

acapy_agent.multitenant.single_wallet_kanon_manager module