Aries Cloud Agent Python Code Documentation¶
Hyperledger Aries Cloud Agent Python (ACA-Py) is a foundation for building decentralized identity applications and services running in non-mobile environments.
This is the Read The Docs site for the Hyperledger Aries Cloud Agent Python. This site contains only the ACA-Py docstrings documentation extracted from the Python Code. For other documentation, please consult the links in the Readme for the ACA-Py GitHub Repo. If you are getting started with verifiable credentials or Aries, we recommend that you start with this verifiable credentials and agents getting started guide.
All of the code in ACA-Py is within the aries_cloudagent module. To investigate the code, use search or click on the aries_cloudagent package link in the left menu to drill down into the modules, subpackages and submodules that make up ACA-Py.
Developers that are interested in what DIDComm protocols are supported in ACA-Py should take a look at the messaging subpackage. Other general purpose subpackages that might be of particular interest include wallet and storage. For those agents playing different roles in a verifiable credential exchange, take a look at the issuer, holder and verifier packages.
Please see the ACA-Py Contribution guidelines for how to contribute to ACA-Py, including for how to submit issues about ACA-Py.
aries_cloudagent package¶
Aries Cloud Agent.
Subpackages¶
aries_cloudagent.admin package¶
Submodules¶
aries_cloudagent.admin.base_server module¶
Abstract admin server interface.
-
class
aries_cloudagent.admin.base_server.
BaseAdminServer
[source]¶ Bases:
abc.ABC
Admin HTTP server class.
-
add_webhook_target
(target_url: str, topic_filter: Sequence[str] = None, max_attempts: int = None)[source]¶ Add a webhook target.
-
send_webhook
(topic: str, payload: dict)[source]¶ Add a webhook to the queue, to send to all registered targets.
-
aries_cloudagent.admin.error module¶
Admin error classes.
-
exception
aries_cloudagent.admin.error.
AdminError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base class for Admin-related errors.
-
exception
aries_cloudagent.admin.error.
AdminSetupError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.admin.error.AdminError
Admin server setup or configuration error.
aries_cloudagent.admin.routes module¶
aries_cloudagent.admin.server module¶
Admin server classes.
-
class
aries_cloudagent.admin.server.
AdminModulesSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Schema for the modules endpoint.
-
result
¶ Used by autodoc_mock_imports.
-
-
class
aries_cloudagent.admin.server.
AdminResponder
(context: aries_cloudagent.config.injection_context.InjectionContext, send: Coroutine[T_co, T_contra, V_co], webhook: Coroutine[T_co, T_contra, V_co], **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.responder.BaseResponder
Handle outgoing messages from message handlers.
-
class
aries_cloudagent.admin.server.
AdminServer
(host: str, port: int, context: aries_cloudagent.config.injection_context.InjectionContext, outbound_message_router: Coroutine[T_co, T_contra, V_co], webhook_router: Callable, task_queue: aries_cloudagent.utils.task_queue.TaskQueue = None, conductor_stats: Coroutine[T_co, T_contra, V_co] = None)[source]¶ Bases:
aries_cloudagent.admin.base_server.BaseAdminServer
Admin HTTP server class.
-
add_webhook_target
(target_url: str, topic_filter: Sequence[str] = None, max_attempts: int = None)[source]¶ Add a webhook target.
-
make_application
() → <sphinx.ext.autodoc.importer._MockObject object at 0x7f69914474e0>[source]¶ Get the aiohttp application instance.
-
on_startup
(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69914474e0>)[source]¶ Perform webserver startup actions.
-
plugins_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69914474e0>)[source]¶ Request handler for the loaded plugins list.
Parameters: request – aiohttp request object Returns: The module list response
-
redirect_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69914474e0>)[source]¶ Perform redirect to documentation.
-
send_webhook
(topic: str, payload: dict)[source]¶ Add a webhook to the queue, to send to all registered targets.
-
start
() → None[source]¶ Start the webserver.
Raises: AdminSetupError
– If there was an error starting the webserver
-
status_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69914474e0>)[source]¶ Request handler for the server status information.
Parameters: request – aiohttp request object Returns: The web response
-
aries_cloudagent.cache package¶
Submodules¶
aries_cloudagent.cache.base module¶
Abstract base classes for cache.
-
class
aries_cloudagent.cache.base.
BaseCache
[source]¶ Bases:
abc.ABC
Abstract cache interface.
-
clear
(key: str)[source]¶ Remove an item from the cache, if present.
Parameters: key – the key to remove
-
-
exception
aries_cloudagent.cache.base.
CacheError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base class for cache-related errors.
-
class
aries_cloudagent.cache.base.
CacheKeyLock
(cache: aries_cloudagent.cache.base.BaseCache, key: str)[source]¶ Bases:
object
A lock on a particular cache key.
Used to prevent multiple async threads from generating or querying the same semi-expensive data. Not thread safe.
-
done
¶ Accessor for the done state.
-
future
¶ Fetch the result in the form of an awaitable future.
-
parent
¶ Accessor for the parent key lock, if any.
-
result
¶ Fetch the current result, if any.
-
aries_cloudagent.cache.basic module¶
Basic in-memory cache implementation.
-
class
aries_cloudagent.cache.basic.
BasicCache
[source]¶ Bases:
aries_cloudagent.cache.base.BaseCache
Basic in-memory cache class.
-
clear
(key: str)[source]¶ Remove an item from the cache, if present.
Parameters: key – the key to remove
-
get
(key: str)[source]¶ Get an item from the cache.
Parameters: key – the key to retrieve an item for Returns: The record found or None
-
set
(keys: Union[str, Sequence[str]], value: Any, ttl: int = None)[source]¶ Add an item to the cache with an optional ttl.
Overwrites existing cache entries.
Parameters: - keys – the key or keys for which to set an item
- value – the value to store in the cache
- ttl – number of seconds that the record should persist
-
aries_cloudagent.commands package¶
Commands module common setup.
-
aries_cloudagent.commands.
load_command
(command: str)[source]¶ Load the module corresponding with a named command.
-
aries_cloudagent.commands.
run_command
(command: str, argv: Sequence[str] = None)[source]¶ Execute a named command with command line arguments.
Submodules¶
aries_cloudagent.commands.help module¶
Help command for indexing available commands.
aries_cloudagent.commands.provision module¶
Provision command for setting up agent settings before starting.
-
exception
aries_cloudagent.commands.provision.
ProvisionError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base exception for provisioning errors.
aries_cloudagent.commands.start module¶
Entrypoint.
-
aries_cloudagent.commands.start.
init_argument_parser
(parser: argparse.ArgumentParser)[source]¶ Initialize an argument parser with the module’s arguments.
-
aries_cloudagent.commands.start.
run_loop
(startup: Coroutine[T_co, T_contra, V_co], shutdown: Coroutine[T_co, T_contra, V_co])[source]¶ Execute the application, handling signals and ctrl-c.
aries_cloudagent.config package¶
Submodules¶
aries_cloudagent.config.argparse module¶
Command line option parsing.
-
class
aries_cloudagent.config.argparse.
AdminGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Admin server settings.
-
CATEGORIES
= ('start',)¶
-
GROUP_NAME
= 'Admin'¶
-
-
class
aries_cloudagent.config.argparse.
ArgumentGroup
[source]¶ Bases:
abc.ABC
A class representing a group of related command line arguments.
-
GROUP_NAME
= None¶
-
-
class
aries_cloudagent.config.argparse.
DebugGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Debug settings.
-
CATEGORIES
= ('start',)¶
-
GROUP_NAME
= 'Debug'¶
-
-
class
aries_cloudagent.config.argparse.
GeneralGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
General settings.
-
CATEGORIES
= ('general', 'start')¶
-
GROUP_NAME
= 'General'¶
-
-
class
aries_cloudagent.config.argparse.
LedgerGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Ledger settings.
-
CATEGORIES
= ('start', 'general')¶
-
GROUP_NAME
= 'Ledger'¶
-
-
class
aries_cloudagent.config.argparse.
LoggingGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Logging settings.
-
CATEGORIES
= ('general', 'start')¶
-
GROUP_NAME
= 'Logging'¶
-
-
class
aries_cloudagent.config.argparse.
ProtocolGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Protocol settings.
-
CATEGORIES
= ('start',)¶
-
GROUP_NAME
= 'Protocol'¶
-
-
class
aries_cloudagent.config.argparse.
TransportGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Transport settings.
-
CATEGORIES
= ('start',)¶
-
GROUP_NAME
= 'Transport'¶
-
-
class
aries_cloudagent.config.argparse.
WalletGroup
[source]¶ Bases:
aries_cloudagent.config.argparse.ArgumentGroup
Wallet settings.
-
CATEGORIES
= ('general', 'start')¶
-
GROUP_NAME
= 'Wallet'¶
-
aries_cloudagent.config.base module¶
Configuration base classes.
-
class
aries_cloudagent.config.base.
BaseInjector
[source]¶ Bases:
abc.ABC
Base injector class.
-
copy
() → aries_cloudagent.config.base.BaseInjector[source]¶ Produce a copy of the injector instance.
-
inject
(base_cls: type, settings: Mapping[str, object] = None, *, required: bool = True) → object[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- settings – An optional mapping providing configuration to the provider
Returns: An instance of the base class, or None
-
-
class
aries_cloudagent.config.base.
BaseSettings
[source]¶ Bases:
collections.abc.Mapping
,typing.Generic
Base settings class.
-
copy
() → aries_cloudagent.config.base.BaseSettings[source]¶ Produce a copy of the settings instance.
-
extend
(other: Mapping[str, object]) → aries_cloudagent.config.base.BaseSettings[source]¶ Merge another mapping to produce a new settings instance.
-
get_bool
(*var_names, default=None) → bool[source]¶ Fetch a setting as a boolean value.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
get_int
(*var_names, default=None) → int[source]¶ Fetch a setting as an integer value.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
-
exception
aries_cloudagent.config.base.
ConfigError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
A base exception for all configuration errors.
-
exception
aries_cloudagent.config.base.
InjectorError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
The base exception raised by BaseInjector implementations.
-
exception
aries_cloudagent.config.base.
ProviderError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
The base exception raised by BaseProvider implementations.
-
exception
aries_cloudagent.config.base.
SettingsError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
The base exception raised by BaseSettings implementations.
aries_cloudagent.config.base_context module¶
Base injection context builder classes.
aries_cloudagent.config.default_context module¶
Classes for configuring the default injection context.
-
class
aries_cloudagent.config.default_context.
DefaultContextBuilder
(settings: Mapping[str, object] = None)[source]¶ Bases:
aries_cloudagent.config.base_context.ContextBuilder
Default context builder.
-
bind_providers
(context: aries_cloudagent.config.injection_context.InjectionContext)[source]¶ Bind various class providers.
-
aries_cloudagent.config.error module¶
Errors for config modules.
-
exception
aries_cloudagent.config.error.
ArgsParseError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.ConfigError
Error raised when there is a problem parsing the command-line arguments.
aries_cloudagent.config.injection_context module¶
Injection context implementation.
-
class
aries_cloudagent.config.injection_context.
InjectionContext
(*, settings: Mapping[str, object] = None, enforce_typing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseInjector
Manager for configuration settings and class providers.
-
ROOT_SCOPE
= 'application'¶
-
copy
() → aries_cloudagent.config.injection_context.InjectionContext[source]¶ Produce a copy of the injector instance.
-
inject
(base_cls: type, settings: Mapping[str, object] = None, *, required: bool = True) → object[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- settings – An optional mapping providing configuration to the provider
Returns: An instance of the base class, or None
-
injector
¶ Accessor for scope-specific injector.
-
injector_for_scope
(scope_name: str) → aries_cloudagent.config.injector.Injector[source]¶ Fetch the injector for a specific scope.
Parameters: scope_name – The unique scope identifier
-
scope_name
¶ Accessor for the current scope name.
-
settings
¶ Accessor for scope-specific settings.
-
start_scope
(scope_name: str, settings: Mapping[str, object] = None) → aries_cloudagent.config.injection_context.InjectionContext[source]¶ Begin a new named scope.
Parameters: - scope_name – The unique name for the scope being entered
- settings – An optional mapping of additional settings to apply
Returns: A new injection context representing the scope
-
-
exception
aries_cloudagent.config.injection_context.
InjectionContextError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.config.base.InjectorError
Base class for issues in the injection context.
aries_cloudagent.config.injector module¶
Standard Injector implementation.
-
class
aries_cloudagent.config.injector.
Injector
(settings: Mapping[str, object] = None, enforce_typing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseInjector
Injector implementation with static and dynamic bindings.
-
bind_provider
(base_cls: type, provider: aries_cloudagent.config.base.BaseProvider, *, cache: bool = False)[source]¶ Add a dynamic instance resolver as a class binding.
-
copy
() → aries_cloudagent.config.base.BaseInjector[source]¶ Produce a copy of the injector instance.
-
inject
(base_cls: type, settings: Mapping[str, object] = None, *, required: bool = True)[source]¶ Get the provided instance of a given class identifier.
Parameters: - cls – The base class to retrieve an instance of
- params – An optional dict providing configuration to the provider
Returns: An instance of the base class, or None
-
settings
¶ Accessor for scope-specific settings.
-
aries_cloudagent.config.ledger module¶
Ledger configuration.
-
aries_cloudagent.config.ledger.
accept_taa
(ledger: aries_cloudagent.ledger.base.BaseLedger, taa_info, provision: bool = False) → bool[source]¶ Perform TAA acceptance.
aries_cloudagent.config.logging module¶
Utilities related to logging.
-
class
aries_cloudagent.config.logging.
LoggingConfigurator
[source]¶ Bases:
object
Utility class used to configure logging and print an informative start banner.
-
classmethod
configure
(logging_config_path: str = None, log_level: str = None, log_file: str = None)[source]¶ Configure logger.
Parameters: - logging_config_path – str: (Default value = None) Optional path to custom logging config
- log_level – str: (Default value = None)
Print a startup banner describing the configuration.
Parameters: - agent_label – Agent Label
- inbound_transports – Configured inbound transports
- outbound_transports – Configured outbound transports
- admin_server – Admin server info
- public_did – Public DID
- banner_length – (Default value = 40) Length of the banner
- border_character – (Default value = “:”) Character to use in banner
- border –
-
classmethod
-
aries_cloudagent.config.logging.
load_resource
(path: str, encoding: str = None) → TextIO[source]¶ Open a resource file located in a python package or the local filesystem.
Parameters: path – The resource path in the form of dir/file or package:dir/file Returns: A file-like object representing the resource
aries_cloudagent.config.provider module¶
Service provider implementations.
-
class
aries_cloudagent.config.provider.
CachedProvider
(provider: aries_cloudagent.config.base.BaseProvider)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Cache the result of another provider.
-
class
aries_cloudagent.config.provider.
ClassProvider
(instance_cls: Union[str, type], *ctor_args, async_init: str = None, **ctor_kwargs)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for a particular class.
-
class
aries_cloudagent.config.provider.
InstanceProvider
(instance)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for a previously-created instance.
-
class
aries_cloudagent.config.provider.
StatsProvider
(provider: aries_cloudagent.config.base.BaseProvider, methods: Sequence[str], *, ignore_missing: bool = True)[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Add statistics to the results of another provider.
aries_cloudagent.config.settings module¶
Settings implementation.
-
class
aries_cloudagent.config.settings.
Settings
(values: Mapping[str, object] = None)[source]¶ Bases:
aries_cloudagent.config.base.BaseSettings
Mutable settings implementation.
-
copy
() → aries_cloudagent.config.base.BaseSettings[source]¶ Produce a copy of the settings instance.
-
extend
(other: Mapping[str, object]) → aries_cloudagent.config.base.BaseSettings[source]¶ Merge another settings instance to produce a new instance.
-
get_value
(*var_names, default=None)[source]¶ Fetch a setting.
Parameters: - var_names – A list of variable name alternatives
- default – The default value to return if none are defined
-
aries_cloudagent.holder package¶
Submodules¶
aries_cloudagent.holder.base module¶
Base holder class.
aries_cloudagent.holder.indy module¶
Indy issuer implementation.
-
class
aries_cloudagent.holder.indy.
IndyHolder
(wallet)[source]¶ Bases:
aries_cloudagent.holder.base.BaseHolder
Indy holder class.
-
RECORD_TYPE_MIME_TYPES
= 'attribute-mime-types'¶
-
create_credential_request
(credential_offer, credential_definition, did)[source]¶ Create a credential offer for the given credential definition id.
Parameters: - credential_offer – The credential offer to create request for
- credential_definition – The credential definition to create an offer for
Returns: A credential request
-
create_presentation
(presentation_request: dict, requested_credentials: dict, schemas: dict, credential_definitions: dict)[source]¶ Get credentials stored in the wallet.
Parameters: - presentation_request – Valid indy format presentation request
- requested_credentials – Indy format requested_credentials
- schemas – Indy formatted schemas_json
- credential_definitions – Indy formatted schemas_json
-
delete_credential
(credential_id: str)[source]¶ Remove a credential stored in the wallet.
Parameters: credential_id – Credential id to remove
-
get_credential
(credential_id: str)[source]¶ Get a credential stored in the wallet.
Parameters: credential_id – Credential id to retrieve
-
get_credentials
(start: int, count: int, wql: dict)[source]¶ Get credentials stored in the wallet.
Parameters: - start – Starting index
- count – Number of records to return
- wql – wql query dict
-
get_credentials_for_presentation_request_by_referent
(presentation_request: dict, referents: Sequence[str], start: int, count: int, extra_query: dict = {})[source]¶ Get credentials stored in the wallet.
Parameters: - presentation_request – Valid presentation request from issuer
- referents – Presentation request referents to use to search for creds
- start – Starting index
- count – Maximum number of records to return
- extra_query – wql query dict
-
get_mime_type
(credential_id: str, attr: str = None) → Union[dict, str][source]¶ Get MIME type per attribute (or for all attributes).
Parameters: - credential_id – credential id
- attr – attribute of interest or omit for all
- Returns: Attribute MIME type or dict mapping attribute names to MIME types
- attr_meta_json = all_meta.tags.get(attr)
-
store_credential
(credential_definition, credential_data, credential_request_metadata, credential_attr_mime_types=None, credential_id=None)[source]¶ Store a credential in the wallet.
Parameters: - credential_definition – Credential definition for this credential
- credential_data – Credential data generated by the issuer
- credential_request_metadata – credential request metadata generated by the issuer
- credential_attr_mime_types – dict mapping attribute names to (optional) MIME types to store as non-secret record, if specified
-
aries_cloudagent.issuer package¶
Submodules¶
aries_cloudagent.issuer.base module¶
Ledger issuer class.
aries_cloudagent.issuer.indy module¶
Indy issuer implementation.
-
class
aries_cloudagent.issuer.indy.
IndyIssuer
(wallet)[source]¶ Bases:
aries_cloudagent.issuer.base.BaseIssuer
Indy issuer class.
-
create_credential
(schema, credential_offer, credential_request, credential_values)[source]¶ Create a credential.
- Args
- schema: Schema to create credential for credential_offer: Credential Offer to create credential for credential_request: Credential request to create credential for credential_values: Values to go in credential
Returns: A tuple of created credential, revocation id
-
aries_cloudagent.issuer.util module¶
Issuer utils.
-
aries_cloudagent.issuer.util.
encode
(orig: Any) → str[source]¶ Encode a credential value as an int.
Encode credential attribute value, purely stringifying any int32 and leaving numeric int32 strings alone, but mapping any other input to a stringified 256-bit (but not 32-bit) integer. Predicates in indy-sdk operate on int32 values properly only when their encoded values match their raw values.
Parameters: orig – original value to encode Returns: encoded value
aries_cloudagent.ledger package¶
Submodules¶
aries_cloudagent.ledger.base module¶
Ledger base class.
-
class
aries_cloudagent.ledger.base.
BaseLedger
[source]¶ Bases:
abc.ABC
Base class for ledger.
-
LEDGER_TYPE
= None¶
Save a new record recording the acceptance of the TAA.
Fetch the current AML and TAA from the ledger.
-
get_endpoint_for_did
(did: str) → str[source]¶ Fetch the endpoint for a ledger DID.
Parameters: did – The DID to look up on the ledger or in the cache
-
get_key_for_did
(did: str) → str[source]¶ Fetch the verkey for a ledger DID.
Parameters: did – The DID to look up on the ledger or in the cache
Look up the latest TAA acceptance.
Get the current transaction author agreement, fetching it if necessary.
-
register_nym
(did: str, verkey: str, alias: str = None, role: str = None)[source]¶ Register a nym on the ledger.
Parameters: - did – DID to register on the ledger.
- verkey – The verification key of the keypair.
- alias – Human-friendly alias to assign to the DID.
- role – For permissioned ledgers, what role should the new DID have.
-
aries_cloudagent.ledger.error module¶
Ledger related errors.
-
exception
aries_cloudagent.ledger.error.
BadLedgerRequestError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.ledger.error.LedgerError
The current request cannot proceed.
-
exception
aries_cloudagent.ledger.error.
ClosedPoolError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.ledger.error.LedgerError
Indy pool is closed.
-
exception
aries_cloudagent.ledger.error.
LedgerConfigError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.ledger.error.LedgerError
Base class for ledger configuration errors.
-
exception
aries_cloudagent.ledger.error.
LedgerError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base class for ledger errors.
-
exception
aries_cloudagent.ledger.error.
LedgerTransactionError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.ledger.error.LedgerError
The ledger rejected the transaction.
aries_cloudagent.ledger.indy module¶
Indy ledger implementation.
-
class
aries_cloudagent.ledger.indy.
IndyErrorHandler
(message: str = None, error_cls: Type[aries_cloudagent.ledger.error.LedgerError] = <class 'aries_cloudagent.ledger.error.LedgerError'>)[source]¶ Bases:
object
Trap IndyError and raise an appropriate LedgerError instead.
-
classmethod
wrap_error
(err_value: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991009048>, message: str = None, error_cls: Type[aries_cloudagent.ledger.error.LedgerError] = <class 'aries_cloudagent.ledger.error.LedgerError'>) → aries_cloudagent.ledger.error.LedgerError[source]¶ Create an instance of LedgerError from an IndyError.
-
classmethod
-
class
aries_cloudagent.ledger.indy.
IndyLedger
(pool_name: str, wallet: aries_cloudagent.wallet.base.BaseWallet, *, keepalive: int = 0, cache: aries_cloudagent.cache.base.BaseCache = None, cache_duration: int = 600)[source]¶ Bases:
aries_cloudagent.ledger.base.BaseLedger
Indy ledger class.
-
LEDGER_TYPE
= 'indy'¶
Save a new record recording the acceptance of the TAA.
-
check_existing_schema
(public_did: str, schema_name: str, schema_version: str, attribute_names: Sequence[str]) → str[source]¶ Check if a schema has already been published.
-
create_pool_config
(genesis_transactions: str, recreate: bool = False)[source]¶ Create the pool ledger configuration.
-
credential_definition_id2schema_id
(credential_definition_id)[source]¶ From a credential definition, get the identifier for its schema.
Parameters: credential_definition_id – The identifier of the credential definition from which to identify a schema
-
fetch_credential_definition
(credential_definition_id: str)[source]¶ Get a credential definition from the ledger by id.
Parameters: credential_definition_id – The cred def id of the cred def to fetch
-
fetch_schema_by_id
(schema_id: str)[source]¶ Get schema from ledger.
Parameters: schema_id – The schema id (or stringified sequence number) to retrieve Returns: Indy schema dict
-
fetch_schema_by_seq_no
(seq_no: int)[source]¶ Fetch a schema by its sequence number.
Parameters: seq_no – schema ledger sequence number Returns: Indy schema dict
Fetch the current AML and TAA from the ledger.
-
get_credential_definition
(credential_definition_id: str)[source]¶ Get a credential definition from the cache if available, otherwise the ledger.
Parameters: credential_definition_id – The schema id of the schema to fetch cred def for
-
get_endpoint_for_did
(did: str) → str[source]¶ Fetch the endpoint for a ledger DID.
Parameters: did – The DID to look up on the ledger or in the cache
-
get_indy_storage
() → aries_cloudagent.storage.indy.IndyStorage[source]¶ Get an IndyStorage instance for the current wallet.
-
get_key_for_did
(did: str) → str[source]¶ Fetch the verkey for a ledger DID.
Parameters: did – The DID to look up on the ledger or in the cache
Look up the latest TAA acceptance.
-
get_schema
(schema_id: str)[source]¶ Get a schema from the cache if available, otherwise fetch from the ledger.
Parameters: schema_id – The schema id (or stringified sequence number) to retrieve
Get the current transaction author agreement, fetching it if necessary.
-
register_nym
(did: str, verkey: str, alias: str = None, role: str = None)[source]¶ Register a nym on the ledger.
Parameters: - did – DID to register on the ledger.
- verkey – The verification key of the keypair.
- alias – Human-friendly alias to assign to the DID.
- role – For permissioned ledgers, what role should the new DID have.
-
send_credential_definition
(schema_id: str, tag: str = None)[source]¶ Send credential definition to ledger and store relevant key matter in wallet.
Parameters: - schema_id – The schema id of the schema to create cred def for
- tag – Option tag to distinguish multiple credential definitions
-
send_schema
(schema_name: str, schema_version: str, attribute_names: Sequence[str])[source]¶ Send schema to ledger.
Parameters: - schema_name – The schema name
- schema_version – The schema version
- attribute_names – A list of schema attributes
-
aries_cloudagent.ledger.provider module¶
Default ledger provider classes.
-
class
aries_cloudagent.ledger.provider.
LedgerProvider
[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for the default ledger implementation.
-
LEDGER_CLASSES
= {'indy': 'aries_cloudagent.ledger.indy.IndyLedger'}¶
-
aries_cloudagent.messaging package¶
Subpackages¶
aries_cloudagent.messaging.basicmessage package¶
aries_cloudagent.messaging.connections package¶
aries_cloudagent.messaging.credential_definitions package¶
Credential definition admin routes.
-
class
aries_cloudagent.messaging.credential_definitions.routes.
CredentialDefinitionGetResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for schema get request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.credential_definitions.routes.
CredentialDefinitionSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Credential definition schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.credential_definitions.routes.
CredentialDefinitionSendRequestSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Request schema for schema send request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.credential_definitions.routes.
CredentialDefinitionSendResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for schema send request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.credential_definitions.routes.
CredentialDefinitionsCreatedResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for cred-defs-created request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
aries_cloudagent.messaging.credential_definitions.routes.
credential_definitions_created
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f699082c198>)[source]¶ Request handler for retrieving credential definitions that current agent created.
Parameters: request – aiohttp request object Returns: The identifiers of matching credential definitions.
-
aries_cloudagent.messaging.credential_definitions.routes.
credential_definitions_get_credential_definition
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f699082c198>)[source]¶ Request handler for getting a credential definition from the ledger.
Parameters: request – aiohttp request object Returns: The credential definition details.
-
aries_cloudagent.messaging.credential_definitions.routes.
credential_definitions_send_credential_definition
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f699082c198>)[source]¶ Request handler for sending a credential definition to the ledger.
Parameters: request – aiohttp request object Returns: The credential definition identifier
aries_cloudagent.messaging.credentials package¶
aries_cloudagent.messaging.decorators package¶
Classes for managing a collection of decorators.
-
class
aries_cloudagent.messaging.decorators.base.
BaseDecoratorSet
(models: dict = None)[source]¶ Bases:
collections.OrderedDict
Collection of decorators.
-
add_model
(key: str, model: Type[aries_cloudagent.messaging.models.base.BaseModel])[source]¶ Add a registered decorator model.
-
copy
() → aries_cloudagent.messaging.decorators.base.BaseDecoratorSet[source]¶ Return a copy of the decorator set.
-
extract_decorators
(message: Mapping[KT, VT_co], schema: Type[<sphinx.ext.autodoc.importer._MockObject object at 0x7f6991240588>] = None, serialized: bool = True, skip_attrs: Sequence[str] = None) → collections.OrderedDict[source]¶ Extract decorators and return the remaining properties.
-
field
(name: str) → aries_cloudagent.messaging.decorators.base.BaseDecoratorSet[source]¶ Access a named decorated field.
-
fields
¶ Acessor for the set of currently defined fields.
-
load_decorator
(key: str, value, serialized=False)[source]¶ Convert a decorator value to its loaded representation.
-
models
¶ Accessor for the models dictionary.
-
prefix
¶ Accessor for the decorator prefix.
-
Default decorator set implementation.
-
class
aries_cloudagent.messaging.decorators.default.
DecoratorSet
(models: dict = None)[source]¶ Bases:
aries_cloudagent.messaging.decorators.base.BaseDecoratorSet
Default decorator set implementation.
The localization decorator (~l10n) for message localization information.
-
class
aries_cloudagent.messaging.decorators.localization_decorator.
LocalizationDecorator
(*, locale: str = None, localizable: Sequence[str] = None, catalogs: Sequence[str] = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Class representing the localization decorator.
-
class
aries_cloudagent.messaging.decorators.localization_decorator.
LocalizationDecoratorSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
Localization decorator schema used in serialization/deserialization.
-
class
Meta
[source]¶ Bases:
object
LocalizationDecoratorSchema metadata.
-
model_class
¶ alias of
LocalizationDecorator
-
-
catalogs
¶ Used by autodoc_mock_imports.
-
locale
¶ Used by autodoc_mock_imports.
-
localizable
¶ Used by autodoc_mock_imports.
-
class
Model and schema for working with field signatures within message bodies.
-
class
aries_cloudagent.messaging.decorators.signature_decorator.
SignatureDecorator
(*, signature_type: str = None, signature: str = None, sig_data: str = None, signer: str = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Class representing a field value signed by a known verkey.
-
class
Meta
[source]¶ Bases:
object
SignatureDecorator metadata.
-
schema_class
= 'SignatureDecoratorSchema'¶
-
-
TYPE_ED25519SHA512
= 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/signature/1.0/ed25519Sha512_single'¶
-
classmethod
create
(value, signer: str, wallet: aries_cloudagent.wallet.base.BaseWallet, timestamp=None) → aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator[source]¶ Create a Signature.
Sign a field value and return a newly constructed SignatureDecorator representing the resulting signature.
Parameters: - value – Value to sign
- signer – Verkey of the signing party
- wallet – The wallet to use for the signature
Returns: The created SignatureDecorator object
-
class
-
class
aries_cloudagent.messaging.decorators.signature_decorator.
SignatureDecoratorSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
SignatureDecorator schema.
-
class
Meta
[source]¶ Bases:
object
SignatureDecoratorSchema metadata.
-
model_class
¶ alias of
SignatureDecorator
-
-
sig_data
¶ Used by autodoc_mock_imports.
-
signature
¶ Used by autodoc_mock_imports.
-
signature_type
¶ Used by autodoc_mock_imports.
-
signer
¶ Used by autodoc_mock_imports.
-
class
A message decorator for threads.
A thread decorator identifies a message that may require additional context from previous messages.
-
class
aries_cloudagent.messaging.decorators.thread_decorator.
ThreadDecorator
(*, thid: str = None, pthid: str = None, sender_order: int = None, received_orders: Mapping[KT, VT_co] = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Class representing thread decorator.
-
pthid
¶ Accessor for parent thread identifier.
Returns: This thread’s pthid
-
received_orders
¶ Get received orders.
Returns: The highest sender_order value that the sender has seen from other sender(s) on the thread.
-
sender_order
¶ Get sender order.
Returns: A number that tells where this message fits in the sequence of all messages that the current sender has contributed to this thread
-
thid
¶ Accessor for thread identifier.
Returns: This thread’s thid
-
-
class
aries_cloudagent.messaging.decorators.thread_decorator.
ThreadDecoratorSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
Thread decorator schema used in serialization/deserialization.
-
class
Meta
[source]¶ Bases:
object
ThreadDecoratorSchema metadata.
-
model_class
¶ alias of
ThreadDecorator
-
-
pthid
¶ Used by autodoc_mock_imports.
-
received_orders
¶ Used by autodoc_mock_imports.
-
sender_order
¶ Used by autodoc_mock_imports.
-
thid
¶ Used by autodoc_mock_imports.
-
class
The timing decorator (~timing).
This decorator allows the timing of agent messages to be communicated and constrained.
-
class
aries_cloudagent.messaging.decorators.timing_decorator.
TimingDecorator
(*, in_time: Union[str, datetime.datetime] = None, out_time: Union[str, datetime.datetime] = None, stale_time: Union[str, datetime.datetime] = None, expires_time: Union[str, datetime.datetime] = None, delay_milli: int = None, wait_until_time: Union[str, datetime.datetime] = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Class representing the timing decorator.
-
class
aries_cloudagent.messaging.decorators.timing_decorator.
TimingDecoratorSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
Timing decorator schema used in serialization/deserialization.
-
class
Meta
[source]¶ Bases:
object
TimingDecoratorSchema metadata.
-
model_class
¶ alias of
TimingDecorator
-
-
delay_milli
¶ Used by autodoc_mock_imports.
-
expires_time
¶ Used by autodoc_mock_imports.
-
in_time
¶ Used by autodoc_mock_imports.
-
out_time
¶ Used by autodoc_mock_imports.
-
stale_time
¶ Used by autodoc_mock_imports.
-
wait_until_time
¶ Used by autodoc_mock_imports.
-
class
The transport decorator (~transport).
This decorator allows changes to agent response behaviour and queue status updates.
-
class
aries_cloudagent.messaging.decorators.transport_decorator.
TransportDecorator
(*, return_route: str = None, return_route_thread: str = None, queued_message_count: int = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Class representing the transport decorator.
-
class
aries_cloudagent.messaging.decorators.transport_decorator.
TransportDecoratorSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
Transport decorator schema used in serialization/deserialization.
-
class
Meta
[source]¶ Bases:
object
TransportDecoratorSchema metadata.
-
model_class
¶ alias of
TransportDecorator
-
-
queued_message_count
¶ Used by autodoc_mock_imports.
-
return_route
¶ Used by autodoc_mock_imports.
-
return_route_thread
¶ Used by autodoc_mock_imports.
-
class
aries_cloudagent.messaging.discovery package¶
aries_cloudagent.messaging.introduction package¶
aries_cloudagent.messaging.models package¶
Base classes for Models and Schemas.
-
class
aries_cloudagent.messaging.models.base.
BaseModel
[source]¶ Bases:
abc.ABC
Base model that provides convenience methods.
-
Schema
¶ Accessor for the model’s schema class.
Returns: The schema class
-
classmethod
deserialize
(obj)[source]¶ Convert from JSON representation to a model instance.
Parameters: obj – The dict to load into a model instance Returns: A model instance for this data
-
classmethod
from_json
(json_repr: Union[str, bytes])[source]¶ Parse a JSON string into a model instance.
Parameters: json_repr – JSON string Returns: A model instance representation of this JSON
-
-
exception
aries_cloudagent.messaging.models.base.
BaseModelError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base exception class for base model errors.
-
class
aries_cloudagent.messaging.models.base.
BaseModelSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
BaseModel schema.
-
class
Meta
[source]¶ Bases:
object
BaseModelSchema metadata.
-
model_class
= None¶
-
ordered
= True¶
-
skip_values
= [None]¶
-
-
Model
¶ Accessor for the schema’s model class.
Returns: The model class
-
make_model
(data: dict, **kwargs)[source]¶ Return model instance after loading.
Returns: A model instance
-
class
Classes for BaseStorage-based record management.
-
class
aries_cloudagent.messaging.models.base_record.
BaseRecord
(id: str = None, state: str = None, *, created_at: Union[str, datetime.datetime] = None, updated_at: Union[str, datetime.datetime] = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Represents a single storage record.
-
CACHE_ENABLED
= False¶
-
CACHE_TTL
= 60¶
-
LOG_STATE_FLAG
= None¶
-
RECORD_ID_NAME
= 'id'¶
-
RECORD_TYPE
= None¶
-
TAG_NAMES
= {'state'}¶
-
WEBHOOK_TOPIC
= None¶
-
classmethod
cache_key
(record_id: str, record_type: str = None)[source]¶ Assemble a cache key.
Parameters: - record_id – The record identifier
- The cache type identifier, defaulting to RECORD_TYPE (record_type) –
-
clear_cached
(context: aries_cloudagent.config.injection_context.InjectionContext)[source]¶ Clear the cached value of this record, if any.
-
classmethod
clear_cached_key
(context: aries_cloudagent.config.injection_context.InjectionContext, cache_key: str)[source]¶ Shortcut method to clear a cached key value, if any.
Parameters: - context – The injection context to use
- cache_key – The unique cache identifier
-
delete_record
(context: aries_cloudagent.config.injection_context.InjectionContext)[source]¶ Remove the stored record.
Parameters: context – The injection context to use
-
classmethod
from_storage
(record_id: str, record: Mapping[str, Any])[source]¶ Initialize a record from its stored representation.
Parameters: - record_id – The unique record identifier
- record – The stored representation
-
classmethod
get_cached_key
(context: aries_cloudagent.config.injection_context.InjectionContext, cache_key: str)[source]¶ Shortcut method to fetch a cached key value.
Parameters: - context – The injection context to use
- cache_key – The unique cache identifier
-
classmethod
log_state
(context: aries_cloudagent.config.injection_context.InjectionContext, msg: str, params: dict = None, override: bool = False)[source]¶ Print a message with increased visibility (for testing).
-
post_save
(context: aries_cloudagent.config.injection_context.InjectionContext, new_record: bool, last_state: str, webhook: bool = None)[source]¶ Perform post-save actions.
Parameters: - context – The injection context to use
- new_record – Flag indicating if the record was just created
- last_state – The previous state value
- webhook – Adjust whether the webhook is called
-
classmethod
prefix_tag_filter
(tag_filter: dict)[source]¶ Prefix unencrypted tags used in the tag filter.
-
classmethod
query
(context: aries_cloudagent.config.injection_context.InjectionContext, tag_filter: dict = None, post_filter: dict = None) → Sequence[aries_cloudagent.messaging.models.base_record.BaseRecord][source]¶ Query stored records.
Parameters: - context – The injection context to use
- tag_filter – An optional dictionary of tag filter clauses
- post_filter – Additional value filters to apply
Accessor to define implementation-specific tags.
-
record_value
¶ Accessor to define custom properties for the JSON record value.
-
classmethod
retrieve_by_id
(context: aries_cloudagent.config.injection_context.InjectionContext, record_id: str, cached: bool = True) → aries_cloudagent.messaging.models.base_record.BaseRecord[source]¶ Retrieve a stored record by ID.
Parameters: - context – The injection context to use
- record_id – The ID of the record to find
- cached – Whether to check the cache for this record
-
classmethod
retrieve_by_tag_filter
(context: aries_cloudagent.config.injection_context.InjectionContext, tag_filter: dict, post_filter: dict = None) → aries_cloudagent.messaging.models.base_record.BaseRecord[source]¶ Retrieve a record by tag filter.
Parameters: - context – The injection context to use
- tag_filter – The filter dictionary to apply
- post_filter – Additional value filters to apply after retrieval
-
save
(context: aries_cloudagent.config.injection_context.InjectionContext, *, reason: str = None, log_params: Mapping[str, Any] = None, log_override: bool = False, webhook: bool = None) → str[source]¶ Persist the record to storage.
Parameters: - context – The injection context to use
- reason – A reason to add to the log
- log_params – Additional parameters to log
- webhook – Flag to override whether the webhook is sent
-
send_webhook
(context: aries_cloudagent.config.injection_context.InjectionContext, payload: Any, topic: str = None)[source]¶ Send a standard webhook.
Parameters: - context – The injection context to use
- payload – The webhook payload
- topic – The webhook topic, defaulting to WEBHOOK_TOPIC
-
classmethod
set_cached_key
(context: aries_cloudagent.config.injection_context.InjectionContext, cache_key: str, value: Any, ttl=None)[source]¶ Shortcut method to set a cached key value.
Parameters: - context – The injection context to use
- cache_key – The unique cache identifier
- value – The value to cache
- ttl – The cache ttl
-
storage_record
¶ Accessor for a StorageRecord representing this record.
Accessor for the record tags generated for this record.
-
value
¶ Accessor for the JSON record value generated for this record.
-
webhook_payload
¶ Return a JSON-serialized version of the record for the webhook.
-
webhook_topic
¶ Return the webhook topic value.
-
-
class
aries_cloudagent.messaging.models.base_record.
BaseRecordSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
Schema to allow serialization/deserialization of base records.
-
created_at
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyISO8601DateTime object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
state
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
updated_at
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyISO8601DateTime object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
aries_cloudagent.messaging.presentations package¶
aries_cloudagent.messaging.problem_report package¶
aries_cloudagent.messaging.routing package¶
aries_cloudagent.messaging.schemas package¶
Credential schema admin routes.
-
class
aries_cloudagent.messaging.schemas.routes.
SchemaGetResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for schema get request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.schemas.routes.
SchemaSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Content for returned schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.schemas.routes.
SchemaSendRequestSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Request schema for schema send request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.schemas.routes.
SchemaSendResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for schema send request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.messaging.schemas.routes.
SchemasCreatedResultsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Results schema for a schemas-created request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
aries_cloudagent.messaging.schemas.routes.
register
(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69905fd908>)[source]¶ Register routes.
-
aries_cloudagent.messaging.schemas.routes.
schemas_created
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f69905fd908>)[source]¶ Request handler for retrieving schemas that current agent created.
Parameters: request – aiohttp request object Returns: The identifiers of matching schemas
aries_cloudagent.messaging.trustping package¶
Submodules¶
aries_cloudagent.messaging.agent_message module¶
Agent message base class and schema.
-
class
aries_cloudagent.messaging.agent_message.
AgentMessage
(_id: str = None, _decorators: aries_cloudagent.messaging.decorators.base.BaseDecoratorSet = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Agent message base class.
-
Handler
¶ Accessor for the agent message’s handler class.
Returns: Handler class
-
class
Meta
[source]¶ Bases:
object
AgentMessage metadata.
-
handler_class
= None¶
-
message_type
= None¶
-
schema_class
= None¶
-
-
assign_thread_from
(msg: aries_cloudagent.messaging.agent_message.AgentMessage)[source]¶ Copy thread information from a previous message.
Parameters: msg – The received message containing optional thread information
-
assign_thread_id
(thid: str, pthid: str = None)[source]¶ Assign a specific thread ID.
Parameters: - thid – The thread identifier
- pthid – The parent thread identifier
-
get_signature
(field_name: str) → aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator[source]¶ Get the signature for a named field.
Parameters: field_name – Field name to get the signature for Returns: A SignatureDecorator for the requested field name
-
set_signature
(field_name: str, signature: aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator)[source]¶ Add or replace the signature for a named field.
Parameters: - field_name – Field to set signature on
- signature – Signature for the field
-
sign_field
(field_name: str, signer_verkey: str, wallet: aries_cloudagent.wallet.base.BaseWallet, timestamp=None) → aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator[source]¶ Create and store a signature for a named field.
Parameters: - field_name – Field to sign
- signer_verkey – Verkey of signer
- wallet – Wallet to use for signature
- timestamp – Optional timestamp for signature
Returns: A SignatureDecorator for newly created signature
Raises: ValueError
– If field_name doesn’t exist on this message
-
verify_signatures
(wallet: aries_cloudagent.wallet.base.BaseWallet) → bool[source]¶ Verify all associated field signatures.
Parameters: wallet – Wallet to use in verification Returns: True if all signatures verify, else false
-
verify_signed_field
(field_name: str, wallet: aries_cloudagent.wallet.base.BaseWallet, signer_verkey: str = None) → str[source]¶ Verify a specific field signature.
Parameters: - field_name – The field name to verify
- wallet – Wallet to use for the verification
- signer_verkey – Verkey of signer to use
Returns: The verkey of the signer
Raises: ValueError
– If field_name does not exist on this messageValueError
– If the verification failsValueError
– If the verkey of the signature does not match the- provided verkey
-
-
exception
aries_cloudagent.messaging.agent_message.
AgentMessageError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelError
Base exception for agent message issues.
-
class
aries_cloudagent.messaging.agent_message.
AgentMessageSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
AgentMessage schema.
-
class
Meta
[source]¶ Bases:
object
AgentMessageSchema metadata.
-
model_class
= None¶
-
signed_fields
= None¶
-
-
check_dump_decorators
(obj, **kwargs)[source]¶ Pre-dump hook to validate and load the message decorators.
Parameters: obj – The AgentMessage object Raises: BaseModelError
– If a decorator does not validate
-
dump_decorators
(data, **kwargs)[source]¶ Post-dump hook to write the decorators to the serialized output.
Parameters: obj – The serialized data Returns: The modified data
-
extract_decorators
(data, **kwargs)[source]¶ Pre-load hook to extract the decorators and check the signed fields.
Parameters: data – Incoming data to parse
Returns: Parsed and modified data
Raises: ValidationError
– If a field signature does not correlate- to a field in the message
ValidationError
– If the message defines both a field signature- and a value for the same field
ValidationError
– If there is a missing field signature
-
class
aries_cloudagent.messaging.base_context module¶
aries_cloudagent.messaging.base_handler module¶
A Base handler class for all message handlers.
aries_cloudagent.messaging.error module¶
Messaging-related error classes and codes.
aries_cloudagent.messaging.message_delivery module¶
aries_cloudagent.messaging.outbound_message module¶
aries_cloudagent.messaging.protocol_registry module¶
aries_cloudagent.messaging.request_context module¶
Request context class.
A request context provides everything required by handlers and other parts of the system to process a message.
-
class
aries_cloudagent.messaging.request_context.
RequestContext
(*, base_context: aries_cloudagent.config.injection_context.InjectionContext = None, settings: Mapping[str, object] = None)[source]¶ Bases:
aries_cloudagent.config.injection_context.InjectionContext
Context established by the Conductor and passed into message handlers.
-
connection_ready
¶ Accessor for the flag indicating an active connection with the sender.
Returns: True if the connection is active, else False
-
connection_record
¶ Accessor for the related connection record.
-
copy
() → aries_cloudagent.messaging.request_context.RequestContext[source]¶ Produce a copy of the request context instance.
-
default_endpoint
¶ Accessor for the default agent endpoint (from agent config).
Returns: The default agent endpoint
-
default_label
¶ Accessor for the default agent label (from agent config).
Returns: The default label
-
message
¶ Accessor for the deserialized message instance.
Returns: This context’s agent message
-
message_receipt
¶ Accessor for the message receipt information.
Returns: This context’s message receipt information
-
aries_cloudagent.messaging.responder module¶
A message responder.
The responder is provided to message handlers to enable them to send a new message in response to the message being handled.
-
class
aries_cloudagent.messaging.responder.
BaseResponder
(*, connection_id: str = None, reply_session_id: str = None, reply_to_verkey: str = None)[source]¶ Bases:
abc.ABC
Interface for message handlers to send responses.
-
create_outbound
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], *, connection_id: str = None, reply_session_id: str = None, reply_thread_id: str = None, reply_to_verkey: str = None, target: aries_cloudagent.connections.models.connection_target.ConnectionTarget = None, target_list: Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget] = None) → aries_cloudagent.transport.outbound.message.OutboundMessage[source]¶ Create an OutboundMessage from a message payload.
-
send
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], **kwargs)[source]¶ Convert a message to an OutboundMessage and send it.
-
send_outbound
(message: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Send an outbound message.
Parameters: message – The OutboundMessage to be sent
-
send_reply
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], *, connection_id: str = None, target: aries_cloudagent.connections.models.connection_target.ConnectionTarget = None, target_list: Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget] = None)[source]¶ Send a reply to an incoming message.
Parameters: - message – the AgentMessage, or pre-packed str or bytes to reply with
- connection_id – optionally override the target connection ID
- target – optionally specify a ConnectionTarget to send to
Raises: ResponderError
– If there is no active connection
-
-
class
aries_cloudagent.messaging.responder.
MockResponder
[source]¶ Bases:
aries_cloudagent.messaging.responder.BaseResponder
Mock responder implementation for use by tests.
-
send
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], **kwargs)[source]¶ Convert a message to an OutboundMessage and send it.
-
send_outbound
(message: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Send an outbound message.
-
aries_cloudagent.messaging.serializer module¶
aries_cloudagent.messaging.socket module¶
aries_cloudagent.messaging.util module¶
Utils for messages.
-
aries_cloudagent.messaging.util.
canon
(raw_attr_name: str) → str[source]¶ Canonicalize input attribute name for indy proofs and credential offers.
Parameters: raw_attr_name – raw attribute name Returns: canonicalized attribute name
-
aries_cloudagent.messaging.util.
datetime_to_str
(dt: Union[str, datetime.datetime]) → str[source]¶ Convert a datetime object to an indy-standard datetime string.
Parameters: dt – May be a string or datetime to allow automatic conversion
-
aries_cloudagent.messaging.util.
epoch_to_str
(epoch: int) → str[source]¶ Convert epoch seconds to indy-standard datetime string.
Parameters: epoch – epoch seconds
-
aries_cloudagent.messaging.util.
str_to_datetime
(dt: Union[str, datetime.datetime]) → datetime.datetime[source]¶ Convert an indy-standard datetime string to a datetime.
Using a fairly lax regex pattern to match slightly different formats. In Python 3.7 datetime.fromisoformat might be used.
Parameters: dt – May be a string or datetime to allow automatic conversion
aries_cloudagent.storage package¶
Submodules¶
aries_cloudagent.storage.base module¶
Abstract base classes for non-secrets storage.
-
class
aries_cloudagent.storage.base.
BaseStorage
[source]¶ Bases:
abc.ABC
Abstract Non-Secrets interface.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete an existing record.
Parameters: record – StorageRecord to delete
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.base.BaseStorageRecordSearch[source]¶ Create a new record query.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of BaseStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
-
-
class
aries_cloudagent.storage.base.
BaseStorageRecordSearch
(store: aries_cloudagent.storage.base.BaseStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
abc.ABC
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord
-
fetch_all
() → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch all records from the query.
-
fetch_single
() → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a single query result.
-
handle
¶ Handle a search request.
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
option
(name: str, default=None)[source]¶ Fetch a named search option, if defined.
Returns: The option value or default
-
options
¶ Accessor for the search options.
Returns: The search options
-
page_size
¶ Accessor for page size.
Returns: The page size
-
store
¶ BaseStorage backend for this implementation.
Returns: The BaseStorage implementation being used
-
tag_query
¶ Accessor for tag query.
Returns: The tag query
-
type_filter
¶ Accessor for type filter.
Returns: The type filter
-
aries_cloudagent.storage.basic module¶
Basic in-memory storage implementation (non-wallet).
-
class
aries_cloudagent.storage.basic.
BasicStorage
(_wallet: aries_cloudagent.wallet.base.BaseWallet = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorage
Basic in-memory storage class.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
Raises: StorageError
– If no record is providedStorageError
– If the record has no ID
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete a record.
Parameters: record – StorageRecord to delete Raises: StorageNotFoundError
– If record not found
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
Raises: StorageNotFoundError
– If record not found
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
Raises: StorageNotFoundError
– If the record is not found
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.basic.BasicStorageRecordSearch[source]¶ Search stored records.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of BaseStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
Raises: StorageNotFoundError
– If record not found
-
-
class
aries_cloudagent.storage.basic.
BasicStorageRecordSearch
(store: aries_cloudagent.storage.basic.BasicStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorageRecordSearch
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord Raises: StorageSearchError
– If the search query has not been opened
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
aries_cloudagent.storage.error module¶
Storage-related exceptions.
-
exception
aries_cloudagent.storage.error.
StorageDuplicateError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
Duplicate record found in storage.
-
exception
aries_cloudagent.storage.error.
StorageError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base class for Storage errors.
-
exception
aries_cloudagent.storage.error.
StorageNotFoundError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
Record not found in storage.
-
exception
aries_cloudagent.storage.error.
StorageSearchError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
General exception during record search.
aries_cloudagent.storage.indy module¶
Indy implementation of BaseStorage interface.
-
class
aries_cloudagent.storage.indy.
IndyStorage
(wallet: aries_cloudagent.wallet.indy.IndyWallet)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorage
Indy Non-Secrets interface.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete a record.
Parameters: record – StorageRecord to delete
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
Raises: StorageError
– If the record is not providedStorageError
– If the record ID not providedStorageNotFoundError
– If the record is not foundStorageError
– If record not found
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.indy.IndyStorageRecordSearch[source]¶ Search stored records.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of IndyStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
-
update_record_value
(record: aries_cloudagent.storage.record.StorageRecord, value: str)[source]¶ Update an existing stored record’s value.
Parameters: - record – StorageRecord to update
- value – The new value
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
-
wallet
¶ Accessor for IndyWallet instance.
-
-
class
aries_cloudagent.storage.indy.
IndyStorageRecordSearch
(store: aries_cloudagent.storage.indy.IndyStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorageRecordSearch
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord Raises: StorageSearchError
– If the search query has not been opened
-
handle
¶ Accessor for search handle.
Returns: The handle
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
aries_cloudagent.storage.provider module¶
Default storage provider classes.
-
class
aries_cloudagent.storage.provider.
StorageProvider
[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for the default configurable storage classes.
-
STORAGE_TYPES
= {'basic': 'aries_cloudagent.storage.basic.BasicStorage', 'indy': 'aries_cloudagent.storage.indy.IndyStorage', 'postgres_storage': 'aries_cloudagent.storage.indy.IndyStorage'}¶
-
aries_cloudagent.storage.record module¶
Record instance stored and searchable by BaseStorage implementation.
-
class
aries_cloudagent.storage.record.
StorageRecord
[source]¶ Bases:
aries_cloudagent.storage.record.StorageRecord
Storage record class.
aries_cloudagent.tests package¶
Submodules¶
aries_cloudagent.tests.test_conductor module¶
aries_cloudagent.tests.test_dispatcher module¶
aries_cloudagent.tests.test_stats module¶
aries_cloudagent.tests.test_task_processor module¶
aries_cloudagent.transport package¶
Subpackages¶
aries_cloudagent.transport.inbound package¶
Base inbound transport class.
-
class
aries_cloudagent.transport.inbound.base.
BaseInboundTransport
(scheme: str, create_session: Callable, *, max_message_size: int = 0, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None)[source]¶ Bases:
abc.ABC
Base inbound transport class.
-
create_session
(*, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None) → Awaitable[aries_cloudagent.transport.inbound.session.InboundSession][source]¶ Create a new inbound session.
Parameters: - accept_undelivered – Flag for accepting undelivered messages
- can_respond – Flag indicating that the transport can send responses
- client_info – Request-specific client information
- wire_format – Optionally override the session wire format
-
max_message_size
¶ Accessor for this transport’s max message size.
-
scheme
¶ Accessor for this transport’s scheme.
-
-
class
aries_cloudagent.transport.inbound.base.
InboundTransportConfiguration
(module, host, port)¶ Bases:
tuple
-
host
¶ Alias for field number 1
-
module
¶ Alias for field number 0
-
port
¶ Alias for field number 2
-
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.error.TransportError
Generic inbound transport error.
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportRegistrationError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.InboundTransportError
Error in loading an inbound transport.
-
exception
aries_cloudagent.transport.inbound.base.
InboundTransportSetupError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.InboundTransportError
Setup error for an inbound transport.
Http Transport classes and functions.
-
class
aries_cloudagent.transport.inbound.http.
HttpTransport
(host: str, port: int, create_session, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.BaseInboundTransport
Http Transport class.
-
inbound_message_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f699030f3c8>)[source]¶ Message handler for inbound messages.
Parameters: request – aiohttp request object Returns: The web response
-
invite_message_handler
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f699030f3c8>)[source]¶ Message handler for invites.
Parameters: request – aiohttp request object Returns: The web response
-
make_application
() → <sphinx.ext.autodoc.importer._MockObject object at 0x7f699030f3c8>[source]¶ Construct the aiohttp application.
-
Inbound transport manager.
-
class
aries_cloudagent.transport.inbound.manager.
InboundTransportManager
(context: aries_cloudagent.config.injection_context.InjectionContext, receive_inbound: Coroutine[T_co, T_contra, V_co], return_inbound: Callable = None)[source]¶ Bases:
object
Inbound transport manager class.
-
closed_session
(session: aries_cloudagent.transport.inbound.session.InboundSession)[source]¶ Clean up a closed session.
Returns an undelivered message to the caller if possible.
-
create_session
(transport_type: str, *, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None)[source]¶ Create a new inbound session.
Parameters: - transport_type – The inbound transport identifier
- accept_undelivered – Flag for accepting undelivered messages
- can_respond – Flag indicating that the transport can send responses
- client_info – An optional dict describing the client
- wire_format – Override the wire format for this session
-
dispatch_complete
(message: aries_cloudagent.transport.inbound.message.InboundMessage, completed: aries_cloudagent.utils.task_queue.CompletedTask)[source]¶ Handle completion of message dispatch.
-
get_transport_instance
(transport_id: str) → aries_cloudagent.transport.inbound.base.BaseInboundTransport[source]¶ Get an instance of a running transport by ID.
-
process_undelivered
(session: aries_cloudagent.transport.inbound.session.InboundSession)[source]¶ Interact with undelivered queue to find applicable messages.
Parameters: session – The inbound session
-
register
(config: aries_cloudagent.transport.inbound.base.InboundTransportConfiguration) → str[source]¶ Register transport module.
Parameters: config – The inbound transport configuration
-
register_transport
(transport: aries_cloudagent.transport.inbound.base.BaseInboundTransport, transport_id: str) → str[source]¶ Register a new inbound transport class.
Parameters: - transport – Transport instance to register
- transport_id – The transport ID to register
-
return_to_session
(outbound: aries_cloudagent.transport.outbound.message.OutboundMessage) → bool[source]¶ Return an outbound message via an open session, if possible.
-
return_undelivered
(outbound: aries_cloudagent.transport.outbound.message.OutboundMessage) → bool[source]¶ Add an undelivered message to the undelivered queue.
At this point the message could not be associated with an inbound session and could not be delivered via an outbound transport.
-
Websockets Transport classes and functions.
-
class
aries_cloudagent.transport.inbound.ws.
WsTransport
(host: str, port: int, create_session, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.inbound.base.BaseInboundTransport
Websockets Transport class.
-
inbound_message_handler
(request)[source]¶ Message handler for inbound messages.
Parameters: request – aiohttp request object Returns: The web response
-
make_application
() → <sphinx.ext.autodoc.importer._MockObject object at 0x7f699064ae10>[source]¶ Construct the aiohttp application.
-
scheme
¶ Accessor for this transport’s scheme.
-
aries_cloudagent.transport.outbound package¶
Base outbound transport.
-
class
aries_cloudagent.transport.outbound.base.
BaseOutboundTransport
(wire_format: aries_cloudagent.transport.wire_format.BaseWireFormat = None)[source]¶ Bases:
abc.ABC
Base outbound transport class.
-
collector
¶ Accessor for the stats collector instance.
-
handle_message
(payload: Union[str, bytes], endpoint: str)[source]¶ Handle message from queue.
Parameters: - payload – message payload in string or byte format
- endpoint – URI endpoint for delivery
-
wire_format
¶ Accessor for a custom wire format for the transport.
-
-
exception
aries_cloudagent.transport.outbound.base.
OutboundDeliveryError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.outbound.base.OutboundTransportError
Base exception when a message cannot be delivered via an outbound transport.
-
exception
aries_cloudagent.transport.outbound.base.
OutboundTransportError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.error.TransportError
Generic outbound transport error.
-
exception
aries_cloudagent.transport.outbound.base.
OutboundTransportRegistrationError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.transport.outbound.base.OutboundTransportError
Outbound transport registration error.
Http outbound transport.
-
class
aries_cloudagent.transport.outbound.http.
HttpTransport
[source]¶ Bases:
aries_cloudagent.transport.outbound.base.BaseOutboundTransport
Http outbound transport class.
-
handle_message
(payload: Union[str, bytes], endpoint: str)[source]¶ Handle message from queue.
Parameters: message – OutboundMessage to send over transport implementation
-
schemes
= ('http', 'https')¶
-
Outbound transport manager.
-
class
aries_cloudagent.transport.outbound.manager.
OutboundTransportManager
(context: aries_cloudagent.config.injection_context.InjectionContext, handle_not_delivered: Callable = None)[source]¶ Bases:
object
Outbound transport manager class.
-
deliver_queued_message
(queued: aries_cloudagent.transport.outbound.manager.QueuedOutboundMessage) → _asyncio.Task[source]¶ Kick off delivery of a queued message.
-
encode_queued_message
(queued: aries_cloudagent.transport.outbound.manager.QueuedOutboundMessage) → _asyncio.Task[source]¶ Kick off encoding of a queued message.
-
enqueue_message
(context: aries_cloudagent.config.injection_context.InjectionContext, outbound: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Add an outbound message to the queue.
Parameters: - context – The context of the request
- outbound – The outbound message to deliver
-
enqueue_webhook
(topic: str, payload: dict, endpoint: str, max_attempts: int = None)[source]¶ Add a webhook to the queue.
Parameters: - topic – The webhook topic
- payload – The webhook payload
- endpoint – The webhook endpoint
- max_attempts – Override the maximum number of attempts
Raises: OutboundDeliveryError
– if the associated transport is not running
-
finished_deliver
(queued: aries_cloudagent.transport.outbound.manager.QueuedOutboundMessage, completed: aries_cloudagent.utils.task_queue.CompletedTask)[source]¶ Handle completion of queued message delivery.
-
finished_encode
(queued: aries_cloudagent.transport.outbound.manager.QueuedOutboundMessage, completed: aries_cloudagent.utils.task_queue.CompletedTask)[source]¶ Handle completion of queued message encoding.
-
get_registered_transport_for_scheme
(scheme: str) → str[source]¶ Find the registered transport ID for a given scheme.
-
get_running_transport_for_endpoint
(endpoint: str)[source]¶ Find the running transport ID to use for a given endpoint.
-
get_running_transport_for_scheme
(scheme: str) → str[source]¶ Find the running transport ID for a given scheme.
-
get_transport_instance
(transport_id: str) → aries_cloudagent.transport.outbound.base.BaseOutboundTransport[source]¶ Get an instance of a running transport by ID.
-
perform_encode
(queued: aries_cloudagent.transport.outbound.manager.QueuedOutboundMessage)[source]¶ Perform message encoding.
-
process_queued
() → _asyncio.Task[source]¶ Start the process to deliver queued messages if necessary.
Returns: the current queue processing task or None
-
register
(module: str) → str[source]¶ Register a new outbound transport by module path.
Parameters: module – Module name to register
Raises: OutboundTransportRegistrationError
– If the imported class cannot be locatedOutboundTransportRegistrationError
– If the imported class does not specify a schemes attributeOutboundTransportRegistrationError
– If the scheme has already been registered
-
register_class
(transport_class: Type[aries_cloudagent.transport.outbound.base.BaseOutboundTransport], transport_id: str = None) → str[source]¶ Register a new outbound transport class.
Parameters: transport_class – Transport class to register
Raises: OutboundTransportRegistrationError
– If the imported class does not specify a schemes attributeOutboundTransportRegistrationError
– If the scheme has already been registered
-
-
class
aries_cloudagent.transport.outbound.manager.
QueuedOutboundMessage
(context: aries_cloudagent.config.injection_context.InjectionContext, message: aries_cloudagent.transport.outbound.message.OutboundMessage, target: aries_cloudagent.connections.models.connection_target.ConnectionTarget, transport_id: str)[source]¶ Bases:
object
Class representing an outbound message pending delivery.
-
STATE_DELIVER
= 'deliver'¶
-
STATE_DONE
= 'done'¶
-
STATE_ENCODE
= 'encode'¶
-
STATE_NEW
= 'new'¶
-
STATE_PENDING
= 'pending'¶
-
STATE_RETRY
= 'retry'¶
-
Websockets outbound transport.
-
class
aries_cloudagent.transport.outbound.ws.
WsTransport
[source]¶ Bases:
aries_cloudagent.transport.outbound.base.BaseOutboundTransport
Websockets outbound transport class.
-
handle_message
(payload: Union[str, bytes], endpoint: str)[source]¶ Handle message from queue.
Parameters: message – OutboundMessage to send over transport implementation
-
schemes
= ('ws', 'wss')¶
-
aries_cloudagent.verifier package¶
Submodules¶
aries_cloudagent.verifier.base module¶
Base Verifier class.
aries_cloudagent.verifier.indy module¶
Indy verifier implementation.
-
class
aries_cloudagent.verifier.indy.
IndyVerifier
(wallet)[source]¶ Bases:
aries_cloudagent.verifier.base.BaseVerifier
Indy holder class.
aries_cloudagent.wallet package¶
Abstract and Indy wallet handling.
Submodules¶
aries_cloudagent.wallet.base module¶
Wallet base class.
-
class
aries_cloudagent.wallet.base.
BaseWallet
(config: dict)[source]¶ Bases:
abc.ABC
Abstract wallet interface.
-
WALLET_TYPE
= None¶
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: The created DIDInfo
-
create_public_did
(seed: str = None, did: str = None, metadata: dict = {}) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new public DID.
Implicitly flags all other dids as not public.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: The created DIDInfo
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Optional seed allowing deterministic key creation
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
-
created
¶ Check whether the wallet was created on the last open call.
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for Returns: A DIDInfo instance for the DID
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – Verkey to get DID info for Returns: A DIDInfo instance for the DID
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of DIDInfo instances
-
get_public_did
() → aries_cloudagent.wallet.base.DIDInfo[source]¶ Retrieve the public did.
Returns: The created DIDInfo
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair Returns: A KeyInfo representing the keypair
-
handle
¶ Get internal wallet reference.
Returns: Defaults to None
-
name
¶ Accessor for the wallet name.
Returns: Defaults to None
-
opened
¶ Check whether wallet is currently open.
Returns: Defaults to False
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – The verkeys to pack the message for
- from_verkey – The sender verkey
Returns: The packed message
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace the metadata associated with a local DID.
Parameters: - did – DID to replace metadata for
- metadata – The new metadata
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
-
set_public_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Assign the public did.
Returns: The created DIDInfo
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – The message to sign
- from_verkey – Sign using the private key related to this verkey
Returns: The signature
-
type
¶ Accessor for the wallet type.
Returns: Defaults to None
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The encrypted message Returns: (message, from_verkey, to_verkey) Return type: A tuple
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – The message to verify
- signature – The signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
-
aries_cloudagent.wallet.basic module¶
In-memory implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.basic.
BasicWallet
(config: dict = None)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
In-memory wallet implementation.
-
WALLET_TYPE
= 'basic'¶
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: A DIDInfo instance representing the created DID
Raises: WalletDuplicateError
– If the DID already exists in the wallet
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Seed to use for signing key
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
Raises: WalletDuplicateError
– If the resulting verkey already exists in the wallet
-
created
¶ Check whether the wallet was created on the last open call.
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the DID is not found
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey to get the local DID for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair Returns: A KeyInfo representing the keypair Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
name
¶ Accessor for the wallet name.
-
opened
¶ Check whether wallet is currently open.
Returns: True
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – List of verkeys to pack for
- from_verkey – Sender verkey to pack from
Returns: The resulting packed message bytes
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID to replace metadata for
- metadata – The new metadata
Raises: WalletNotFoundError
– If the DID doesn’t exist
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – Message bytes to sign
- from_verkey – The verkey to use to sign
Returns: A signature
Raises: WalletError
– If the message is not providedWalletError
– If the verkey is not provided
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The packed message bytes
Returns: (message, from_verkey, to_verkey)
Return type: A tuple
Raises: WalletError
– If the message is not providedWalletError
– If there is a problem unpacking the message
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – Message to verify
- signature – Signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
Raises: WalletError
– If the verkey is not providedWalletError
– If the signature is not providedWalletError
– If the message is not provided
-
aries_cloudagent.wallet.crypto module¶
Cryptography functions used by BasicWallet.
-
class
aries_cloudagent.wallet.crypto.
PackMessageSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Packed message schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientHeaderSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Packed recipient header schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Packed recipient schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientsSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Packed recipients schema.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
aries_cloudagent.wallet.crypto.
create_keypair
(seed: bytes = None) → Tuple[bytes, bytes][source]¶ Create a public and private signing keypair from a seed value.
Parameters: seed – Seed for keypair Returns: A tuple of (public key, secret key)
-
aries_cloudagent.wallet.crypto.
decode_pack_message
(enc_message: bytes, find_key: Callable) → Tuple[str, Optional[str], str][source]¶ Decode a packed message.
Disassemble and unencrypt a packed message, returning the message content, verification key of the sender (if available), and verification key of the recipient.
Parameters: - enc_message – The encrypted message
- find_key – Function to retrieve private key
Returns: A tuple of (message, sender_vk, recip_vk)
Raises: ValueError
– If the packed message is invalidValueError
– If the packed message reipients are invalidValueError
– If the pack algorithm is unsupportedValueError
– If the sender’s public key was not provided
-
aries_cloudagent.wallet.crypto.
decode_pack_message_outer
(enc_message: bytes) → Tuple[dict, dict, bool][source]¶ Decode the outer wrapper of a packed message and extract the recipients.
Parameters: enc_message – The encrypted message Returns: a tuple of the decoded wrapper, recipients, and authcrypt flag
-
aries_cloudagent.wallet.crypto.
decode_pack_message_payload
(wrapper: dict, payload_key: bytes) → str[source]¶ Decode the payload of a packed message once the CEK is known.
Parameters: - wrapper – The decoded message wrapper
- payload_key – The decrypted payload key
-
aries_cloudagent.wallet.crypto.
decrypt_plaintext
(ciphertext: bytes, recips_bin: bytes, nonce: bytes, key: bytes) → str[source]¶ Decrypt the payload of a packed message.
Parameters: - ciphertext –
- recips_bin –
- nonce –
- key –
Returns: The decrypted string
-
aries_cloudagent.wallet.crypto.
encode_pack_message
(message: str, to_verkeys: Sequence[bytes], from_secret: bytes = None) → bytes[source]¶ Assemble a packed message for a set of recipients, optionally including the sender.
Parameters: - message – The message to pack
- to_verkeys – The verkeys to pack the message for
- from_secret – The sender secret
Returns: The encoded message
-
aries_cloudagent.wallet.crypto.
encrypt_plaintext
(message: str, add_data: bytes, key: bytes) → Tuple[bytes, bytes, bytes][source]¶ Encrypt the payload of a packed message.
Parameters: - message – Message to encrypt
- add_data –
- key – Key used for encryption
Returns: A tuple of (ciphertext, nonce, tag)
-
aries_cloudagent.wallet.crypto.
extract_pack_recipients
(recipients: Sequence[dict]) → dict[source]¶ Extract the pack message recipients into a dict indexed by verkey.
Parameters: recipients – Recipients to locate Raises: ValueError
– If the recipients block is mal-formatted
-
aries_cloudagent.wallet.crypto.
extract_payload_key
(sender_cek: dict, recip_secret: bytes) → Tuple[bytes, str][source]¶ Extract the payload key from pack recipient details.
Returns: A tuple of the CEK and sender verkey
-
aries_cloudagent.wallet.crypto.
prepare_pack_recipient_keys
(to_verkeys: Sequence[bytes], from_secret: bytes = None) → Tuple[str, bytes][source]¶ Assemble the recipients block of a packed message.
Parameters: - to_verkeys – Verkeys of recipients
- from_secret – Secret to use for signing keys
Returns: A tuple of (json result, key)
-
aries_cloudagent.wallet.crypto.
random_seed
() → bytes[source]¶ Generate a random seed value.
Returns: A new random seed
-
aries_cloudagent.wallet.crypto.
seed_to_did
(seed: str) → str[source]¶ Derive a DID from a seed value.
Parameters: seed – The seed to derive Returns: The DID derived from the seed
-
aries_cloudagent.wallet.crypto.
sign_message
(message: bytes, secret: bytes) → bytes[source]¶ Sign a message using a private signing key.
Parameters: - message – The message to sign
- secret – The private signing key
Returns: The signature
-
aries_cloudagent.wallet.crypto.
sign_pk_from_sk
(secret: bytes) → bytes[source]¶ Extract the verkey from a secret signing key.
aries_cloudagent.wallet.error module¶
Wallet-related exceptions.
-
exception
aries_cloudagent.wallet.error.
WalletDuplicateError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.wallet.error.WalletError
Duplicate record exception.
-
exception
aries_cloudagent.wallet.error.
WalletError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
General wallet exception.
-
exception
aries_cloudagent.wallet.error.
WalletNotFoundError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.wallet.error.WalletError
Record not found exception.
aries_cloudagent.wallet.indy module¶
Indy implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.indy.
IndyWallet
(config: dict = None)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
Indy wallet implementation.
-
DEFAULT_FRESHNESS
= 0¶
-
DEFAULT_KEY
= ''¶
-
DEFAULT_KEY_DERIVIATION
= 'ARGON2I_MOD'¶
-
DEFAULT_NAME
= 'default'¶
-
DEFAULT_STORAGE_TYPE
= None¶
-
KEY_DERIVATION_ARGON2I_INT
= 'ARGON2I_INT'¶
-
KEY_DERIVATION_ARGON2I_MOD
= 'ARGON2I_MOD'¶
-
KEY_DERIVATION_RAW
= 'RAW'¶
-
WALLET_TYPE
= 'indy'¶
-
create
(replace: bool = False)[source]¶ Create a new wallet.
Parameters: replace – Removes the old wallet if True
Raises: WalletError
– If there was a problem removing the walletWalletError
– IF there was a libindy error
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: A DIDInfo instance representing the created DID
Raises: WalletDuplicateError
– If the DID already exists in the walletWalletError
– If there is a libindy error
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Seed for key
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
Raises: WalletDuplicateError
– If the resulting verkey already exists in the walletWalletError
– If there is a libindy error
-
created
¶ Check whether the wallet was created on the last open call.
-
get_credential_definition_tag_policy
(credential_definition_id: str)[source]¶ Return the tag policy for a given credential definition ID.
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for
Returns: A DIDInfo instance representing the found DID
Raises: WalletNotFoundError
– If the DID is not foundWalletError
– If there is a libindy error
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey to get the local DID for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair
Returns: A KeyInfo representing the keypair
Raises: WalletNotFoundError
– If no keypair is associated with the verification keyWalletError
– If there is a libindy error
-
handle
¶ Get internal wallet reference.
Returns: A handle to the wallet
-
master_secret_id
¶ Accessor for the master secret id.
Returns: The master secret id
-
name
¶ Accessor for the wallet name.
Returns: The wallet name
-
open
()[source]¶ Open wallet, removing and/or creating it if so configured.
Raises: WalletError
– If wallet not found after creationWalletNotFoundError
– If the wallet is not foundWalletError
– If the wallet is already openWalletError
– If there is a libindy error
-
opened
¶ Check whether wallet is currently open.
Returns: True if open, else False
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – List of verkeys to pack for
- from_verkey – Sender verkey to pack from
Returns: The resulting packed message bytes
Raises: WalletError
– If no message is providedWalletError
– If a libindy error occurs
-
remove
()[source]¶ Remove an existing wallet.
Raises: WalletNotFoundError
– If the wallet could not be foundWalletError
– If there was an libindy error
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID to replace metadata for
- metadata – The new metadata
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
set_credential_definition_tag_policy
(credential_definition_id: str, taggables: Sequence[str] = None, retroactive: bool = True)[source]¶ Set the tag policy for a given credential definition ID.
Parameters: - credential_definition_id – The ID of the credential definition
- taggables – A sequence of string values representing attribute names
- retroactive – Whether to apply the policy to previously-stored credentials
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – Message bytes to sign
- from_verkey – The verkey to use to sign
Returns: A signature
Raises: WalletError
– If the message is not providedWalletError
– If the verkey is not providedWalletError
– If a libindy error occurs
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The packed message bytes
Returns: (message, from_verkey, to_verkey)
Return type: A tuple
Raises: WalletError
– If the message is not providedWalletError
– If a libindy error occurs
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – Message to verify
- signature – Signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
Raises: WalletError
– If the verkey is not providedWalletError
– If the signature is not providedWalletError
– If the message is not providedWalletError
– If a libindy error occurs
-
aries_cloudagent.wallet.provider module¶
Default wallet provider classes.
-
class
aries_cloudagent.wallet.provider.
WalletProvider
[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for the default configurable wallet classes.
-
WALLET_TYPES
= {'basic': 'aries_cloudagent.wallet.basic.BasicWallet', 'indy': 'aries_cloudagent.wallet.indy.IndyWallet'}¶
-
aries_cloudagent.wallet.routes module¶
Wallet admin routes.
-
class
aries_cloudagent.wallet.routes.
DIDListSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Result schema for connection list.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDResultSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Result schema for a DID.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Result schema for a DID.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.routes.
GetTagPolicyResultSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Result schema for tagging policy get request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.wallet.routes.
SetTagPolicyRequestSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Request schema for tagging policy set request.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
aries_cloudagent.wallet.routes.
format_did_info
(info: aries_cloudagent.wallet.base.DIDInfo)[source]¶ Serialize a DIDInfo object.
-
aries_cloudagent.wallet.routes.
register
(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991174e48>)[source]¶ Register routes.
-
aries_cloudagent.wallet.routes.
wallet_create_did
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991174e48>)[source]¶ Request handler for creating a new wallet DID.
Parameters: request – aiohttp request object Returns: The DID info
-
aries_cloudagent.wallet.routes.
wallet_did_list
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991174e48>)[source]¶ Request handler for searching wallet DIDs.
Parameters: request – aiohttp request object Returns: The DID list response
-
aries_cloudagent.wallet.routes.
wallet_get_public_did
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991174e48>)[source]¶ Request handler for fetching the current public DID.
Parameters: request – aiohttp request object Returns: The DID info
-
aries_cloudagent.wallet.routes.
wallet_get_tagging_policy
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7f6991174e48>)[source]¶ Request handler for getting the tag policy associated with a cred def.
Parameters: request – aiohttp request object Returns: A JSON object containing the tagging policy
aries_cloudagent.wallet.util module¶
Wallet utility functions.
-
aries_cloudagent.wallet.util.
b58_to_bytes
(val: str) → bytes[source]¶ Convert a base 58 string to bytes.
-
aries_cloudagent.wallet.util.
b64_to_bytes
(val: str, urlsafe=False) → bytes[source]¶ Convert a base 64 string to bytes.
-
aries_cloudagent.wallet.util.
b64_to_str
(val: str, urlsafe=False, encoding=None) → str[source]¶ Convert a base 64 string to string on input encoding (default utf-8).
-
aries_cloudagent.wallet.util.
bytes_to_b58
(val: bytes) → str[source]¶ Convert a byte string to base 58.
-
aries_cloudagent.wallet.util.
bytes_to_b64
(val: bytes, urlsafe=False, pad=True) → str[source]¶ Convert a byte string to base 64.
-
aries_cloudagent.wallet.util.
pad
(val: str) → str[source]¶ Pad base64 values if need be: JWT calls to omit trailing padding.
-
aries_cloudagent.wallet.util.
set_urlsafe_b64
(val: str, urlsafe: bool = True) → str[source]¶ Set URL safety in base64 encoding.
Submodules¶
aries_cloudagent.classloader module¶
aries_cloudagent.conductor module¶
aries_cloudagent.defaults module¶
aries_cloudagent.dispatcher module¶
aries_cloudagent.error module¶
aries_cloudagent.postgres module¶
aries_cloudagent.stats module¶
aries_cloudagent.task_processor module¶
aries_cloudagent.version module¶
Library version information.