aries_cloudagent.multitenant package

Submodules

aries_cloudagent.multitenant.error module

Multitenant error classes.

exception aries_cloudagent.multitenant.error.WalletKeyMissingError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Wallet key missing exception.

aries_cloudagent.multitenant.manager module

Manager for multitenancy.

class aries_cloudagent.multitenant.manager.MultitenantManager(profile: aries_cloudagent.core.profile.Profile)[source]

Bases: object

Class for handling multitenancy.

add_key(wallet_id: str, recipient_key: str, *, skip_if_exists: bool = False)[source]

Add a wallet key to map incoming messages to specific subwallets.

Parameters:
  • wallet_id – The wallet id the key corresponds to
  • recipient_key – The recipient key belonging to the wallet
  • skip_if_exists – Whether to skip the action if the key is already registered for relaying / mediation
create_auth_token(wallet_record: aries_cloudagent.wallet.models.wallet_record.WalletRecord, wallet_key: str = None) → str[source]

Create JWT auth token for specified wallet record.

Parameters:
  • wallet_record – The wallet record to create the token for
  • wallet_key – The wallet key to include in the token. Only required for “unmanaged” wallets
Raises:

WalletKeyMissingError – If the wallet key is missing. Only thrown for “unmanaged” wallets

Returns:

JWT auth token

Return type:

str

create_wallet(settings: dict, key_management_mode: str) → aries_cloudagent.wallet.models.wallet_record.WalletRecord[source]

Create new wallet and wallet record.

Parameters:
  • settings – The context settings for this wallet
  • key_management_mode – The mode to use for key management. Either “unmanaged” to not store the wallet key, or “managed” to store the wallet key
Raises:

MultitenantManagerError – If the wallet name already exists

Returns:

The newly created wallet record

Return type:

WalletRecord

get_default_mediator() → Optional[aries_cloudagent.protocols.coordinate_mediation.v1_0.models.mediation_record.MediationRecord][source]

Retrieve the default mediator used for subwallet routing.

Returns:retrieved default mediator or None if not set
Return type:Optional[MediationRecord]
get_profile_for_token(context: aries_cloudagent.config.injection_context.InjectionContext, token: str) → aries_cloudagent.core.profile.Profile[source]

Get the profile associated with a JWT header token.

Parameters:
  • context – The context to use for profile creation
  • token – The token
Raises:
  • WalletKeyMissingError – If the wallet_key is missing for an unmanaged wallet
  • InvalidTokenError – If there is an exception while decoding the token
Returns:

Profile associated with the token

get_wallet_profile(base_context: aries_cloudagent.config.injection_context.InjectionContext, wallet_record: aries_cloudagent.wallet.models.wallet_record.WalletRecord, extra_settings: dict = {}, *, provision=False) → aries_cloudagent.core.profile.Profile[source]

Get profile for a wallet record.

Parameters:
  • base_context – Base context to extend from
  • wallet_record – Wallet record to get the context for
  • extra_settings – Any extra context settings
Returns:

Profile for the wallet record

Return type:

Profile

get_wallets_by_message(message_body, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None) → List[aries_cloudagent.wallet.models.wallet_record.WalletRecord][source]

Get the wallet records associated with the message boy.

Parameters:
  • message_body – The body of the message
  • wire_format – Wire format to use for recipient detection
Returns:

Wallet records associated with the message body

get_webhook_urls(base_context: aries_cloudagent.config.injection_context.InjectionContext, wallet_record: aries_cloudagent.wallet.models.wallet_record.WalletRecord) → list[source]

Get the webhook urls according to dispatch_type.

Parameters:
  • base_context – Base context to get base_webhook_urls
  • wallet_record – Wallet record to get dispatch_type and webhook_urls
Returns:

webhook urls according to dispatch_type

remove_wallet(wallet_id: str, wallet_key: str = None)[source]

Remove the wallet with specified wallet id.

Parameters:
  • wallet_id – The wallet id of the wallet record
  • wallet_key – The wallet key to open the wallet. Only required for “unmanaged” wallets
Raises:

WalletKeyMissingError – If the wallet key is missing. Only thrown for “unmanaged” wallets

update_wallet(wallet_id: str, new_settings: dict) → aries_cloudagent.wallet.models.wallet_record.WalletRecord[source]

Update a existing wallet and wallet record.

Parameters:
  • wallet_id – The wallet id of the wallet record
  • new_settings – The context settings to be updated for this wallet
Returns:

The updated wallet record

Return type:

WalletRecord

exception aries_cloudagent.multitenant.manager.MultitenantManagerError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Generic multitenant error.