aries_cloudagent.vc.ld_proofs package

class aries_cloudagent.vc.ld_proofs.AssertionProofPurpose(*, date: Optional[datetime.datetime] = None, max_timestamp_delta: Optional[datetime.timedelta] = None)[source]

Bases: aries_cloudagent.vc.ld_proofs.purposes.controller_proof_purpose.ControllerProofPurpose

Assertion proof purpose class.

term = 'assertionMethod'
class aries_cloudagent.vc.ld_proofs.AuthenticationProofPurpose(*, challenge: str, domain: Optional[str] = None, date: Optional[datetime.datetime] = None, max_timestamp_delta: Optional[datetime.timedelta] = None)[source]

Bases: aries_cloudagent.vc.ld_proofs.purposes.controller_proof_purpose.ControllerProofPurpose

Authentication proof purpose.

term = 'authentication'
update(proof: dict) dict[source]

Update poof purpose, challenge and domain on proof.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult[source]

Validate whether challenge and domain are valid.

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

Bases: aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020_base.BbsBlsSignature2020Base

BbsBlsSignature2020 class.

async create_proof(*, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_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 = 'BbsBlsSignature2020'
async verify_proof(*, proof: dict, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.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

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

Bases: aries_cloudagent.vc.ld_proofs.suites.bbs_bls_signature_2020_base.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 = 'BbsBlsSignatureProof2020'
supported_derive_proof_types = ['BbsBlsSignature2020', 'sec:BbsBlsSignature2020', 'https://w3id.org/security#BbsBlsSignature2020']
async verify_proof(*, proof: dict, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.ProofResult[source]

Verify proof against document and proof purpose.

class aries_cloudagent.vc.ld_proofs.ControllerProofPurpose(*, term: str, date: Optional[datetime.datetime] = None, max_timestamp_delta: Optional[datetime.timedelta] = None)[source]

Bases: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose

Controller proof purpose class.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult[source]

Validate whether verification method of proof is authorized by controller.

class aries_cloudagent.vc.ld_proofs.CredentialIssuancePurpose(*, date: Optional[datetime.datetime] = None, max_timestamp_delta: Optional[datetime.timedelta] = None)[source]

Bases: aries_cloudagent.vc.ld_proofs.purposes.assertion_proof_purpose.AssertionProofPurpose

Credential Issuance proof purpose.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult[source]

Validate if the issuer matches the controller of the verification method.

class aries_cloudagent.vc.ld_proofs.DocumentLoader(profile: aries_cloudagent.core.profile.Profile, cache_ttl: int = 300)[source]

Bases: object

JSON-LD document loader.

async load_document(url: str, options: dict)[source]

Load JSON-LD document.

Method signature conforms to PyLD document loader interface

Document loading is processed in separate thread to deal with async to sync transformation.

class aries_cloudagent.vc.ld_proofs.DocumentVerificationResult(*, verified: bool, document: Optional[dict] = None, results: Optional[List[aries_cloudagent.vc.ld_proofs.validation_result.ProofResult]] = None, errors: Optional[List[Exception]] = None)[source]

Bases: object

Domain verification result class.

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

Bases: aries_cloudagent.vc.ld_proofs.suites.jws_linked_data_signature.JwsLinkedDataSignature

Ed25519Signature2018 suite.

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

Bases: aries_cloudagent.vc.ld_proofs.suites.linked_data_signature.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

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

class aries_cloudagent.vc.ld_proofs.KeyPair[source]

Bases: abc.ABC

Base key pair class.

abstract from_verification_method(verification_method: dict) aries_cloudagent.vc.ld_proofs.crypto.key_pair.KeyPair[source]

Create new key pair class based on the passed verification method.

abstract property has_public_key: bool

Whether key pair has a public key.

Public key is required for verification, but can be set dynamically in the verification process.

abstract property public_key: Optional[bytes]

Getter for the public key bytes.

Returns

The public key

Return type

bytes

abstract async sign(message: Union[List[bytes], bytes]) bytes[source]

Sign message(s) using key pair.

abstract async verify(message: Union[List[bytes], bytes], signature: bytes) bool[source]

Verify message(s) against signature using key pair.

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

Bases: abc.ABC

Base Linked data proof.

async create_proof(*, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_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) aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.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.

async verify_proof(*, proof: dict, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.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

exception aries_cloudagent.vc.ld_proofs.LinkedDataProofException[source]

Bases: Exception

Base exception for linked data proof module.

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

Bases: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof

Linked Data Signature class.

async create_proof(*, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_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

async verify_proof(*, proof: dict, document: dict, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.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

class aries_cloudagent.vc.ld_proofs.ProofPurpose(*, term: str, date: Optional[datetime.datetime] = None, max_timestamp_delta: Optional[datetime.timedelta] = None)[source]

Bases: object

Base proof purpose class.

match(proof: dict) bool[source]

Check whether the passed proof matches with the term of this proof purpose.

update(proof: dict) dict[source]

Update proof purpose on proof.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult[source]

Validate whether created date of proof is out of max_timestamp_delta range.

class aries_cloudagent.vc.ld_proofs.ProofResult(*, verified: bool, proof: Optional[dict] = None, error: Optional[Exception] = None, purpose_result: Optional[aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult] = None)[source]

Bases: object

Proof result class.

class aries_cloudagent.vc.ld_proofs.ProofSet[source]

Bases: object

Class for managing proof sets on a JSON-LD document.

async static add(*, document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Add a Linked Data proof to the document.

If the document contains other proofs, the proof will be appended to the existing set of proofs.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context.

Parameters
  • document (dict) – JSON-LD document to be signed.

  • suite (LinkedDataProof) – A signature suite instance that will create the proof

  • purpose (ProofPurpose) – A proof purpose instance that will augment the proof with information describing its intended purpose.

  • document_loader (DocumentLoader) – Document loader to use.

Returns

The signed document, with the signature in the top-level

proof property.

Return type

dict

async static derive(*, document: dict, reveal_document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None) dict[source]

Create new derived Linked Data proof(s) on document using the reveal document.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context. (v3 because BBS?)

Parameters
  • document (dict) – JSON-LD document with one or more proofs to be derived.

  • reveal_document (dict) – JSON-LD frame specifying the attributes to reveal.

  • suite (LinkedDataProof) – A signature suite instance to derive the proof.

  • document_loader (DocumentLoader) – Document loader to use.

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

Returns

The derived document with the derived proof(s) in the top-level

proof property.

Return type

dict

async static verify(*, document: dict, suites: List[aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof], purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResult[source]

Verify Linked Data proof(s) on a document.

The proofs to be verified must match the given proof purse.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context.

Parameters
  • document (dict) – JSON-LD document with one or more proofs to be verified.

  • suites (List[LinkedDataProof]) – Acceptable signature suite instances for verifying the proof(s).

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – Document loader to use.

Returns

Object with a verified property that is true

if at least one proof matching the given purpose and suite verifies and false otherwise. Also contains errors and results properties with extra data.

Return type

DocumentVerificationResult

class aries_cloudagent.vc.ld_proofs.PurposeResult(*, valid: bool, error: Optional[Exception] = None, controller: Optional[dict] = None)[source]

Bases: object

Proof purpose result class.

class aries_cloudagent.vc.ld_proofs.WalletKeyPair(*, wallet: aries_cloudagent.wallet.base.BaseWallet, key_type: aries_cloudagent.wallet.key_type.KeyType, public_key_base58: Optional[str] = None)[source]

Bases: aries_cloudagent.vc.ld_proofs.crypto.key_pair.KeyPair

Base wallet key pair.

from_verification_method(verification_method: dict) aries_cloudagent.vc.ld_proofs.crypto.wallet_key_pair.WalletKeyPair[source]

Create new WalletKeyPair from public key in verification method.

property has_public_key: bool

Whether key pair has public key.

property public_key: Optional[bytes]

Getter for public key.

async sign(message: Union[List[bytes], bytes]) bytes[source]

Sign message using wallet.

async verify(message: Union[List[bytes], bytes], signature: bytes) bool[source]

Verify message against signature using wallet.

async aries_cloudagent.vc.ld_proofs.derive(*, document: dict, reveal_document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None) dict[source]

Derive proof(s) for document with reveal document.

All proofs matching the signature suite type will be replaced with a derived proof. Other proofs will be discarded.

Parameters
  • document (dict) – The document with one or more proofs to be derived

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

  • suite (LinkedDataProof) – The linked data signature cryptographic suite with which to derive the proof

  • document_loader (DocumentLoader) – The document loader to use.

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

Returns

The document with derived proof(s).

Return type

dict

aries_cloudagent.vc.ld_proofs.get_properties_without_context(document: dict, document_loader: Callable[[str, dict], dict]) Sequence[str][source]

Get the properties from document that don’t have an context definition.

async aries_cloudagent.vc.ld_proofs.sign(*, document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Cryptographically signs the provided document by adding a proof section.

Proof is added based on the provided suite and proof purpose

Parameters
  • document (dict) – JSON-LD document to be signed.

  • suite (LinkedDataProof) – The linked data signature cryptographic suite with which to sign the document

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – The document loader to use.

Raises

LinkedDataProofException – When a jsonld url cannot be resolved, OR signing fails.

Returns

Signed document.

Return type

dict

async aries_cloudagent.vc.ld_proofs.verify(*, document: dict, suites: List[aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof], purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResult[source]

Verify the linked data signature on the provided document.

Parameters
  • document (dict) – The document with one or more proofs to be verified.

  • suites (List[LinkedDataProof]) – Acceptable signature suite instances for verifying the proof(s).

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – The document loader to use.

Returns

Object with a verified boolean property that is

True if at least one proof matching the given purpose and suite verifies and False otherwise. a results property with an array of detailed results. if False an errors property will be present, with a list containing all of the errors that occurred during the verification process.

Return type

DocumentVerificationResult

Subpackages

Submodules

aries_cloudagent.vc.ld_proofs.check module

Validator methods to check for properties without a context.

aries_cloudagent.vc.ld_proofs.check.diff_dict_keys(full: dict, with_missing: dict, prefix: Optional[str] = None, *, document_loader: Callable[[str, dict], dict], context) Sequence[str][source]

Get the difference in dict keys between full and with_missing.

Checks recursively

Parameters
  • full (dict) – The full dict with all keys present

  • with_missing (dict) – The dict with possibly keys missing

  • prefix (str, optional) – The prefix. Mostly used for internal recursion.

Returns

List of missing property names in with_missing

Return type

Sequence[str]

aries_cloudagent.vc.ld_proofs.check.get_properties_without_context(document: dict, document_loader: Callable[[str, dict], dict]) Sequence[str][source]

Get the properties from document that don’t have an context definition.

aries_cloudagent.vc.ld_proofs.constants module

JSON-LD, Linked Data Proof and Verifiable Credential constants.

aries_cloudagent.vc.ld_proofs.document_loader module

JSON-LD document loader methods.

class aries_cloudagent.vc.ld_proofs.document_loader.DocumentLoader(profile: aries_cloudagent.core.profile.Profile, cache_ttl: int = 300)[source]

Bases: object

JSON-LD document loader.

async load_document(url: str, options: dict)[source]

Load JSON-LD document.

Method signature conforms to PyLD document loader interface

Document loading is processed in separate thread to deal with async to sync transformation.

aries_cloudagent.vc.ld_proofs.error module

Linked data proof exception classes.

exception aries_cloudagent.vc.ld_proofs.error.LinkedDataProofException[source]

Bases: Exception

Base exception for linked data proof module.

aries_cloudagent.vc.ld_proofs.ld_proofs module

Linked data proof signing and verification methods.

async aries_cloudagent.vc.ld_proofs.ld_proofs.derive(*, document: dict, reveal_document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None) dict[source]

Derive proof(s) for document with reveal document.

All proofs matching the signature suite type will be replaced with a derived proof. Other proofs will be discarded.

Parameters
  • document (dict) – The document with one or more proofs to be derived

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

  • suite (LinkedDataProof) – The linked data signature cryptographic suite with which to derive the proof

  • document_loader (DocumentLoader) – The document loader to use.

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

Returns

The document with derived proof(s).

Return type

dict

async aries_cloudagent.vc.ld_proofs.ld_proofs.sign(*, document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Cryptographically signs the provided document by adding a proof section.

Proof is added based on the provided suite and proof purpose

Parameters
  • document (dict) – JSON-LD document to be signed.

  • suite (LinkedDataProof) – The linked data signature cryptographic suite with which to sign the document

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – The document loader to use.

Raises

LinkedDataProofException – When a jsonld url cannot be resolved, OR signing fails.

Returns

Signed document.

Return type

dict

async aries_cloudagent.vc.ld_proofs.ld_proofs.verify(*, document: dict, suites: List[aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof], purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResult[source]

Verify the linked data signature on the provided document.

Parameters
  • document (dict) – The document with one or more proofs to be verified.

  • suites (List[LinkedDataProof]) – Acceptable signature suite instances for verifying the proof(s).

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – The document loader to use.

Returns

Object with a verified boolean property that is

True if at least one proof matching the given purpose and suite verifies and False otherwise. a results property with an array of detailed results. if False an errors property will be present, with a list containing all of the errors that occurred during the verification process.

Return type

DocumentVerificationResult

aries_cloudagent.vc.ld_proofs.proof_set module

Class to represent a Linked Data proof set.

class aries_cloudagent.vc.ld_proofs.proof_set.ProofSet[source]

Bases: object

Class for managing proof sets on a JSON-LD document.

async static add(*, document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) dict[source]

Add a Linked Data proof to the document.

If the document contains other proofs, the proof will be appended to the existing set of proofs.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context.

Parameters
  • document (dict) – JSON-LD document to be signed.

  • suite (LinkedDataProof) – A signature suite instance that will create the proof

  • purpose (ProofPurpose) – A proof purpose instance that will augment the proof with information describing its intended purpose.

  • document_loader (DocumentLoader) – Document loader to use.

Returns

The signed document, with the signature in the top-level

proof property.

Return type

dict

async static derive(*, document: dict, reveal_document: dict, suite: aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof, document_loader: Callable[[str, dict], dict], nonce: Optional[bytes] = None) dict[source]

Create new derived Linked Data proof(s) on document using the reveal document.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context. (v3 because BBS?)

Parameters
  • document (dict) – JSON-LD document with one or more proofs to be derived.

  • reveal_document (dict) – JSON-LD frame specifying the attributes to reveal.

  • suite (LinkedDataProof) – A signature suite instance to derive the proof.

  • document_loader (DocumentLoader) – Document loader to use.

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

Returns

The derived document with the derived proof(s) in the top-level

proof property.

Return type

dict

async static verify(*, document: dict, suites: List[aries_cloudagent.vc.ld_proofs.suites.linked_data_proof.LinkedDataProof], purpose: aries_cloudagent.vc.ld_proofs.purposes.proof_purpose.ProofPurpose, document_loader: Callable[[str, dict], dict]) aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResult[source]

Verify Linked Data proof(s) on a document.

The proofs to be verified must match the given proof purse.

Important note: This method assumes that the term proof in the given document has the same definition as the https://w3id.org/security/v2 JSON-LD @context.

Parameters
  • document (dict) – JSON-LD document with one or more proofs to be verified.

  • suites (List[LinkedDataProof]) – Acceptable signature suite instances for verifying the proof(s).

  • purpose (ProofPurpose) – A proof purpose instance that will match proofs to be verified and ensure they were created according to the appropriate purpose.

  • document_loader (DocumentLoader) – Document loader to use.

Returns

Object with a verified property that is true

if at least one proof matching the given purpose and suite verifies and false otherwise. Also contains errors and results properties with extra data.

Return type

DocumentVerificationResult

aries_cloudagent.vc.ld_proofs.validation_result module

Proof verification and validation result classes.

class aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResult(*, verified: bool, document: Optional[dict] = None, results: Optional[List[aries_cloudagent.vc.ld_proofs.validation_result.ProofResult]] = None, errors: Optional[List[Exception]] = None)[source]

Bases: object

Domain verification result class.

class aries_cloudagent.vc.ld_proofs.validation_result.ProofResult(*, verified: bool, proof: Optional[dict] = None, error: Optional[Exception] = None, purpose_result: Optional[aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult] = None)[source]

Bases: object

Proof result class.

class aries_cloudagent.vc.ld_proofs.validation_result.PurposeResult(*, valid: bool, error: Optional[Exception] = None, controller: Optional[dict] = None)[source]

Bases: object

Proof purpose result class.