aries_cloudagent.indy.sdk package

Submodules

aries_cloudagent.indy.sdk.error module

Indy error handling.

class aries_cloudagent.indy.sdk.error.IndyErrorHandler(message: str = None, error_cls: Type[aries_cloudagent.core.error.BaseError] = <class 'aries_cloudagent.core.error.BaseError'>)[source]

Bases: object

Trap IndyError and raise an appropriate LedgerError instead.

classmethod wrap_error(err_value: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb054d58d90>, message: str = None, error_cls: Type[aries_cloudagent.core.error.BaseError] = <class 'aries_cloudagent.core.error.BaseError'>) → aries_cloudagent.core.error.BaseError[source]

Create an instance of BaseError from an IndyError.

aries_cloudagent.indy.sdk.holder module

Indy SDK holder implementation.

class aries_cloudagent.indy.sdk.holder.IndySdkHolder(wallet: aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet)[source]

Bases: aries_cloudagent.indy.holder.IndyHolder

Indy-SDK holder implementation.

create_credential_request(credential_offer: dict, credential_definition: dict, holder_did: str) → Tuple[str, str][source]

Create a credential request for the given credential offer.

Parameters:
  • credential_offer – The credential offer to create request for
  • credential_definition – The credential definition to create an offer for
  • holder_did – the DID of the agent making the request
Returns:

A tuple of the credential request and credential request metadata

create_presentation(presentation_request: dict, requested_credentials: dict, schemas: dict, credential_definitions: dict, rev_states: dict = None) → str[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 credential definitions JSON
  • rev_states – Indy format revocation states JSON
create_revocation_state(cred_rev_id: str, rev_reg_def: dict, rev_reg_delta: dict, timestamp: int, tails_file_path: str) → str[source]

Create current revocation state for a received credential.

Parameters:
  • cred_rev_id – credential revocation id in revocation registry
  • rev_reg_def – revocation registry definition
  • rev_reg_delta – revocation delta
  • timestamp – delta timestamp
Returns:

the revocation state

credential_revoked(ledger: aries_cloudagent.ledger.base.BaseLedger, credential_id: str, fro: int = None, to: int = None) → bool[source]

Check ledger for revocation status of credential by cred id.

Parameters:credential_id – Credential id to check
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) → 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: dict, credential_data: dict, credential_request_metadata: dict, credential_attr_mime_types=None, credential_id: str = None, rev_reg_def: dict = None) → str[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
  • credential_id – optionally override the stored credential id
  • rev_reg_def – revocation registry definition in json
Returns:

the ID of the stored credential

aries_cloudagent.indy.sdk.issuer module

Indy SDK issuer implementation.

class aries_cloudagent.indy.sdk.issuer.IndySdkIssuer(profile: aries_cloudagent.indy.sdk.profile.IndySdkProfile)[source]

Bases: aries_cloudagent.indy.issuer.IndyIssuer

Indy-SDK issuer implementation.

create_and_store_credential_definition(origin_did: str, schema: dict, signature_type: str = None, tag: str = None, support_revocation: bool = False) → Tuple[str, str][source]

Create a new credential definition and store it in the wallet.

Parameters:
  • origin_did – the DID issuing the credential definition
  • schema – the schema used as a basis
  • signature_type – the credential definition signature type (default ‘CL’)
  • tag – the credential definition tag
  • support_revocation – whether to enable revocation for this credential def
Returns:

A tuple of the credential definition ID and JSON

create_and_store_revocation_registry(origin_did: str, cred_def_id: str, revoc_def_type: str, tag: str, max_cred_num: int, tails_base_path: str) → Tuple[str, str, str][source]

Create a new revocation registry and store it in the wallet.

Parameters:
  • origin_did – the DID issuing the revocation registry
  • cred_def_id – the identifier of the related credential definition
  • revoc_def_type – the revocation registry type (default CL_ACCUM)
  • tag – the unique revocation registry tag
  • max_cred_num – the number of credentials supported in the registry
  • tails_base_path – where to store the tails file
Returns:

A tuple of the revocation registry ID, JSON, and entry JSON

create_credential(schema: dict, credential_offer: dict, credential_request: dict, credential_values: dict, cred_ex_id: str, rev_reg_id: str = None, tails_file_path: str = None) → Tuple[str, str][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 cred_ex_id: credential exchange identifier to use in issuer cred rev rec rev_reg_id: ID of the revocation registry tails_file_path: Path to the local tails file
Returns:A tuple of created credential and revocation id
create_credential_offer(credential_definition_id: str) → str[source]

Create a credential offer for the given credential definition id.

Parameters:credential_definition_id – The credential definition to create an offer for
Returns:The created credential offer
create_schema(origin_did: str, schema_name: str, schema_version: str, attribute_names: Sequence[str]) → Tuple[str, str][source]

Create a new credential schema.

Parameters:
  • origin_did – the DID issuing the credential definition
  • schema_name – the schema name
  • schema_version – the schema version
  • attribute_names – a sequence of schema attribute names
Returns:

A tuple of the schema ID and JSON

credential_definition_in_wallet(credential_definition_id: str) → bool[source]

Check whether a given credential definition ID is present in the wallet.

Parameters:credential_definition_id – The credential definition ID to check
merge_revocation_registry_deltas(fro_delta: str, to_delta: str) → str[source]

Merge revocation registry deltas.

Parameters:
  • fro_delta – original delta in JSON format
  • to_delta – incoming delta in JSON format
Returns:

Merged delta in JSON format

revoke_credentials(rev_reg_id: str, tails_file_path: str, cred_rev_ids: Sequence[str]) -> (<class 'str'>, typing.Sequence[str])[source]

Revoke a set of credentials in a revocation registry.

Parameters:
  • rev_reg_id – ID of the revocation registry
  • tails_file_path – path to the local tails file
  • cred_rev_ids – sequences of credential indexes in the revocation registry
Returns:

Tuple with the combined revocation delta, list of cred rev ids not revoked

aries_cloudagent.indy.sdk.profile module

Manage Indy-SDK profile interaction.

class aries_cloudagent.indy.sdk.profile.IndySdkProfile(opened: aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet, context: aries_cloudagent.config.injection_context.InjectionContext = None)[source]

Bases: aries_cloudagent.core.profile.Profile

Provide access to Indy profile interaction methods.

BACKEND_NAME = 'indy'
bind_providers()[source]

Initialize the profile-level instance providers.

close()[source]

Close the profile instance.

init_ledger_pool()[source]

Initialize the ledger pool.

name

Accessor for the profile name.

remove()[source]

Remove the profile associated with this instance.

session(context: aries_cloudagent.config.injection_context.InjectionContext = None) → aries_cloudagent.core.profile.ProfileSession[source]

Start a new interactive session with no transaction support requested.

transaction(context: aries_cloudagent.config.injection_context.InjectionContext = None) → aries_cloudagent.core.profile.ProfileSession[source]

Start a new interactive session with commit and rollback support.

If the current backend does not support transactions, then commit and rollback operations of the session will not have any effect.

wallet

Accessor for the opened wallet instance.

class aries_cloudagent.indy.sdk.profile.IndySdkProfileManager[source]

Bases: aries_cloudagent.core.profile.ProfileManager

Manager for Indy-SDK wallets.

open(context: aries_cloudagent.config.injection_context.InjectionContext, config: Mapping[str, Any] = None) → aries_cloudagent.core.profile.Profile[source]

Open an instance of an existing profile.

provision(context: aries_cloudagent.config.injection_context.InjectionContext, config: Mapping[str, Any] = None) → aries_cloudagent.core.profile.Profile[source]

Provision a new instance of a profile.

class aries_cloudagent.indy.sdk.profile.IndySdkProfileSession(profile: aries_cloudagent.core.profile.Profile, *, context: aries_cloudagent.config.injection_context.InjectionContext = None, settings: Mapping[str, Any] = None)[source]

Bases: aries_cloudagent.core.profile.ProfileSession

An active connection to the profile management backend.

aries_cloudagent.indy.sdk.util module

Indy utilities.

aries_cloudagent.indy.sdk.util.create_tails_reader(tails_file_path: str) → int[source]

Get a handle for the blob_storage file reader.

aries_cloudagent.indy.sdk.util.create_tails_writer(tails_base_dir: str) → int[source]

Get a handle for the blob_storage file writer.

aries_cloudagent.indy.sdk.verifier module

Indy SDK verifier implementation.

class aries_cloudagent.indy.sdk.verifier.IndySdkVerifier(ledger: aries_cloudagent.ledger.indy.IndySdkLedger)[source]

Bases: aries_cloudagent.indy.verifier.IndyVerifier

Indy-SDK verifier implementation.

verify_presentation(pres_req, pres, schemas, credential_definitions, rev_reg_defs, rev_reg_entries) → bool[source]

Verify a presentation.

Parameters:
  • pres_req – Presentation request data
  • pres – Presentation data
  • schemas – Schema data
  • credential_definitions – credential definition data
  • rev_reg_defs – revocation registry definitions
  • rev_reg_entries – revocation registry entries

aries_cloudagent.indy.sdk.wallet_plugin module

Utility for loading Postgres wallet plug-in.

aries_cloudagent.indy.sdk.wallet_plugin.file_ext()[source]

Determine file extension based on platform.

aries_cloudagent.indy.sdk.wallet_plugin.load_postgres_plugin(storage_config, storage_creds, raise_exc=False)[source]

Load postgres dll and configure postgres wallet.

aries_cloudagent.indy.sdk.wallet_setup module

Indy-SDK wallet setup and configuration.

class aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet(config: aries_cloudagent.indy.sdk.wallet_setup.IndyWalletConfig, created, handle, master_secret_id: str)[source]

Bases: object

Handle and metadata for an opened Indy wallet.

close()[source]

Close previously-opened wallet, removing it if so configured.

name

Accessor for the opened wallet name.

class aries_cloudagent.indy.sdk.wallet_setup.IndyWalletConfig(config: Mapping[str, Any] = None)[source]

Bases: object

A helper class for handling Indy-SDK wallet configuration.

DEFAULT_FRESHNESS = False
DEFAULT_KEY = ''
DEFAULT_KEY_DERIVATION = 'ARGON2I_MOD'
DEFAULT_STORAGE_TYPE = None
KEY_DERIVATION_ARGON2I_INT = 'ARGON2I_INT'
KEY_DERIVATION_ARGON2I_MOD = 'ARGON2I_MOD'
KEY_DERIVATION_RAW = 'RAW'
create_wallet() → aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet[source]

Create a new wallet.

Raises:
  • ProfileDuplicateError – If there was an existing wallet with the same name
  • ProfileError – If there was a problem removing the wallet
  • ProfileError – If there was another libindy error
open_wallet(created: bool = False) → aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet[source]

Open wallet, removing and/or creating it if so configured.

Raises:
  • ProfileError – If wallet not found after creation
  • ProfileNotFoundError – If the wallet is not found
  • ProfileError – If the wallet is already open
  • ProfileError – If there is another libindy error
remove_wallet()[source]

Remove an existing wallet.

Raises:
  • ProfileNotFoundError – If the wallet could not be found
  • ProfileError – If there was another libindy error
wallet_access

Accessor the Indy wallet access info.

wallet_config

Accessor for the Indy wallet config.