aries_cloudagent.vc.ld_proofs.suites package

Submodules

aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020 module

BbsBlsSignature2020 class.

class aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020.BbsBlsSignature2020(*, key_pair: KeyPair, proof: Optional[dict] = None, verification_method: Optional[str] = None, date: Optional[datetime] = None)[source]

Bases: BbsBlsSignature2020Base

BbsBlsSignature2020 class.

async create_proof(*, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Create proof for document, return proof.

async sign(*, verify_data: List[bytes], proof: dict) dict[source]

Sign the data and add it to the proof.

Parameters
  • verify_data (List[bytes]) – The data to sign.

  • proof (dict) – The proof to add the signature to

Returns

The proof object with the added signature

Return type

dict

signature_type: ClassVar[str] = 'BbsBlsSignature2020'
async verify_proof(*, proof: dict, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) ProofResult[source]

Verify proof against document and proof purpose.

async verify_signature(*, verify_data: List[bytes], verification_method: dict, document: dict, proof: dict, document_loader: Callable[[str, dict], dict]) bool[source]

Verify the data against the proof.

Parameters
  • verify_data (bytes) – The data to check

  • verification_method (dict) – The verification method to use.

  • document (dict) – The document the verify data is derived for as extra context

  • proof (dict) – The proof to check

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

Whether the signature is valid for the data

Return type

bool

aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020_base module

BbsBlsSignature2020Base class.

class aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020_base.BbsBlsSignature2020Base(*, proof: Optional[dict] = None, supported_derive_proof_types: Optional[List[str]] = None)[source]

Bases: LinkedDataProof

Base class for BbsBlsSignature suites.

BBS_SUPPORTED = False
signature_type: ClassVar[str]

aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_proof_2020 module

BbsBlsSignatureProof2020 class.

class aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_proof_2020.BbsBlsSignatureProof2020(*, key_pair: KeyPair)[source]

Bases: BbsBlsSignature2020Base

BbsBlsSignatureProof2020 class.

async derive_proof(*, proof: dict, document: dict, reveal_document: dict, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None)[source]

Derive proof for document, return dict with derived document and proof.

signature_type: ClassVar[str] = 'BbsBlsSignatureProof2020'
supported_derive_proof_types = ['BbsBlsSignature2020', 'sec:BbsBlsSignature2020', 'https://w3id.org/security#BbsBlsSignature2020']
async verify_proof(*, proof: dict, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) ProofResult[source]

Verify proof against document and proof purpose.

aries_cloudagent.vc.ld_proofs.suites.ed25519_signature_2018 module

Ed25519Signature2018 suite.

class aries_cloudagent.vc.ld_proofs.suites.ed25519_signature_2018.Ed25519Signature2018(*, key_pair: KeyPair, proof: Optional[dict] = None, verification_method: Optional[str] = None, date: Optional[Union[datetime, str]] = None)[source]

Bases: JwsLinkedDataSignature

Ed25519Signature2018 suite.

signature_type: ClassVar[str] = 'Ed25519Signature2018'

aries_cloudagent.vc.ld_proofs.suites.ed25519_signature_2020 module

Ed25519Signature2018 suite.

class aries_cloudagent.vc.ld_proofs.suites.ed25519_signature_2020.Ed25519Signature2020(*, key_pair: KeyPair, proof: Optional[dict] = None, verification_method: Optional[str] = None, date: Optional[Union[datetime, str]] = None)[source]

Bases: LinkedDataSignature

Ed25519Signature2020 suite.

async sign(*, verify_data: bytes, proof: dict) dict[source]

Sign the data and add it to the proof.

Parameters
  • verify_data (List[bytes]) – The data to sign.

  • proof (dict) – The proof to add the signature to

Returns

The proof object with the added signature

Return type

dict

signature_type: ClassVar[str] = 'Ed25519Signature2020'
async verify_signature(*, verify_data: List[bytes], verification_method: dict, document: dict, proof: dict, document_loader: Callable[[str, dict], dict]) bool[source]

Verify the data against the proof.

Parameters
  • verify_data (bytes) – The data to check

  • verification_method (dict) – The verification method to use.

  • document (dict) – The document the verify data is derived for as extra context

  • proof (dict) – The proof to check

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

Whether the signature is valid for the data

Return type

bool

aries_cloudagent.vc.ld_proofs.suites.jws_linked_data_signature module

JWS Linked Data class.

class aries_cloudagent.vc.ld_proofs.suites.jws_linked_data_signature.JwsLinkedDataSignature(*, algorithm: str, required_key_type: str, key_pair: KeyPair, proof: Optional[dict] = None, verification_method: Optional[str] = None, date: Optional[Union[datetime, str]] = None)[source]

Bases: LinkedDataSignature

JWS Linked Data class.

async sign(*, verify_data: bytes, proof: dict) dict[source]

Sign the data and add it to the proof.

Adds a jws to the proof that can be used for multiple signature algorithms.

Parameters
  • verify_data (bytes) – The data to sign.

  • proof (dict) – The proof to add the signature to

Returns

The proof object with the added signature

Return type

dict

signature_type: ClassVar[str]
async verify_signature(*, verify_data: bytes, verification_method: dict, document: dict, proof: dict, document_loader: Callable[[str, dict], dict])[source]

Verify the data against the proof.

Checks for a jws on the proof.

Parameters
  • verify_data (bytes) – The data to check

  • verification_method (dict) – The verification method to use.

  • document (dict) – The document the verify data is derived for as extra context

  • proof (dict) – The proof to check

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

Whether the signature is valid for the data

Return type

bool

aries_cloudagent.vc.ld_proofs.suites.linked_data_proof module

Abstract base class for linked data proofs.

class aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.DeriveProofResult(*args: Any, **kwargs: Any)[source]

Bases: TypedDict

Result dict for deriving a proof.

document
proof
class aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof(*, proof: Optional[dict] = None, supported_derive_proof_types: Optional[List[str]] = None)[source]

Bases: ABC

Base Linked data proof.

async create_proof(*, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Create proof for document.

Parameters
  • document (dict) – The document to create the proof for

  • purpose (ProofPurpose) – The proof purpose to include in the proof

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

The proof object

Return type

dict

async derive_proof(*, proof: dict, document: dict, reveal_document: dict, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None) DeriveProofResult[source]

Derive proof for document, returning derived document and proof.

Parameters
  • proof (dict) – The proof to derive from

  • document (dict) – The document to derive the proof for

  • reveal_document (dict) – The JSON-LD frame the revealed attributes

  • document_loader (DocumentLoader) – Document loader used for resolving

  • nonce (bytes, optional) – Nonce to use for the proof. Defaults to None.

Returns

The derived document and proof

Return type

DeriveProofResult

match_proof(signature_type: str) bool[source]

Match signature type to signature type of this suite.

signature_type: ClassVar[str]
async verify_proof(*, proof: dict, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) ProofResult[source]

Verify proof against document and proof purpose.

Parameters
  • proof (dict) – The proof to verify

  • document (dict) – The document to verify the proof against

  • purpose (ProofPurpose) – The proof purpose to verify the proof against

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

The results of the proof verification

Return type

ValidationResult

aries_cloudagent.vc.ld_proofs.suites.linked_data_signature module

Linked Data Signature class.

class aries_cloudagent.vc.ld_proofs.suites.linked_data_signature.LinkedDataSignature(*, proof: Optional[dict] = None, verification_method: Optional[str] = None, date: Optional[datetime] = None)[source]

Bases: LinkedDataProof

Linked Data Signature class.

async create_proof(*, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Create proof for document, return proof.

abstract async sign(*, verify_data: bytes, proof: dict) dict[source]

Sign the data and add it to the proof.

Parameters
  • verify_data (bytes) – The data to sign.

  • proof (dict) – The proof to add the signature to

Returns

The proof object with the added signature

Return type

dict

signature_type: ClassVar[str]
async verify_proof(*, proof: dict, document: dict, purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) ProofResult[source]

Verify proof against document and proof purpose.

abstract async verify_signature(*, verify_data: bytes, verification_method: dict, document: dict, proof: dict, document_loader: Callable[[str, dict], dict]) bool[source]

Verify the data against the proof.

Parameters
  • verify_data (bytes) – The data to check

  • verification_method (dict) – The verification method to use.

  • document (dict) – The document the verify data is derived for as extra context

  • proof (dict) – The proof to check

  • document_loader (DocumentLoader) – Document loader used for resolving

Returns

Whether the signature is valid for the data

Return type

bool