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.
-
create_and_send_credential_definition
(issuer: aries_cloudagent.issuer.base.BaseIssuer, schema_id: str, signature_type: str = None, tag: str = None, support_revocation: bool = False) → Tuple[str, dict][source]¶ Send credential definition to ledger and store relevant key matter in wallet.
Parameters: - issuer – The issuer instance to use for credential definition creation
- schema_id – The schema id of the schema to create cred def for
- signature_type – The signature type to use on the credential definition
- tag – Optional tag to distinguish multiple credential definitions
- support_revocation – Optional flag to enable revocation for this cred def
-
create_and_send_schema
(issuer: aries_cloudagent.issuer.base.BaseIssuer, schema_name: str, schema_version: str, attribute_names: Sequence[str]) → Tuple[str, dict][source]¶ Send schema to ledger.
Parameters: - issuer – The issuer instance to use for schema creation
- schema_name – The schema name
- schema_version – The schema version
- attribute_names – A list of schema attributes
Fetch the current AML and TAA from the ledger.
-
get_credential_definition
(credential_definition_id: str) → dict[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_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_revoc_reg_def
(revoc_reg_id: str) → dict[source]¶ Look up a revocation registry definition by ID.
-
get_revoc_reg_delta
(revoc_reg_id: str, timestamp_from=0, timestamp_to=None) -> (<class 'dict'>, <class 'int'>)[source]¶ Look up a revocation registry delta by ID.
-
get_revoc_reg_entry
(revoc_reg_id: str, timestamp: int)[source]¶ Get revocation registry entry by revocation registry ID and timestamp.
-
get_schema
(schema_id: str) → dict[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_revoc_reg_def
(revoc_reg_def: dict, issuer_did: str = None)[source]¶ Publish a revocation registry definition to the ledger.
-
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.
IndyLedger
(pool_name: str, wallet: aries_cloudagent.wallet.base.BaseWallet, *, keepalive: int = 0, cache: aries_cloudagent.cache.base.BaseCache = None, cache_duration: int = 600, read_only: bool = False)[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]) → Tuple[str, dict][source]¶ Check if a schema has already been published.
-
create_and_send_credential_definition
(issuer: aries_cloudagent.issuer.base.BaseIssuer, schema_id: str, signature_type: str = None, tag: str = None, support_revocation: bool = False) → Tuple[str, dict][source]¶ Send credential definition to ledger and store relevant key matter in wallet.
Parameters: - issuer – The issuer instance to use for credential definition creation
- schema_id – The schema id of the schema to create cred def for
- signature_type – The signature type to use on the credential definition
- tag – Optional tag to distinguish multiple credential definitions
- support_revocation – Optional flag to enable revocation for this cred def
-
create_and_send_schema
(issuer: aries_cloudagent.issuer.base.BaseIssuer, schema_name: str, schema_version: str, attribute_names: Sequence[str]) → Tuple[str, dict][source]¶ Send schema to ledger.
Parameters: - issuer – The issuer instance creating the schema
- schema_name – The schema name
- schema_version – The schema version
- attribute_names – A list of schema attributes
-
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) → dict[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) → dict[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) → dict[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_revoc_reg_delta
(revoc_reg_id: str, timestamp_from=0, timestamp_to=None) -> (<class 'dict'>, <class 'int'>)[source]¶ Look up a revocation registry delta by ID.
:param revoc_reg_id revocation registry id :param timestamp_from from time. a total number of seconds from Unix Epoch :param timestamp_to to time. a total number of seconds from Unix Epoch
:returns delta response, delta timestamp
-
get_revoc_reg_entry
(revoc_reg_id: str, timestamp: int)[source]¶ Get revocation registry entry by revocation registry ID and timestamp.
-
get_schema
(schema_id: str) → dict[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_revoc_reg_def
(revoc_reg_def: dict, issuer_did: str = None)[source]¶ Publish a revocation registry definition to the ledger.
-
send_revoc_reg_entry
(revoc_reg_id: str, revoc_def_type: str, revoc_reg_entry: dict, issuer_did: str = None)[source]¶ Publish a revocation registry entry to the ledger.
-
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.ledger.routes module¶
Ledger admin routes.
-
class
aries_cloudagent.ledger.routes.
AMLRecordSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Ledger AML record.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.ledger.routes.
TAAAcceptSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Input schema for accepting the TAA.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.ledger.routes.
TAAAcceptanceSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
TAA acceptance record.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.ledger.routes.
TAAInfoSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Transaction author agreement info.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.ledger.routes.
TAARecordSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Ledger TAA record.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
class
aries_cloudagent.ledger.routes.
TAAResultSchema
(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
marshmallow.schema.Schema
Result schema for a transaction author agreement.
-
opts
= <marshmallow.schema.SchemaOpts object>¶
-
-
aries_cloudagent.ledger.routes.
get_did_endpoint
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc1d8485e80>)[source]¶ Request handler for getting a verkey for a DID from the ledger.
Parameters: request – aiohttp request object
-
aries_cloudagent.ledger.routes.
get_did_verkey
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc1d8485e80>)[source]¶ Request handler for getting a verkey for a DID from the ledger.
Parameters: request – aiohttp request object
-
aries_cloudagent.ledger.routes.
ledger_accept_taa
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc1d8485e80>)[source]¶ Request handler for accepting the current transaction author agreement.
Parameters: request – aiohttp request object Returns: The DID list response
-
aries_cloudagent.ledger.routes.
ledger_get_taa
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc1d8485e80>)[source]¶ Request handler for fetching the transaction author agreement.
Parameters: request – aiohttp request object Returns: The TAA information including the AML
aries_cloudagent.ledger.util module¶
Ledger utilities.