acapy_agent.indy.credx package
Submodules
acapy_agent.indy.credx.holder module
acapy_agent.indy.credx.holder_kanon module
Indy holder implementation.
- class acapy_agent.indy.credx.holder_kanon.IndyCredxHolder(profile: Profile)[source]
Bases:
IndyHolderIndy-credx holder class.
- LINK_SECRET_ID = 'default'
- async 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
- async create_presentation(presentation_request: dict, requested_credentials: dict, schemas: dict, credential_definitions: dict, rev_states: dict | None = 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
- async 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.
This method creates the current revocation state for a received credential. It takes the credential revocation ID, revocation registry definition, revocation delta, delta timestamp, and tails file path as input parameters.
- Parameters:
cred_rev_id (str) – The credential revocation ID in the revocation registry.
rev_reg_def (dict) – The revocation registry definition.
rev_reg_delta (dict) – The revocation delta.
timestamp (int) – The delta timestamp.
tails_file_path (str) – The path to the tails file.
- Returns:
The revocation state.
- Return type:
str
- Raises:
IndyHolderError – If there is an error creating the revocation state.
- async credential_revoked(ledger: BaseLedger, credential_id: str, timestamp_from: int | None = None, timestamp_to: int | None = None) bool[source]
Check ledger for revocation status of credential by cred id.
- Parameters:
ledger (BaseLedger) – The ledger to check for revocation status.
credential_id (str) – The ID of the credential to check.
timestamp_from (int, optional) – The starting sequence number of the revocation registry delta. Defaults to None.
timestamp_to (int, optional) – The ending sequence number of the revocation registry delta. Defaults to None.
- Returns:
True if the credential is revoked, False otherwise.
- Return type:
bool
- async delete_credential(credential_id: str)[source]
Remove a credential stored in the wallet.
- Parameters:
credential_id – Credential id to remove
- async get_credential(credential_id: str) str[source]
Get a credential stored in the wallet.
- Parameters:
credential_id – Credential id to retrieve
- async get_credentials(*, offset: int, limit: int, wql: dict)[source]
Get credentials stored in the wallet.
- Parameters:
offset – Starting index
limit – Number of records to return
wql – wql query dict
- async get_credentials_for_presentation_request_by_referent(presentation_request: dict, referents: Sequence[str], *, offset: int, limit: int, extra_query: dict | None = None)[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
offset – Starting index
limit – Maximum number of records to return
extra_query – wql query dict
- async get_mime_type(credential_id: str, attr: str | None = None) 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)
- async store_credential(credential_definition: dict, credential_data: dict, credential_request_metadata: dict, credential_attr_mime_types: dict | None = None, credential_id: str | None = None, rev_reg_def: dict | None = 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
acapy_agent.indy.credx.issuer module
Indy issuer implementation.
- class acapy_agent.indy.credx.issuer.IndyCredxIssuer(profile: AskarProfile)[source]
Bases:
IndyIssuerIndy-Credx issuer class.
- async create_and_store_credential_definition(origin_did: str, schema: dict, signature_type: str | None = None, tag: str | None = None, support_revocation: bool = False) Tuple[str, str][source]
Create a new credential definition and store it in the wallet.
- Parameters:
origin_did (str) – The DID issuing the credential definition.
schema (dict) – The schema to create a credential definition for.
signature_type (str, optional) – The credential definition signature type (default ‘CL’).
tag (str, optional) – The credential definition tag.
support_revocation (bool, optional) – Whether to enable revocation for this credential definition.
- Returns:
A tuple of the credential definition ID and JSON.
- Return type:
Tuple[str, str]
- Raises:
IndyIssuerError – If there is an error creating or storing the credential definition.
- async 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
issuance_type – optionally override the issuance type
- Returns:
A tuple of the revocation registry ID, JSON, and entry JSON
- async create_credential(schema: dict, credential_offer: dict, credential_request: dict, credential_values: dict, revoc_reg_id: str | None = None, tails_file_path: str | None = None) Tuple[str, str][source]
Create a credential.
- Parameters:
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
revoc_reg_id – ID of the revocation registry
tails_file_path – The location of the tails file
- Returns:
A tuple of created credential and revocation id
- async 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 new credential offer
- async create_schema(origin_did: str, schema_name: str, schema_version: str, attribute_names: Sequence[str]) Tuple[str, str][source]
Create a new credential schema and store it in the wallet.
- 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
- async 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
- async 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
- property profile: AskarProfile
Accessor for the profile instance.
- async revoke_credentials(cred_def_id: str, revoc_reg_id: str, tails_file_path: str, cred_revoc_ids: Sequence[str]) Tuple[str, Sequence[str]][source]
Revoke a set of credentials in a revocation registry.
- Parameters:
cred_def_id – ID of the credential definition
revoc_reg_id – ID of the revocation registry
tails_file_path – path to the local tails file
cred_revoc_ids – sequences of credential indexes in the revocation registry
- Returns:
Tuple with the combined revocation delta, list of cred rev ids not revoked
acapy_agent.indy.credx.issuer_kanon module
Indy issuer implementation.
- exception acapy_agent.indy.credx.issuer_kanon.IndyIssuerRetryableError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
IndyIssuerErrorError that indicates the operation should be retried.
- class acapy_agent.indy.credx.issuer_kanon.KanonIndyCredxIssuer(profile: Profile)[source]
Bases:
IndyIssuerIndy-Credx issuer class.
- async create_and_store_credential_definition(origin_did: str, schema: dict, signature_type: str | None = None, tag: str | None = None, support_revocation: bool = False) Tuple[str, str][source]
Create a new credential definition and store it in the wallet.
- Parameters:
origin_did (str) – The DID issuing the credential definition.
schema (dict) – The schema to create a credential definition for.
signature_type (str, optional) – The credential definition signature type (default ‘CL’).
tag (str, optional) – The credential definition tag.
support_revocation (bool, optional) – Whether to enable revocation for this credential definition.
- Returns:
A tuple of the credential definition ID and JSON.
- Return type:
Tuple[str, str]
- Raises:
IndyIssuerError – If there is an error creating or storing the credential definition.
- async 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
issuance_type – optionally override the issuance type
- Returns:
A tuple of the revocation registry ID, JSON, and entry JSON
- async create_credential(schema: dict, credential_offer: dict, credential_request: dict, credential_values: dict, revoc_reg_id: str | None = None, tails_file_path: str | None = None) Tuple[str, str][source]
Create a credential.
- Parameters:
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
revoc_reg_id – ID of the revocation registry
tails_file_path – The location of the tails file
- Returns:
A tuple of created credential and revocation id
- async 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 new credential offer
- async create_schema(origin_did: str, schema_name: str, schema_version: str, attribute_names: Sequence[str]) Tuple[str, str][source]
Create a new credential schema and store it in the wallet.
- 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
- async 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
- async 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
- async revoke_credentials(cred_def_id: str, revoc_reg_id: str, tails_file_path: str, cred_revoc_ids: Sequence[str]) Tuple[str, Sequence[str]][source]
Revoke a set of credentials in a revocation registry.
- Parameters:
cred_def_id – ID of the credential definition
revoc_reg_id – ID of the revocation registry
tails_file_path – path to the local tails file
cred_revoc_ids – sequences of credential indexes in the revocation registry
- Returns:
Tuple with the combined revocation delta, list of cred rev ids not revoked