aries_cloudagent.vc.ld_proofs package

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

Bases: ControllerProofPurpose

Assertion proof purpose class.

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

Bases: 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]) PurposeResult[source]

Validate whether challenge and domain are valid.

class aries_cloudagent.vc.ld_proofs.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

class aries_cloudagent.vc.ld_proofs.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.

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

Bases: ProofPurpose

Controller proof purpose class.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) PurposeResult[source]

Validate whether verification method of proof is authorized by controller.

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

Bases: AssertionProofPurpose

Credential Issuance proof purpose.

validate(*, proof: dict, document: dict, suite: LinkedDataProof, verification_method: dict, document_loader: Callable[[str, dict], dict]) PurposeResult[source]

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

class aries_cloudagent.vc.ld_proofs.DocumentLoader(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[ProofResult]] = None, errors: Optional[List[str]] = None)[source]

Bases: BaseModel

Domain verification result class.

class Meta[source]

Bases: object

DocumentVerificationResult metadata.

schema_class = 'DocumentVerificationResultSchema'
class aries_cloudagent.vc.ld_proofs.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'
class aries_cloudagent.vc.ld_proofs.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

class aries_cloudagent.vc.ld_proofs.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

class aries_cloudagent.vc.ld_proofs.KeyPair[source]

Bases: ABC

Base key pair class.

abstract from_verification_method(verification_method: dict) 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(*, 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

exception aries_cloudagent.vc.ld_proofs.LinkedDataProofException[source]

Bases: Exception

Base exception for linked data proof module.

class aries_cloudagent.vc.ld_proofs.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

class aries_cloudagent.vc.ld_proofs.ProofPurpose(*, term: str, date: Optional[datetime] = None, max_timestamp_delta: Optional[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]) 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[str] = None, purpose_result: Optional[PurposeResult] = None)[source]

Bases: BaseModel

Proof result class.

class Meta[source]

Bases: object

ProofResult metadata.

schema_class = 'ProofResultSchema'
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: LinkedDataProof, 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: 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[LinkedDataProof], purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) 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[str] = None, controller: Optional[Any] = None)[source]

Bases: BaseModel

Proof purpose result class.

class Meta[source]

Bases: object

PurposeResult metadata.

schema_class = 'PurposeResultSchema'
class aries_cloudagent.vc.ld_proofs.WalletKeyPair(*, profile: Profile, key_type: KeyType, public_key_base58: Optional[str] = None)[source]

Bases: KeyPair

Base wallet key pair.

from_verification_method(verification_method: dict) 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: 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: LinkedDataProof, 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[LinkedDataProof], purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) 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_downloader module

Quick and dirty fix to use as alternative to pyld downloader.

Allows keeping some context in local filesystem.

class aries_cloudagent.vc.ld_proofs.document_downloader.JsonLdDocumentDownloader[source]

Bases: object

JsonLd documents downloader.

download(url: str, options: Optional[Dict], **kwargs)[source]

Retrieves JSON-LD at the given URL.

This was lifted from pyld.documentloader.requests.

Parameters
  • url – the URL to retrieve.

  • options

Returns

the RemoteDocument.

class aries_cloudagent.vc.ld_proofs.document_downloader.JsonLdDocumentParser[source]

Bases: object

JsonLd documents parser.

parse(doc: Dict, link_header: Optional[str])[source]

Parse a jsonld document after retrieval.

This was lifted from pyld.documentloader.requests.

class aries_cloudagent.vc.ld_proofs.document_downloader.StaticCacheJsonLdDownloader(document_downloader: Optional[JsonLdDocumentDownloader] = None, document_parser: Optional[JsonLdDocumentParser] = None)[source]

Bases: object

Context downloader with filesystem static cache for common contexts.

CONTEXT_FILE_MAPPING = {'https://w3id.org/security/bbs/v1': 'bbs-v1-context.jsonld', 'https://w3id.org/security/suites/ed25519-2020/v1': 'ed25519-2020-context.jsonld', 'https://w3id.org/security/v1': 'security-v1-context.jsonld', 'https://w3id.org/security/v2': 'security-v2-context.jsonld', 'https://w3id.org/vc/status-list/2021/v1': 'status_list_context.jsonld', 'https://www.w3.org/2018/credentials/v1': 'credentials_context.jsonld', 'https://www.w3.org/ns/did/v1': 'did_documents_context.jsonld'}
load(url: str, options: Optional[Dict] = None)[source]

Load a jsonld document from URL.

Prioritize local static cache before attempting to download from the URL.

aries_cloudagent.vc.ld_proofs.document_loader module

JSON-LD document loader methods.

class aries_cloudagent.vc.ld_proofs.document_loader.DocumentLoader(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: 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: LinkedDataProof, 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[LinkedDataProof], purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) 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: LinkedDataProof, 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: 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[LinkedDataProof], purpose: ProofPurpose, document_loader: Callable[[str, dict], dict]) 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[ProofResult]] = None, errors: Optional[List[str]] = None)[source]

Bases: BaseModel

Domain verification result class.

class Meta[source]

Bases: object

DocumentVerificationResult metadata.

schema_class = 'DocumentVerificationResultSchema'
class aries_cloudagent.vc.ld_proofs.validation_result.DocumentVerificationResultSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Document verification result schema.

class Meta[source]

Bases: object

DocumentVerificationResultSchema metadata.

model_class

alias of DocumentVerificationResult

results

alias of ProofResultSchema

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

Bases: BaseModel

Proof result class.

class Meta[source]

Bases: object

ProofResult metadata.

schema_class = 'ProofResultSchema'
class aries_cloudagent.vc.ld_proofs.validation_result.ProofResultSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Proof result schema.

class Meta[source]

Bases: object

ProofResultSchema metadata.

model_class

alias of ProofResult

purpose_result

alias of PurposeResultSchema

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

Bases: BaseModel

Proof purpose result class.

class Meta[source]

Bases: object

PurposeResult metadata.

schema_class = 'PurposeResultSchema'
class aries_cloudagent.vc.ld_proofs.validation_result.PurposeResultSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Proof purpose result schema.

class Meta[source]

Bases: object

PurposeResultSchema metadata.

model_class

alias of PurposeResult