aries_cloudagent.ledger package
Subpackages
- aries_cloudagent.ledger.merkel_validation package
- Submodules
- aries_cloudagent.ledger.merkel_validation.constants module
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler module
- aries_cloudagent.ledger.merkel_validation.hasher module
- aries_cloudagent.ledger.merkel_validation.merkel_verifier module
- aries_cloudagent.ledger.merkel_validation.trie module
- aries_cloudagent.ledger.merkel_validation.utils module
- aries_cloudagent.ledger.multiple_ledger package
- Submodules
- aries_cloudagent.ledger.multiple_ledger.base_manager module
- aries_cloudagent.ledger.multiple_ledger.indy_manager module
- aries_cloudagent.ledger.multiple_ledger.indy_vdr_manager module
- aries_cloudagent.ledger.multiple_ledger.ledger_config_schema module
- aries_cloudagent.ledger.multiple_ledger.ledger_requests_executor module
- aries_cloudagent.ledger.multiple_ledger.manager_provider module
Submodules
aries_cloudagent.ledger.base module
Ledger base class.
- class aries_cloudagent.ledger.base.BaseLedger[source]
Bases:
abc.ABC
Base class for ledger.
- abstract async accept_txn_author_agreement(taa_record: dict, mechanism: str, accept_time: Optional[int] = None)[source]
Save a new record recording the acceptance of the TAA.
- abstract async create_and_send_credential_definition(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_id: str, signature_type: Optional[str] = None, tag: Optional[str] = None, support_revocation: bool = False, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[str, dict, bool] [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
- Returns
Tuple with cred def id, cred def structure, and whether it’s novel
- abstract async create_and_send_schema(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_name: str, schema_version: str, attribute_names: Sequence[str], write_ledger: bool = True, endorser_did: Optional[str] = None) 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
- abstract async get_all_endpoints_for_did(did: str) dict [source]
Fetch all endpoints for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
- abstract async 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
- abstract async get_endpoint_for_did(did: str, endpoint_type: aries_cloudagent.ledger.endpoint_type.EndpointType = EndpointType.ENDPOINT) str [source]
Fetch the endpoint for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
endpoint_type – The type of the endpoint (default ‘endpoint’)
- abstract async 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
- abstract async get_nym_role(did: str)[source]
Return the role registered to input public DID on the ledger.
- Parameters
did – DID to register on the ledger.
- abstract async get_revoc_reg_def(revoc_reg_id: str) dict [source]
Look up a revocation registry definition by ID.
- abstract async get_revoc_reg_delta(revoc_reg_id: str, timestamp_from=0, timestamp_to=None) Tuple[dict, int] [source]
Look up a revocation registry delta by ID.
- abstract async get_revoc_reg_entry(revoc_reg_id: str, timestamp: int) Tuple[dict, int] [source]
Get revocation registry entry by revocation registry ID and timestamp.
- abstract async 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
- abstract async get_txn_author_agreement(reload: bool = False)[source]
Get the current transaction author agreement, fetching it if necessary.
- abstract async register_nym(did: str, verkey: str, alias: Optional[str] = None, role: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[bool, dict] [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.
- abstract async rotate_public_did_keypair(next_seed: Optional[str] = None) None [source]
Rotate keypair for public DID: create new key, submit to ledger, update wallet.
- Parameters
next_seed – seed for incoming ed25519 keypair (default random)
- abstract async send_revoc_reg_def(revoc_reg_def: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry definition to the ledger.
- abstract async send_revoc_reg_entry(revoc_reg_id: str, revoc_def_type: str, revoc_reg_entry: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry entry to the ledger.
- abstract async txn_endorse(request_json: str, endorse_did: Optional[aries_cloudagent.wallet.did_info.DIDInfo] = None) str [source]
Endorse (sign) the provided transaction.
- abstract async txn_submit(request_json: str, sign: bool, taa_accept: bool, sign_did: aries_cloudagent.wallet.did_info.DIDInfo = <object object>) str [source]
Write the provided (signed and possibly endorsed) transaction to the ledger.
- abstract async update_endpoint_for_did(did: str, endpoint: str, endpoint_type: aries_cloudagent.ledger.endpoint_type.EndpointType = EndpointType.ENDPOINT, write_ledger: bool = True, endorser_did: Optional[str] = None) bool [source]
Check and update the endpoint on the ledger.
- Parameters
did – The ledger DID
endpoint – The endpoint address
endpoint_type – The type of the endpoint (default ‘endpoint’)
- class aries_cloudagent.ledger.base.Role(value)[source]
Bases:
enum.Enum
Enum for indy roles.
- ENDORSER = (101,)
- NETWORK_MONITOR = (201,)
- ROLE_REMOVE = ('',)
- STEWARD = (2,)
- TRUSTEE = (0,)
- USER = (None, '')
- static get(token: Optional[Union[str, int]] = None) aries_cloudagent.ledger.base.Role [source]
Return enum instance corresponding to input token.
- Parameters
token – token identifying role to indy-sdk: “STEWARD”, “TRUSTEE”, “ENDORSER”, “” or None
aries_cloudagent.ledger.endpoint_type module
Ledger utilities.
- class aries_cloudagent.ledger.endpoint_type.EndpointType(value)[source]
Bases:
enum.Enum
Enum for endpoint/service types.
- ENDPOINT = EndpointTypeName(w3c='Endpoint', indy='endpoint')
- LINKED_DOMAINS = EndpointTypeName(w3c='LinkedDomains', indy='linked_domains')
- PROFILE = EndpointTypeName(w3c='Profile', indy='profile')
- static get(name: str) aries_cloudagent.ledger.endpoint_type.EndpointType [source]
Return enum instance corresponding to input string.
- property indy
internally-facing, on ledger and in wallet.
- Type
Indy name of endpoint type
- property w3c
externally-facing.
- Type
W3C name of endpoint type
aries_cloudagent.ledger.error module
Ledger related errors.
- exception aries_cloudagent.ledger.error.BadLedgerRequestError(*args, error_code: Optional[str] = None, **kwargs)[source]
Bases:
aries_cloudagent.ledger.error.LedgerError
The current request cannot proceed.
- exception aries_cloudagent.ledger.error.ClosedPoolError(*args, error_code: Optional[str] = None, **kwargs)[source]
Bases:
aries_cloudagent.ledger.error.LedgerError
Indy pool is closed.
- exception aries_cloudagent.ledger.error.LedgerConfigError(*args, error_code: Optional[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: Optional[str] = None, **kwargs)[source]
Bases:
aries_cloudagent.core.error.BaseError
Base class for ledger errors.
- exception aries_cloudagent.ledger.error.LedgerTransactionError(*args, error_code: Optional[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.IndySdkLedger(pool: aries_cloudagent.ledger.indy.IndySdkLedgerPool, profile: aries_cloudagent.core.profile.Profile)[source]
Bases:
aries_cloudagent.ledger.base.BaseLedger
Indy ledger class.
- async accept_txn_author_agreement(taa_record: dict, mechanism: str, accept_time: Optional[int] = None)[source]
Save a new record recording the acceptance of the TAA.
- async build_and_return_get_nym_request(submitter_did: Optional[str], target_did: str) str [source]
Build GET_NYM request and return request_json.
- async 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.
- async create_and_send_credential_definition(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_id: str, signature_type: Optional[str] = None, tag: Optional[str] = None, support_revocation: bool = False, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[str, dict, bool] [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
- Returns
Tuple with cred def id, cred def structure, and whether it’s novel
- async create_and_send_schema(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_name: str, schema_version: str, attribute_names: Sequence[str], write_ledger: bool = True, endorser_did: Optional[str] = None) 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
- async 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
- async 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
- async 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
- async 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
- async get_all_endpoints_for_did(did: str) dict [source]
Fetch all endpoints for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
- async 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
- async get_endpoint_for_did(did: str, endpoint_type: Optional[aries_cloudagent.ledger.endpoint_type.EndpointType] = None) str [source]
Fetch the endpoint for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
endpoint_type – The type of the endpoint. If none given, returns all
- async get_indy_storage() aries_cloudagent.storage.indy.IndySdkStorage [source]
Get an IndySdkStorage instance for the current wallet.
- async 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
- async get_nym_role(did: str) aries_cloudagent.ledger.base.Role [source]
Return the role of the input public DID’s NYM on the ledger.
- Parameters
did – DID to query for role on the ledger.
- async get_revoc_reg_def(revoc_reg_id: str) dict [source]
Get revocation registry definition by ID; augment with ledger timestamp.
- async get_revoc_reg_delta(revoc_reg_id: str, fro=0, to=None) Tuple[dict, int] [source]
Look up a revocation registry delta by ID.
:param revoc_reg_id revocation registry id :param fro earliest EPOCH time of interest :param to latest EPOCH time of interest
:returns delta response, delta timestamp
- async get_revoc_reg_entry(revoc_reg_id: str, timestamp: int)[source]
Get revocation registry entry by revocation registry ID and timestamp.
- async 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
- async get_txn_author_agreement(reload: bool = False) dict [source]
Get the current transaction author agreement, fetching it if necessary.
- async get_wallet_public_did() aries_cloudagent.wallet.did_info.DIDInfo [source]
Fetch the public DID from the wallet.
- property pool_handle
Accessor for the ledger pool handle.
- async register_nym(did: str, verkey: str, alias: Optional[str] = None, role: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[bool, dict] [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.
- async rotate_public_did_keypair(next_seed: Optional[str] = None) None [source]
Rotate keypair for public DID: create new key, submit to ledger, update wallet.
- Parameters
next_seed – seed for incoming ed25519 keypair (default random)
- async send_revoc_reg_def(revoc_reg_def: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry definition to the ledger.
- async send_revoc_reg_entry(revoc_reg_id: str, revoc_def_type: str, revoc_reg_entry: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry entry to the ledger.
- async submit_get_nym_request(request_json: str) str [source]
Submit GET_NYM request to ledger and return response_json.
- taa_rough_timestamp() int [source]
Get a timestamp accurate to the day.
Anything more accurate is a privacy concern.
- async txn_endorse(request_json: str, endorse_did: Optional[aries_cloudagent.wallet.did_info.DIDInfo] = None) str [source]
Endorse a (signed) ledger transaction.
- async txn_submit(request_json: str, sign: Optional[bool] = None, taa_accept: Optional[bool] = None, sign_did: aries_cloudagent.wallet.did_info.DIDInfo = <object object>) str [source]
Submit a signed (and endorsed) transaction to the ledger.
- async update_endpoint_for_did(did: str, endpoint: str, endpoint_type: Optional[aries_cloudagent.ledger.endpoint_type.EndpointType] = None, write_ledger: bool = True, endorser_did: Optional[str] = None) bool [source]
Check and update the endpoint on the ledger.
- Parameters
did – The ledger DID
endpoint – The endpoint address
endpoint_type – The type of the endpoint
- class aries_cloudagent.ledger.indy.IndySdkLedgerPool(name: str, *, checked: bool = False, keepalive: int = 0, cache: Optional[aries_cloudagent.cache.base.BaseCache] = None, cache_duration: int = 600, genesis_transactions: Optional[str] = None, read_only: bool = False, socks_proxy: Optional[str] = None)[source]
Bases:
object
Indy ledger manager class.
- async context_open()[source]
Open the ledger if necessary and increase the number of active references.
- class aries_cloudagent.ledger.indy.IndySdkLedgerPoolProvider[source]
Bases:
aries_cloudagent.config.base.BaseProvider
Indy ledger pool provider which keys off the selected pool name.
- provide(settings: aries_cloudagent.config.base.BaseSettings, injector: aries_cloudagent.config.base.BaseInjector)[source]
Create and open the pool instance.
aries_cloudagent.ledger.indy_vdr module
Indy-VDR ledger implementation.
- class aries_cloudagent.ledger.indy_vdr.IndyVdrLedger(pool: aries_cloudagent.ledger.indy_vdr.IndyVdrLedgerPool, profile: aries_cloudagent.core.profile.Profile)[source]
Bases:
aries_cloudagent.ledger.base.BaseLedger
Indy-VDR ledger class.
- async accept_txn_author_agreement(taa_record: dict, mechanism: str, accept_time: Optional[int] = None)[source]
Save a new record recording the acceptance of the TAA.
- async build_and_return_get_nym_request(submitter_did: Optional[str], target_did: str) str [source]
Build GET_NYM request and return request_json.
- async 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.
- async create_and_send_credential_definition(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_id: str, signature_type: Optional[str] = None, tag: Optional[str] = None, support_revocation: bool = False, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[str, dict, bool] [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
- Returns
Tuple with cred def id, cred def structure, and whether it’s novel
- async create_and_send_schema(issuer: aries_cloudagent.indy.issuer.IndyIssuer, schema_name: str, schema_version: str, attribute_names: Sequence[str], write_ledger: bool = True, endorser_did: Optional[str] = None) 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
- async 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
- async 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
- async 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
- async 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
- async get_all_endpoints_for_did(did: str) dict [source]
Fetch all endpoints for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
- async 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
- async get_endpoint_for_did(did: str, endpoint_type: Optional[aries_cloudagent.ledger.endpoint_type.EndpointType] = None) str [source]
Fetch the endpoint for a ledger DID.
- Parameters
did – The DID to look up on the ledger or in the cache
endpoint_type – The type of the endpoint. If none given, returns all
- async 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
- async get_nym_role(did: str) aries_cloudagent.ledger.base.Role [source]
Return the role of the input public DID’s NYM on the ledger.
- Parameters
did – DID to query for role on the ledger.
- async get_revoc_reg_delta(revoc_reg_id: str, timestamp_from=0, timestamp_to=None) Tuple[dict, 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
- async get_revoc_reg_entry(revoc_reg_id: str, timestamp: int) Tuple[dict, int] [source]
Get revocation registry entry by revocation registry ID and timestamp.
- async 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
- async get_txn_author_agreement(reload: bool = False) dict [source]
Get the current transaction author agreement, fetching it if necessary.
- async get_wallet_public_did() aries_cloudagent.wallet.did_info.DIDInfo [source]
Fetch the public DID from the wallet.
- property pool_handle
Accessor for the ledger pool handle.
- async register_nym(did: str, verkey: str, alias: Optional[str] = None, role: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None) Tuple[bool, dict] [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.
- async rotate_public_did_keypair(next_seed: Optional[str] = None) None [source]
Rotate keypair for public DID: create new key, submit to ledger, update wallet.
- Parameters
next_seed – seed for incoming ed25519 keypair (default random)
- async send_revoc_reg_def(revoc_reg_def: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry definition to the ledger.
- async send_revoc_reg_entry(revoc_reg_id: str, revoc_def_type: str, revoc_reg_entry: dict, issuer_did: Optional[str] = None, write_ledger: bool = True, endorser_did: Optional[str] = None)[source]
Publish a revocation registry entry to the ledger.
- async submit_get_nym_request(request_json: str) str [source]
Submit GET_NYM request to ledger and return response_json.
- taa_rough_timestamp() int [source]
Get a timestamp accurate to the day.
Anything more accurate is a privacy concern.
- async txn_endorse(request_json: str, endorse_did: Optional[aries_cloudagent.wallet.did_info.DIDInfo] = None) str [source]
Endorse (sign) the provided transaction.
- async txn_submit(request_json: str, sign: bool, taa_accept: bool, sign_did: aries_cloudagent.wallet.did_info.DIDInfo = <object object>) str [source]
Write the provided (signed and possibly endorsed) transaction to the ledger.
- async update_endpoint_for_did(did: str, endpoint: str, endpoint_type: Optional[aries_cloudagent.ledger.endpoint_type.EndpointType] = None, write_ledger: bool = True, endorser_did: Optional[str] = None) bool [source]
Check and update the endpoint on the ledger.
- Parameters
did – The ledger DID
endpoint – The endpoint address
endpoint_type – The type of the endpoint
- class aries_cloudagent.ledger.indy_vdr.IndyVdrLedgerPool(name: str, *, keepalive: int = 0, cache: Optional[aries_cloudagent.cache.base.BaseCache] = None, cache_duration: int = 600, genesis_transactions: Optional[str] = None, read_only: bool = False, socks_proxy: Optional[str] = None)[source]
Bases:
object
Indy-VDR ledger pool manager.
- property cfg_path: pathlib.Path
Get the path to the configuration file, ensuring it’s created.
- async context_open()[source]
Open the ledger if necessary and increase the number of active references.
aries_cloudagent.ledger.routes module
aries_cloudagent.ledger.util module
Ledger utilities.
- async aries_cloudagent.ledger.util.notify_register_did_event(profile: aries_cloudagent.core.profile.Profile, did: str, meta_data: dict)[source]
Send notification for a DID post-process event.