aries_cloudagent.revocation package

Submodules

aries_cloudagent.revocation.error module

Revocation error classes.

exception aries_cloudagent.revocation.error.RevocationError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Base exception for revocation-related errors.

exception aries_cloudagent.revocation.error.RevocationInvalidStateValueError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.revocation.error.RevocationError

Invalid Revocation Registry State value.

exception aries_cloudagent.revocation.error.RevocationNotSupportedError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.revocation.error.RevocationError

Attempted to perform revocation-related operation where inapplicable.

exception aries_cloudagent.revocation.error.RevocationRegistryBadSizeError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.revocation.error.RevocationError

Attempted to create registry with maximum credentials too large or too small.

aries_cloudagent.revocation.indy module

Indy revocation registry management.

class aries_cloudagent.revocation.indy.IndyRevocation(profile: aries_cloudagent.core.profile.Profile)[source]

Bases: object

Class for managing Indy credential revocation.

REV_REG_CACHE = {}
decommission_registry(cred_def_id: str)[source]

Decommission post-init registries and start the next registry generation.

get_active_issuer_rev_reg_record(cred_def_id: str) → aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord[source]

Return current active registry for issuing a given credential definition.

Parameters:cred_def_id – ID of the base credential definition
get_issuer_rev_reg_delta(rev_reg_id: str, fro: int = None, to: int = None) → dict[source]

Check ledger for revocation status for a given revocation registry.

Parameters:rev_reg_id – ID of the revocation registry
get_issuer_rev_reg_record(revoc_reg_id: str) → aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord[source]

Return a revocation registry record by identifier.

Parameters:revoc_reg_id – ID of the revocation registry
get_ledger_for_registry(revoc_reg_id: str) → aries_cloudagent.ledger.base.BaseLedger[source]

Get the ledger for the given registry.

get_ledger_registry(revoc_reg_id: str) → aries_cloudagent.revocation.models.revocation_registry.RevocationRegistry[source]

Get a revocation registry from the ledger, fetching as necessary.

get_or_create_active_registry(cred_def_id: str, max_cred_num: int = None) → Optional[Tuple[aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord, aries_cloudagent.revocation.models.revocation_registry.RevocationRegistry]][source]

Fetch the active revocation registry.

If there is no active registry then creation of a new registry will be triggered and the caller should retry after a delay.

handle_full_registry(revoc_reg_id: str)[source]

Update the registry status and start the next registry generation.

init_issuer_registry(cred_def_id: str, max_cred_num: int = None, revoc_def_type: str = None, tag: str = None, create_pending_rev_reg: bool = False, endorser_connection_id: str = None, notify: bool = True) → aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord[source]

Create a new revocation registry record for a credential definition.

list_issuer_registries() → Sequence[aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord][source]

List the issuer’s current revocation registries.

aries_cloudagent.revocation.manager module

Classes to manage credential revocation.

class aries_cloudagent.revocation.manager.RevocationManager(profile: aries_cloudagent.core.profile.Profile)[source]

Bases: object

Class for managing revocation operations.

clear_pending_revocations(purge: Mapping[str, Sequence[str]] = None) → Mapping[str, Sequence[str]][source]

Clear pending revocation publications.

Parameters:purge

Mapping from revocation registry identifiers to all credential revocation identifiers within each to clear. Specify null/empty map for all revocation registries. Specify empty sequence per revocation registry identifier for all pending within the revocation registry; e.g.,

{} - clear all pending revocations from all revocation registries

{
“R17v42T4pk…:4:R17v42T4pk…:3:CL:19:tag:CL_ACCUM:0”: [], “R17v42T4pk…:4:R17v42T4pk…:3:CL:19:tag:CL_ACCUM:1”: [“1”, “2”]
} - clear
  • all pending revocations from all revocation registry tagged 0
  • pending [“1”, “2”] from revocation registry tagged 1
  • no pending revocations from any other revocation registries.
Returns:mapping from revocation registry id to its remaining cred rev ids still marked pending, omitting revocation registries with no remaining pending publications.
publish_pending_revocations(rrid2crid: Mapping[str, Sequence[str]] = None) → Mapping[str, Sequence[str]][source]

Publish pending revocations to the ledger.

Parameters:rrid2crid

Mapping from revocation registry identifiers to all credential revocation identifiers within each to publish. Specify null/empty map for all revocation registries. Specify empty sequence per revocation registry identifier for all pending within the revocation registry; e.g.,

{} - publish all pending revocations from all revocation registries

{
“R17v42T4pk…:4:R17v42T4pk…:3:CL:19:tag:CL_ACCUM:0”: [], “R17v42T4pk…:4:R17v42T4pk…:3:CL:19:tag:CL_ACCUM:1”: [“1”, “2”]
} - publish:
  • all pending revocations from all revocation registry tagged 0
  • pending [“1”, “2”] from revocation registry tagged 1
  • no pending revocations from any other revocation registries.

Returns: mapping from each revocation registry id to its cred rev ids published.

revoke_credential(rev_reg_id: str, cred_rev_id: str, publish: bool = False, notify: bool = False, notify_version: str = None, thread_id: str = None, connection_id: str = None, comment: str = None)[source]

Revoke a credential.

Optionally, publish the corresponding revocation registry delta to the ledger.

Parameters:
  • rev_reg_id – revocation registry id
  • cred_rev_id – credential revocation id
  • publish – whether to publish the resulting revocation registry delta, along with any revocations pending against it
revoke_credential_by_cred_ex_id(cred_ex_id: str, publish: bool = False, notify: bool = False, notify_version: str = None, thread_id: str = None, connection_id: str = None, comment: str = None)[source]

Revoke a credential by its credential exchange identifier at issue.

Optionally, publish the corresponding revocation registry delta to the ledger.

Parameters:
  • cred_ex_id – credential exchange identifier
  • publish – whether to publish the resulting revocation registry delta, along with any revocations pending against it
set_cred_revoked_state(rev_reg_id: str, cred_rev_ids: Sequence[str]) → None[source]

Update credentials state to credential_revoked.

Parameters:
  • rev_reg_id – revocation registry ID
  • cred_rev_ids – list of credential revocation IDs
Returns:

None

update_rev_reg_revoked_state(apply_ledger_update: bool, rev_reg_record: aries_cloudagent.revocation.models.issuer_rev_reg_record.IssuerRevRegRecord, genesis_transactions: dict) → Tuple[dict, dict, dict][source]

Request handler to fix ledger entry of credentials revoked against registry.

Parameters:
  • rev_reg_id – revocation registry id
  • apply_ledger_update – whether to apply an update to the ledger
Returns:

Number of credentials posted to ledger

exception aries_cloudagent.revocation.manager.RevocationManagerError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Revocation manager error.

aries_cloudagent.revocation.recover module

Recover a revocation registry.

aries_cloudagent.revocation.recover.LOGGER = <Logger aries_cloudagent.revocation.recover (WARNING)>

This module calculates a new ledger accumulator, based on the revocation status on the ledger vs revocations recorded in the wallet. The calculated transaction can be written to the ledger to get the ledger back in sync with the wallet. This function can be used if there were previous revocation errors (i.e. the credential revocation was successfully written to the wallet but the ledger write failed.)

exception aries_cloudagent.revocation.recover.RevocRecoveryException[source]

Bases: Exception

Raise exception generating the recovery transaction.

aries_cloudagent.revocation.recover.fetch_txns(genesis_txns, registry_id)[source]

Fetch tails file and revocation registry information.

aries_cloudagent.revocation.recover.generate_ledger_rrrecovery_txn(genesis_txns, registry_id, set_revoked)[source]

Generate a new ledger accum entry, based on wallet vs ledger revocation state.

aries_cloudagent.revocation.routes module

Revocation registry admin routes.

class aries_cloudagent.revocation.routes.ClearPendingRevocationsRequestSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Request schema for clear pending revocations API call.

purge

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.CreateRevRegTxnForEndorserOptionSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Class for user to input whether to create a transaction for endorser or not.

create_transaction_for_endorser

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.CredRevIndyRecordsResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for revoc reg delta.

rev_reg_delta

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.CredRevRecordDetailsResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for credential revocation record request.

results

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.CredRevRecordQueryStringSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Parameters and validators for credential revocation record request.

cred_ex_id

Used by autodoc_mock_imports.

cred_rev_id

Used by autodoc_mock_imports.

rev_reg_id

Used by autodoc_mock_imports.

validate_fields(data, **kwargs)[source]

Validate schema fields - must have (rr-id and cr-id) xor cx-id.

class aries_cloudagent.revocation.routes.CredRevRecordResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for credential revocation record request.

result

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.PublishRevocationsSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Request and result schema for revocation publication API call.

rrid2crid

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegConnIdMatchInfoSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Path parameters and validators for request taking connection id.

conn_id

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegCreateRequestSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Request schema for revocation registry creation request.

credential_definition_id

Used by autodoc_mock_imports.

max_cred_num

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegId(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Parameters and validators for delete tails file request.

cred_def_id

Used by autodoc_mock_imports.

rev_reg_id

Used by autodoc_mock_imports.

validate_fields(data, **kwargs)[source]

Validate schema fields - must have either rr-id or cr-id.

class aries_cloudagent.revocation.routes.RevRegIdMatchInfoSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Path parameters and validators for request taking rev reg id.

rev_reg_id

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegIssuedResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for revocation registry credentials issued request.

result

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for revocation registry creation request.

result

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegUpdateRequestMatchInfoSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Path parameters and validators for request taking rev reg id.

apply_ledger_update

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegUpdateTailsFileUriSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Request schema for updating tails file URI.

tails_public_uri

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegWalletUpdatedResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Number of wallet revocation entries status updated.

accum_calculated

Used by autodoc_mock_imports.

accum_fixed

Used by autodoc_mock_imports.

rev_reg_delta

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegsCreatedQueryStringSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Query string parameters and validators for rev regs created request.

cred_def_id

Used by autodoc_mock_imports.

state

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevRegsCreatedSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for request for revocation registries created.

rev_reg_ids

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevocationCredDefIdMatchInfoSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Path parameters and validators for request taking cred def id.

cred_def_id

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.RevocationModuleResponseSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Response schema for Revocation Module.

class aries_cloudagent.revocation.routes.RevokeRequestSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.revocation.routes.CredRevRecordQueryStringSchema

Parameters and validators for revocation request.

comment

Used by autodoc_mock_imports.

connection_id

Used by autodoc_mock_imports.

notify

Used by autodoc_mock_imports.

notify_version

Used by autodoc_mock_imports.

publish

Used by autodoc_mock_imports.

thread_id

Used by autodoc_mock_imports.

validate_fields(data, **kwargs)[source]

Validate fields - connection_id and thread_id must be present if notify.

class aries_cloudagent.revocation.routes.SetRevRegStateQueryStringSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Query string parameters and validators for request to set rev reg state.

state

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.TailsDeleteResponseSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Return schema for tails failes deletion.

message

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.TxnOrPublishRevocationsResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for credential definition send request.

sent

Used by autodoc_mock_imports.

txn

Used by autodoc_mock_imports.

class aries_cloudagent.revocation.routes.TxnOrRevRegResultSchema(*args, **kwargs)[source]

Bases: aries_cloudagent.messaging.models.openapi.OpenAPISchema

Result schema for credential definition send request.

sent

Used by autodoc_mock_imports.

txn

Used by autodoc_mock_imports.

aries_cloudagent.revocation.routes.clear_pending_revocations(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler for clearing pending revocations.

Parameters:request – aiohttp request object
Returns:Credential revocation ids still pending revocation by revocation registry id.
aries_cloudagent.revocation.routes.create_rev_reg(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to create a new revocation registry.

Parameters:request – aiohttp request object
Returns:The issuer revocation registry record
aries_cloudagent.revocation.routes.delete_tails(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>) → <module 'json' from '/home/docs/.asdf/installs/python/3.9.17/lib/python3.9/json/__init__.py'>[source]

Delete Tails Files.

aries_cloudagent.revocation.routes.get_active_rev_reg(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get current active revocation registry by cred def id.

Parameters:request – aiohttp request object
Returns:The revocation registry identifier
aries_cloudagent.revocation.routes.get_cred_rev_record(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get credential revocation record.

Parameters:request – aiohttp request object
Returns:The issuer credential revocation record
aries_cloudagent.revocation.routes.get_rev_reg(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get a revocation registry by rev reg id.

Parameters:request – aiohttp request object
Returns:The revocation registry
aries_cloudagent.revocation.routes.get_rev_reg_indy_recs(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get details of revoked credentials from ledger.

Parameters:request – aiohttp request object
Returns:Detailes of revoked credentials from ledger
aries_cloudagent.revocation.routes.get_rev_reg_issued(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get credentials issued against revocation registry.

Parameters:request – aiohttp request object
Returns:Number of credentials issued against revocation registry
aries_cloudagent.revocation.routes.get_rev_reg_issued_count(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get number of credentials issued against revocation registry.

Parameters:request – aiohttp request object
Returns:Number of credentials issued against revocation registry
aries_cloudagent.revocation.routes.get_tails_file(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>) → <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>[source]

Request handler to download tails file for revocation registry.

Parameters:request – aiohttp request object
Returns:The tails file in FileResponse
aries_cloudagent.revocation.routes.on_revocation_entry_event(profile: aries_cloudagent.core.profile.Profile, event: aries_cloudagent.core.event_bus.Event)[source]

Handle revocation entry event.

aries_cloudagent.revocation.routes.on_revocation_registry_endorsed_event(profile: aries_cloudagent.core.profile.Profile, event: aries_cloudagent.core.event_bus.Event)[source]

Handle revocation registry endorsement event.

aries_cloudagent.revocation.routes.on_revocation_registry_init_event(profile: aries_cloudagent.core.profile.Profile, event: aries_cloudagent.core.event_bus.Event)[source]

Handle revocation registry initiation event.

aries_cloudagent.revocation.routes.post_process_routes(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Amend swagger API.

aries_cloudagent.revocation.routes.publish_revocations(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler for publishing pending revocations to the ledger.

Parameters:request – aiohttp request object
Returns:Credential revocation ids published as revoked by revocation registry id.
aries_cloudagent.revocation.routes.register(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Register routes.

aries_cloudagent.revocation.routes.register_events(event_bus: aries_cloudagent.core.event_bus.EventBus)[source]

Subscribe to any events we need to support.

aries_cloudagent.revocation.routes.rev_regs_created(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to get revocation registries that current agent created.

Parameters:request – aiohttp request object
Returns:List of identifiers of matching revocation registries.
aries_cloudagent.revocation.routes.revoke(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler for storing a credential revocation.

Parameters:request – aiohttp request object
Returns:The credential revocation details.
aries_cloudagent.revocation.routes.rotate_rev_reg(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to rotate the active revocation registries for cred. def.

Parameters:request – aiohttp request object
Returns:list or revocation registry ids that were rotated out
aries_cloudagent.revocation.routes.send_rev_reg_def(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to send revocation registry definition by rev reg id to ledger.

Parameters:request – aiohttp request object
Returns:The issuer revocation registry record
aries_cloudagent.revocation.routes.send_rev_reg_entry(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to send rev reg entry by registry id to ledger.

Parameters:request – aiohttp request object
Returns:The revocation registry record
aries_cloudagent.revocation.routes.set_rev_reg_state(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to set a revocation registry state manually.

Parameters:request – aiohttp request object
Returns:The revocation registry record, updated
aries_cloudagent.revocation.routes.update_rev_reg(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to update a rev reg’s public tails URI by registry id.

Parameters:request – aiohttp request object
Returns:The revocation registry record
aries_cloudagent.revocation.routes.update_rev_reg_revoked_state(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to fix ledger entry of credentials revoked against registry.

Parameters:request – aiohttp request object
Returns:Number of credentials posted to ledger
aries_cloudagent.revocation.routes.upload_tails_file(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc0446d0af0>)[source]

Request handler to upload local tails file for revocation registry.

Parameters:request – aiohttp request object

aries_cloudagent.revocation.util module

Revocation utilities.

aries_cloudagent.revocation.util.notify_pending_cleared_event(profile: aries_cloudagent.core.profile.Profile, rev_reg_id: str)[source]

Send notification of credential revoked as issuer.

aries_cloudagent.revocation.util.notify_revocation_entry_endorsed_event(profile: aries_cloudagent.core.profile.Profile, rev_reg_id: str, meta_data: dict)[source]

Send notification for a revocation registry entry endorsement event.

aries_cloudagent.revocation.util.notify_revocation_entry_event(profile: aries_cloudagent.core.profile.Profile, issuer_rev_id: str, meta_data: dict)[source]

Send notification for a revocation registry entry event.

aries_cloudagent.revocation.util.notify_revocation_published_event(profile: aries_cloudagent.core.profile.Profile, rev_reg_id: str, crids: Sequence[str])[source]

Send notification of credential revoked as issuer.

aries_cloudagent.revocation.util.notify_revocation_reg_endorsed_event(profile: aries_cloudagent.core.profile.Profile, rev_reg_id: str, meta_data: dict)[source]

Send notification for a revocation registry endorsement event.

aries_cloudagent.revocation.util.notify_revocation_reg_init_event(profile: aries_cloudagent.core.profile.Profile, issuer_rev_id: str, create_pending_rev_reg: bool = False, endorser_connection_id: str = None)[source]

Send notification for a revocation registry init event.