aries_cloudagent.storage.vc_holder package

Submodules

aries_cloudagent.storage.vc_holder.askar module

aries_cloudagent.storage.vc_holder.base module

Abstract interfaces for VC holder implementations.

class aries_cloudagent.storage.vc_holder.base.IterVCRecordSearch(search: VCRecordSearch, page_size: Optional[int] = None)[source]

Bases: object

A generic record search async iterator.

class aries_cloudagent.storage.vc_holder.base.VCHolder[source]

Bases: ABC

Abstract base class for a verifiable credential holder.

abstract build_type_or_schema_query(uri_list: Sequence[str]) dict[source]

Build and return backend-specific type_or_schema_query.

Parameters

uri_list – List of schema uri from input_descriptor

abstract async delete_credential(cred: VCRecord)[source]

Remove a previously-stored VC record.

Raises

StorageNotFoundError – If the record is not found

abstract async retrieve_credential_by_given_id(given_id: str) VCRecord[source]

Fetch a VC record by its given ID (‘id’ property).

Raises

StorageNotFoundError – If the record is not found

abstract async retrieve_credential_by_id(record_id: str) VCRecord[source]

Fetch a VC record by its record ID.

Raises

StorageNotFoundError – If the record is not found

abstract search_credentials(contexts: Optional[Sequence[str]] = None, types: Optional[Sequence[str]] = None, schema_ids: Optional[Sequence[str]] = None, issuer_id: Optional[str] = None, subject_ids: Optional[Sequence[str]] = None, proof_types: Optional[Sequence[str]] = None, given_id: Optional[str] = None, tag_query: Optional[Mapping] = None) VCRecordSearch[source]

Start a new VC record search.

Parameters
  • contexts – An inclusive list of JSON-LD contexts to match

  • types – An inclusive list of JSON-LD types to match

  • schema_ids – An inclusive list of credential schema identifiers

  • issuer_id – The ID of the credential issuer

  • subject_ids – The IDs of any credential subjects all of which to match

  • proof_types – The signature suite types used for the proof objects.

  • given_id – The given id of the credential

  • tag_query – A tag filter clause

abstract async store_credential(cred: VCRecord)[source]

Add a new VC record to the store.

Parameters

cred – The VCRecord instance to store

Raises

StorageDuplicateError – If the record_id is not unique

class aries_cloudagent.storage.vc_holder.base.VCRecordSearch[source]

Bases: ABC

A VC record search in progress.

async close()[source]

Dispose of the search query.

abstract async fetch(max_count: Optional[int] = None) Sequence[VCRecord][source]

Fetch the next list of VC records from the store.

Parameters

max_count – Max number of records to return. If not provided, defaults to the backend’s preferred page size

Returns

A list of VCRecord instances

aries_cloudagent.storage.vc_holder.in_memory module

Basic in-memory storage implementation of VC holder interface.

class aries_cloudagent.storage.vc_holder.in_memory.InMemoryVCHolder(profile: InMemoryProfile)[source]

Bases: VCHolder

Basic in-memory storage class.

build_type_or_schema_query(uri_list: Sequence[str]) dict[source]

Build and return in-memory backend specific type_or_schema_query.

async delete_credential(cred: VCRecord)[source]

Remove a previously-stored VC record.

Raises

StorageNotFoundError – If the record is not found

async retrieve_credential_by_given_id(given_id: str) VCRecord[source]

Fetch a VC record by its given ID (‘id’ property).

Raises

StorageNotFoundError – If the record is not found

async retrieve_credential_by_id(record_id: str) VCRecord[source]

Fetch a VC record by its record ID.

Raises

StorageNotFoundError – If the record is not found

search_credentials(contexts: Optional[Sequence[str]] = None, types: Optional[Sequence[str]] = None, schema_ids: Optional[str] = None, issuer_id: Optional[str] = None, subject_ids: Optional[str] = None, proof_types: Optional[Sequence[str]] = None, given_id: Optional[str] = None, tag_query: Optional[Mapping] = None, pd_uri_list: Optional[Sequence[str]] = None) VCRecordSearch[source]

Start a new VC record search.

Parameters
  • contexts – An inclusive list of JSON-LD contexts to match

  • types – An inclusive list of JSON-LD types to match

  • schema_ids – An inclusive list of credential schema identifiers

  • issuer_id – The ID of the credential issuer

  • subject_ids – The IDs of credential subjects all of which to match

  • proof_types – The signature suite types used for the proof objects.

  • given_id – The given id of the credential

  • tag_query – A tag filter clause

async store_credential(cred: VCRecord)[source]

Add a new VC record to the store.

Parameters

cred – The VCRecord instance to store

Raises

StorageDuplicateError – If the record_id is not unique

class aries_cloudagent.storage.vc_holder.in_memory.InMemoryVCRecordSearch(search: InMemoryStorageSearch)[source]

Bases: VCRecordSearch

In-memory search for VC records.

async fetch(max_count: Optional[int] = None) Sequence[VCRecord][source]

Fetch the next list of VC records from the store.

Parameters

max_count – Max number of records to return. If not provided, defaults to the backend’s preferred page size

Returns

A list of VCRecord instances

aries_cloudagent.storage.vc_holder.indy module

Indy-SDK storage implementation of VC holder interface.

class aries_cloudagent.storage.vc_holder.indy.IndySdkVCHolder(wallet: IndyOpenWallet)[source]

Bases: VCHolder

Indy-SDK storage class.

build_type_or_schema_query(uri_list: Sequence[str]) dict[source]

Build and return indy-specific type_or_schema_query.

async delete_credential(cred: VCRecord)[source]

Remove a previously-stored VC record.

Raises

StorageNotFoundError – If the record is not found

async retrieve_credential_by_given_id(given_id: str) VCRecord[source]

Fetch a VC record by its given ID (‘id’ property).

Raises

StorageNotFoundError – If the record is not found

async retrieve_credential_by_id(record_id: str) VCRecord[source]

Fetch a VC record by its record ID.

Raises

StorageNotFoundError – If the record is not found

search_credentials(contexts: Optional[Sequence[str]] = None, types: Optional[Sequence[str]] = None, schema_ids: Optional[Sequence[str]] = None, issuer_id: Optional[str] = None, subject_ids: Optional[str] = None, proof_types: Optional[Sequence[str]] = None, given_id: Optional[str] = None, tag_query: Optional[Mapping] = None, pd_uri_list: Optional[Sequence[str]] = None) VCRecordSearch[source]

Start a new VC record search.

Parameters
  • contexts – An inclusive list of JSON-LD contexts to match

  • types – An inclusive list of JSON-LD types to match

  • schema_ids – An inclusive list of credential schema identifiers

  • issuer_id – The ID of the credential issuer

  • subject_ids – The IDs of credential subjects all of which to match

  • proof_types – The signature suite types used for the proof objects.

  • given_id – The given id of the credential

  • tag_query – A tag filter clause

async store_credential(cred: VCRecord)[source]

Add a new VC record to the store.

Parameters

cred – The VCRecord instance to store

Raises

StorageDuplicateError – If the record_id is not unique

class aries_cloudagent.storage.vc_holder.indy.IndySdkVCRecordSearch(search: IndySdkStorageSearch)[source]

Bases: VCRecordSearch

Indy-SDK storage search for VC records.

async close()[source]

Dispose of the search query.

async fetch(max_count: Optional[int] = None) Sequence[VCRecord][source]

Fetch the next list of VC records from the store.

Parameters

max_count – Max number of records to return. If not provided, defaults to the backend’s preferred page size

Returns

A list of VCRecord instances

aries_cloudagent.storage.vc_holder.vc_record module

Model for representing a stored verifiable credential.

class aries_cloudagent.storage.vc_holder.vc_record.VCRecord(*, contexts: Sequence[str], expanded_types: Sequence[str], issuer_id: str, subject_ids: Sequence[str], schema_ids: Sequence[str], proof_types: Sequence[str], cred_value: Mapping, given_id: Optional[str] = None, cred_tags: Optional[Mapping] = None, record_id: Optional[str] = None)[source]

Bases: BaseModel

Verifiable credential storage record class.

class Meta[source]

Bases: object

VCRecord metadata.

schema_class = 'VCRecordSchema'
serialize(as_string=False) dict[source]

Create a JSON-compatible dict representation of the model instance.

Parameters

as_string – Return a string of JSON instead of a dict

Returns

A dict representation of this model, or a JSON string if as_string is True

class aries_cloudagent.storage.vc_holder.vc_record.VCRecordSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Verifiable credential storage record schema class.

class Meta[source]

Bases: object

Verifiable credential storage record schema metadata.

model_class

alias of VCRecord

aries_cloudagent.storage.vc_holder.xform module

Transformation between StorageRecord and VCRecord.

aries_cloudagent.storage.vc_holder.xform.storage_to_vc_record(record: StorageRecord) VCRecord[source]

Convert an Indy-SDK stored record into a VC record.

aries_cloudagent.storage.vc_holder.xform.vc_to_storage_record(cred: VCRecord) StorageRecord[source]

Convert a VC record into an in-memory stored record.