aries_cloudagent.holder package

Submodules

aries_cloudagent.holder.base module

Base holder class.

class aries_cloudagent.holder.base.BaseHolder[source]

Bases: abc.ABC

Base class for holder.

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

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_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)[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

exception aries_cloudagent.holder.base.HolderError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Base class for holder exceptions.

aries_cloudagent.holder.indy module

Indy holder 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: 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

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