diff --git a/aries_cloudagent/vc/ld_proofs/__init__.py b/aries_cloudagent/vc/ld_proofs/__init__.py index fa4dc4bde0..9843f069be 100644 --- a/aries_cloudagent/vc/ld_proofs/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/__init__.py @@ -1,5 +1,5 @@ from .ld_proofs import sign, verify, derive -from .ProofSet import ProofSet +from .proof_set import ProofSet from .purposes import ( ProofPurpose, ControllerProofPurpose, diff --git a/aries_cloudagent/vc/ld_proofs/crypto/__init__.py b/aries_cloudagent/vc/ld_proofs/crypto/__init__.py index fb8986a785..ccb10f82da 100644 --- a/aries_cloudagent/vc/ld_proofs/crypto/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/crypto/__init__.py @@ -1,4 +1,4 @@ -from .KeyPair import KeyPair -from .WalletKeyPair import WalletKeyPair +from .key_pair import KeyPair +from .wallet_key_pair import WalletKeyPair __all__ = ["KeyPair", "WalletKeyPair"] diff --git a/aries_cloudagent/vc/ld_proofs/crypto/KeyPair.py b/aries_cloudagent/vc/ld_proofs/crypto/key_pair.py similarity index 100% rename from aries_cloudagent/vc/ld_proofs/crypto/KeyPair.py rename to aries_cloudagent/vc/ld_proofs/crypto/key_pair.py diff --git a/aries_cloudagent/vc/ld_proofs/crypto/tests/test_WalletKeyPair.py b/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py similarity index 95% rename from aries_cloudagent/vc/ld_proofs/crypto/tests/test_WalletKeyPair.py rename to aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py index ba9d125fd1..705ca244be 100644 --- a/aries_cloudagent/vc/ld_proofs/crypto/tests/test_WalletKeyPair.py +++ b/aries_cloudagent/vc/ld_proofs/crypto/tests/test_wallet_key_pair.py @@ -1,9 +1,10 @@ -from asynctest import TestCase -from asynctest import mock as async_mock +from asynctest import TestCase, mock as async_mock from .....wallet.key_pair import KeyType + from ...error import LinkedDataProofException -from ..WalletKeyPair import WalletKeyPair + +from ..wallet_key_pair import WalletKeyPair class TestWalletKeyPair(TestCase): diff --git a/aries_cloudagent/vc/ld_proofs/crypto/WalletKeyPair.py b/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py similarity index 98% rename from aries_cloudagent/vc/ld_proofs/crypto/WalletKeyPair.py rename to aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py index 43e6df5eeb..f666b739ac 100644 --- a/aries_cloudagent/vc/ld_proofs/crypto/WalletKeyPair.py +++ b/aries_cloudagent/vc/ld_proofs/crypto/wallet_key_pair.py @@ -5,8 +5,10 @@ from ....wallet.util import b58_to_bytes from ....wallet.key_type import KeyType from ....wallet.base import BaseWallet + from ..error import LinkedDataProofException -from .KeyPair import KeyPair + +from .key_pair import KeyPair class WalletKeyPair(KeyPair): diff --git a/aries_cloudagent/vc/ld_proofs/ld_proofs.py b/aries_cloudagent/vc/ld_proofs/ld_proofs.py index cdb284fc73..284e328f61 100644 --- a/aries_cloudagent/vc/ld_proofs/ld_proofs.py +++ b/aries_cloudagent/vc/ld_proofs/ld_proofs.py @@ -2,11 +2,11 @@ from typing import List -from .validation_result import DocumentVerificationResult from .document_loader import DocumentLoaderMethod -from .ProofSet import ProofSet +from .proof_set import ProofSet from .purposes import ProofPurpose from .suites import LinkedDataProof +from .validation_result import DocumentVerificationResult async def sign( diff --git a/aries_cloudagent/vc/ld_proofs/ProofSet.py b/aries_cloudagent/vc/ld_proofs/proof_set.py similarity index 99% rename from aries_cloudagent/vc/ld_proofs/ProofSet.py rename to aries_cloudagent/vc/ld_proofs/proof_set.py index 8eace9e6c4..4ff176d679 100644 --- a/aries_cloudagent/vc/ld_proofs/ProofSet.py +++ b/aries_cloudagent/vc/ld_proofs/proof_set.py @@ -1,14 +1,15 @@ """Class to represent a Linked Data proof set.""" from typing import List, Union + from pyld.jsonld import JsonLdProcessor -from .error import LinkedDataProofException -from .validation_result import DocumentVerificationResult, ProofResult from .constants import SECURITY_CONTEXT_URL from .document_loader import DocumentLoaderMethod -from .purposes.ProofPurpose import ProofPurpose +from .error import LinkedDataProofException +from .purposes.proof_purpose import ProofPurpose from .suites import LinkedDataProof +from .validation_result import DocumentVerificationResult, ProofResult class ProofSet: diff --git a/aries_cloudagent/vc/ld_proofs/purposes/__init__.py b/aries_cloudagent/vc/ld_proofs/purposes/__init__.py index 454f9aa7b3..091c726be9 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/__init__.py @@ -1,8 +1,9 @@ -from .ProofPurpose import ProofPurpose -from .ControllerProofPurpose import ControllerProofPurpose -from .AssertionProofPurpose import AssertionProofPurpose -from .AuthenticationProofPurpose import AuthenticationProofPurpose -from .CredentialIssuancePurpose import CredentialIssuancePurpose +from .proof_purpose import ProofPurpose + +from .assertion_proof_purpose import AssertionProofPurpose +from .authentication_proof_purpose import AuthenticationProofPurpose +from .controller_proof_purpose import ControllerProofPurpose +from .credential_issuance_purpose import CredentialIssuancePurpose __all__ = [ "ProofPurpose", diff --git a/aries_cloudagent/vc/ld_proofs/purposes/AssertionProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py similarity index 89% rename from aries_cloudagent/vc/ld_proofs/purposes/AssertionProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py index 1f36127496..c988b3f2a2 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/AssertionProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/assertion_proof_purpose.py @@ -2,7 +2,7 @@ from datetime import datetime, timedelta -from .ControllerProofPurpose import ControllerProofPurpose +from .controller_proof_purpose import ControllerProofPurpose class AssertionProofPurpose(ControllerProofPurpose): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/AuthenticationProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py similarity index 92% rename from aries_cloudagent/vc/ld_proofs/purposes/AuthenticationProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py index 8dfa13a840..4ed8c0731a 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/AuthenticationProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/authentication_proof_purpose.py @@ -1,12 +1,17 @@ """Authentication proof purpose class.""" from datetime import datetime, timedelta +from typing import TYPE_CHECKING +from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException from ..validation_result import PurposeResult -from ..document_loader import DocumentLoaderMethod -from ..suites import LinkedDataProof -from .ControllerProofPurpose import ControllerProofPurpose + +from .controller_proof_purpose import ControllerProofPurpose + +# Avoid circular dependency +if TYPE_CHECKING: + from ..suites import LinkedDataProof class AuthenticationProofPurpose(ControllerProofPurpose): @@ -37,7 +42,7 @@ def validate( *, proof: dict, document: dict, - suite: LinkedDataProof, + suite: "LinkedDataProof", verification_method: dict, document_loader: DocumentLoaderMethod, ) -> PurposeResult: diff --git a/aries_cloudagent/vc/ld_proofs/purposes/ControllerProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py similarity index 93% rename from aries_cloudagent/vc/ld_proofs/purposes/ControllerProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py index fa0cb6fd0e..84167348ac 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/ControllerProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/controller_proof_purpose.py @@ -1,14 +1,20 @@ """Controller proof purpose class.""" +from typing import TYPE_CHECKING + from pyld.jsonld import JsonLdProcessor from pyld import jsonld -from ..error import LinkedDataProofException -from ..validation_result import PurposeResult from ..constants import SECURITY_CONTEXT_URL -from ..suites import LinkedDataProof from ..document_loader import DocumentLoaderMethod -from .ProofPurpose import ProofPurpose +from ..error import LinkedDataProofException +from ..validation_result import PurposeResult + +from .proof_purpose import ProofPurpose + +# Avoid circular dependency +if TYPE_CHECKING: + from ..suites import LinkedDataProof class ControllerProofPurpose(ProofPurpose): @@ -19,7 +25,7 @@ def validate( *, proof: dict, document: dict, - suite: LinkedDataProof, + suite: "LinkedDataProof", verification_method: dict, document_loader: DocumentLoaderMethod, ) -> PurposeResult: diff --git a/aries_cloudagent/vc/ld_proofs/purposes/CredentialIssuancePurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py similarity index 90% rename from aries_cloudagent/vc/ld_proofs/purposes/CredentialIssuancePurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py index 5e24cf3de7..151857fbf2 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/CredentialIssuancePurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/credential_issuance_purpose.py @@ -1,15 +1,20 @@ """Credential Issuance proof purpose class.""" -from typing import List +from typing import List, TYPE_CHECKING + from pyld.jsonld import JsonLdProcessor from pyld import jsonld +from ..constants import CREDENTIALS_ISSUER_URL +from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException from ..validation_result import PurposeResult -from ..suites import LinkedDataProof -from ..document_loader import DocumentLoaderMethod -from ..constants import CREDENTIALS_ISSUER_URL -from .AssertionProofPurpose import AssertionProofPurpose + +from .assertion_proof_purpose import AssertionProofPurpose + +# Avoid circular dependency +if TYPE_CHECKING: + from ..suites import LinkedDataProof class CredentialIssuancePurpose(AssertionProofPurpose): @@ -20,7 +25,7 @@ def validate( *, proof: dict, document: dict, - suite: LinkedDataProof, + suite: "LinkedDataProof", verification_method: dict, document_loader: DocumentLoaderMethod, ) -> PurposeResult: diff --git a/aries_cloudagent/vc/ld_proofs/purposes/ProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py similarity index 93% rename from aries_cloudagent/vc/ld_proofs/purposes/ProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py index 8d9b7168ef..49fc7a48c8 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/ProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/proof_purpose.py @@ -1,11 +1,16 @@ """Base Proof Purpose class.""" from datetime import datetime, timedelta +from typing import TYPE_CHECKING from ....messaging.util import str_to_datetime -from ..validation_result import PurposeResult + from ..document_loader import DocumentLoaderMethod -from ..suites import LinkedDataProof +from ..validation_result import PurposeResult + +# Avoid circular dependency +if TYPE_CHECKING: + from ..suites import LinkedDataProof class ProofPurpose: @@ -24,7 +29,7 @@ def validate( *, proof: dict, document: dict, - suite: LinkedDataProof, + suite: "LinkedDataProof", verification_method: dict, document_loader: DocumentLoaderMethod, ) -> PurposeResult: diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_AuthenticationProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py similarity index 97% rename from aries_cloudagent/vc/ld_proofs/purposes/tests/test_AuthenticationProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py index 4f902db3a4..957c5d56c1 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_AuthenticationProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_authentication_proof_purpose.py @@ -2,8 +2,8 @@ from asynctest import TestCase, mock as async_mock from ...validation_result import PurposeResult -from ..ControllerProofPurpose import ControllerProofPurpose -from ..AuthenticationProofPurpose import AuthenticationProofPurpose +from ..controller_proof_purpose import ControllerProofPurpose +from ..authentication_proof_purpose import AuthenticationProofPurpose class TestAuthenticationProofPurpose(TestCase): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_ControllerProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py similarity index 97% rename from aries_cloudagent/vc/ld_proofs/purposes/tests/test_ControllerProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py index 156f4a8dbc..8ae1dc33c6 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_ControllerProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_controller_proof_purpose.py @@ -3,8 +3,8 @@ from ....tests.data import TEST_VC_DOCUMENT_SIGNED_DID_KEY_ED25519 from ....tests.document_loader import custom_document_loader -from ..ProofPurpose import ProofPurpose -from ..ControllerProofPurpose import ControllerProofPurpose +from ..proof_purpose import ProofPurpose +from ..controller_proof_purpose import ControllerProofPurpose class TestControllerProofPurpose(TestCase): diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_CredentialIssuancePurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py similarity index 97% rename from aries_cloudagent/vc/ld_proofs/purposes/tests/test_CredentialIssuancePurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py index 8d0ee90886..60442b73da 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_CredentialIssuancePurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_credential_issuance_purpose.py @@ -2,8 +2,8 @@ from asynctest import TestCase, mock as async_mock from ...validation_result import PurposeResult -from ..AssertionProofPurpose import AssertionProofPurpose -from ..CredentialIssuancePurpose import CredentialIssuancePurpose +from ..assertion_proof_purpose import AssertionProofPurpose +from ..credential_issuance_purpose import CredentialIssuancePurpose from ....tests.data import TEST_VC_DOCUMENT_SIGNED_ED25519 from ....tests.document_loader import custom_document_loader diff --git a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_ProofPurpose.py b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py similarity index 98% rename from aries_cloudagent/vc/ld_proofs/purposes/tests/test_ProofPurpose.py rename to aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py index 7d6dcef890..ffde15d366 100644 --- a/aries_cloudagent/vc/ld_proofs/purposes/tests/test_ProofPurpose.py +++ b/aries_cloudagent/vc/ld_proofs/purposes/tests/test_proof_purpose.py @@ -2,7 +2,7 @@ from asynctest import TestCase, mock as async_mock from .....messaging.util import datetime_to_str -from ..ProofPurpose import ProofPurpose +from ..proof_purpose import ProofPurpose class TestProofPurpose(TestCase): diff --git a/aries_cloudagent/vc/ld_proofs/suites/__init__.py b/aries_cloudagent/vc/ld_proofs/suites/__init__.py index b669ff0348..3e680e142b 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/__init__.py +++ b/aries_cloudagent/vc/ld_proofs/suites/__init__.py @@ -1,9 +1,9 @@ -from .LinkedDataProof import LinkedDataProof -from .LinkedDataSignature import LinkedDataSignature -from .JwsLinkedDataSignature import JwsLinkedDataSignature -from .Ed25519Signature2018 import Ed25519Signature2018 -from .BbsBlsSignature2020 import BbsBlsSignature2020 -from .BbsBlsSignatureProof2020 import BbsBlsSignatureProof2020 +from .linked_data_proof import LinkedDataProof +from .linked_data_signature import LinkedDataSignature +from .jws_linked_data_signature import JwsLinkedDataSignature +from .ed25519_signature_2018 import Ed25519Signature2018 +from .bbs_bls_signature_2020 import BbsBlsSignature2020 +from .bbs_bls_signature_proof_2020 import BbsBlsSignatureProof2020 __all__ = [ "LinkedDataProof", diff --git a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020.py b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020.py similarity index 99% rename from aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020.py rename to aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020.py index a0d1ddcbe8..b089bcc2c4 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020.py @@ -3,14 +3,15 @@ from datetime import datetime from typing import List, Union - from ....wallet.util import b64_to_bytes, bytes_to_b64 + from ..crypto import KeyPair -from ..error import LinkedDataProofException -from ..validation_result import ProofResult from ..document_loader import DocumentLoaderMethod +from ..error import LinkedDataProofException from ..purposes import ProofPurpose -from .BbsBlsSignature2020Base import BbsBlsSignature2020Base +from ..validation_result import ProofResult + +from .bbs_bls_signature_2020_base import BbsBlsSignature2020Base class BbsBlsSignature2020(BbsBlsSignature2020Base): diff --git a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020Base.py b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py similarity index 98% rename from aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020Base.py rename to aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py index b236df21b1..4c0a1e8938 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignature2020Base.py +++ b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_2020_base.py @@ -1,13 +1,16 @@ """BbsBlsSignature2020Base class.""" from abc import ABCMeta, abstractmethod -from pyld import jsonld from typing import List -from ..error import LinkedDataProofException +from pyld import jsonld + from ....utils.dependencies import is_ursa_bbs_signatures_module_installed + from ..document_loader import DocumentLoaderMethod -from .LinkedDataProof import LinkedDataProof +from ..error import LinkedDataProofException + +from .linked_data_proof import LinkedDataProof class BbsBlsSignature2020Base(LinkedDataProof, metaclass=ABCMeta): diff --git a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignatureProof2020.py b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py similarity index 98% rename from aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignatureProof2020.py rename to aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py index 3b00e8ed5f..ad951e7bab 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/BbsBlsSignatureProof2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/bbs_bls_signature_proof_2020.py @@ -3,9 +3,11 @@ import re from os import urandom -from pyld import jsonld from typing import List -from .BbsBlsSignature2020Base import BbsBlsSignature2020Base + +from pyld import jsonld + +from .bbs_bls_signature_2020_base import BbsBlsSignature2020Base if BbsBlsSignature2020Base.BBS_SUPPORTED: from ursa_bbs_signatures import ( @@ -21,13 +23,15 @@ from ....utils.dependencies import assert_ursa_bbs_signatures_installed from ....wallet.util import b64_to_bytes, bytes_to_b64 + from ..crypto import KeyPair from ..error import LinkedDataProofException from ..validation_result import ProofResult from ..document_loader import DocumentLoaderMethod from ..purposes import ProofPurpose -from .BbsBlsSignature2020 import BbsBlsSignature2020 -from .LinkedDataProof import DeriveProofResult + +from .bbs_bls_signature_2020 import BbsBlsSignature2020 +from .linked_data_proof import DeriveProofResult class BbsBlsSignatureProof2020(BbsBlsSignature2020Base): diff --git a/aries_cloudagent/vc/ld_proofs/suites/Ed25519Signature2018.py b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py similarity index 95% rename from aries_cloudagent/vc/ld_proofs/suites/Ed25519Signature2018.py rename to aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py index 203b2bff91..df77ff8b75 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/Ed25519Signature2018.py +++ b/aries_cloudagent/vc/ld_proofs/suites/ed25519_signature_2018.py @@ -4,7 +4,8 @@ from typing import Union from ..crypto import KeyPair -from .JwsLinkedDataSignature import JwsLinkedDataSignature + +from .jws_linked_data_signature import JwsLinkedDataSignature class Ed25519Signature2018(JwsLinkedDataSignature): diff --git a/aries_cloudagent/vc/ld_proofs/suites/JwsLinkedDataSignature.py b/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py similarity index 99% rename from aries_cloudagent/vc/ld_proofs/suites/JwsLinkedDataSignature.py rename to aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py index e40399bb72..9aa749a8ee 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/JwsLinkedDataSignature.py +++ b/aries_cloudagent/vc/ld_proofs/suites/jws_linked_data_signature.py @@ -1,15 +1,19 @@ """JWS Linked Data class.""" -from pyld.jsonld import JsonLdProcessor +import json + from datetime import datetime from typing import Union -import json + +from pyld.jsonld import JsonLdProcessor from ....wallet.util import b64_to_bytes, bytes_to_b64, str_to_b64, b64_to_str + from ..crypto import KeyPair from ..document_loader import DocumentLoaderMethod from ..error import LinkedDataProofException -from .LinkedDataSignature import LinkedDataSignature + +from .linked_data_signature import LinkedDataSignature class JwsLinkedDataSignature(LinkedDataSignature): diff --git a/aries_cloudagent/vc/ld_proofs/suites/LinkedDataProof.py b/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py similarity index 95% rename from aries_cloudagent/vc/ld_proofs/suites/LinkedDataProof.py rename to aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py index 979b28b260..1c5c5cd63a 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/LinkedDataProof.py +++ b/aries_cloudagent/vc/ld_proofs/suites/linked_data_proof.py @@ -2,21 +2,18 @@ from abc import ABC -from pyld import jsonld -from typing import List, TYPE_CHECKING, Union +from typing import List, Union +from pyld import jsonld from typing_extensions import TypedDict from ..check import get_properties_without_context from ..constants import SECURITY_CONTEXT_URL -from ..error import LinkedDataProofException from ..document_loader import DocumentLoaderMethod +from ..error import LinkedDataProofException +from ..purposes import ProofPurpose from ..validation_result import ProofResult -# ProofPurpose and LinkedDataProof depend on each other -if TYPE_CHECKING: - from ..purposes.ProofPurpose import ProofPurpose - class DeriveProofResult(TypedDict): """Result dict for deriving a proof.""" @@ -44,7 +41,7 @@ async def create_proof( self, *, document: dict, - purpose: "ProofPurpose", + purpose: ProofPurpose, document_loader: DocumentLoaderMethod, ) -> dict: """Create proof for document. @@ -67,7 +64,7 @@ async def verify_proof( *, proof: dict, document: dict, - purpose: "ProofPurpose", + purpose: ProofPurpose, document_loader: DocumentLoaderMethod, ) -> ProofResult: """Verify proof against document and proof purpose. diff --git a/aries_cloudagent/vc/ld_proofs/suites/LinkedDataSignature.py b/aries_cloudagent/vc/ld_proofs/suites/linked_data_signature.py similarity index 99% rename from aries_cloudagent/vc/ld_proofs/suites/LinkedDataSignature.py rename to aries_cloudagent/vc/ld_proofs/suites/linked_data_signature.py index 6d29daf945..502920a7c6 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/LinkedDataSignature.py +++ b/aries_cloudagent/vc/ld_proofs/suites/linked_data_signature.py @@ -1,16 +1,17 @@ """Linked Data Signature class.""" +from abc import abstractmethod, ABCMeta from datetime import datetime from hashlib import sha256 from typing import Union -from abc import abstractmethod, ABCMeta -from ..error import LinkedDataProofException -from ..validation_result import ProofResult +from ..constants import SECURITY_CONTEXT_URL from ..document_loader import DocumentLoaderMethod +from ..error import LinkedDataProofException from ..purposes import ProofPurpose -from ..constants import SECURITY_CONTEXT_URL -from .LinkedDataProof import LinkedDataProof +from ..validation_result import ProofResult + +from .linked_data_proof import LinkedDataProof class LinkedDataSignature(LinkedDataProof, metaclass=ABCMeta): diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignature2020.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py similarity index 96% rename from aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignature2020.py rename to aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py index 484a028180..f8bfdf6533 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignature2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_2020.py @@ -1,7 +1,6 @@ from asynctest import TestCase, mock as async_mock import pytest - from .....did.did_key import DIDKey from .....wallet.key_pair import KeyType from .....wallet.in_memory import InMemoryWallet @@ -14,12 +13,13 @@ TEST_VC_DOCUMENT, TEST_VC_DOCUMENT_SIGNED_BBS, ) -from ...error import LinkedDataProofException -from ...crypto.WalletKeyPair import WalletKeyPair -from ...purposes.AssertionProofPurpose import AssertionProofPurpose +from ...error import LinkedDataProofException +from ...crypto.wallet_key_pair import WalletKeyPair +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ...ld_proofs import sign, verify -from ..BbsBlsSignature2020 import BbsBlsSignature2020 + +from ..bbs_bls_signature_2020 import BbsBlsSignature2020 @pytest.mark.ursa_bbs_signatures diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignatureProof2020.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py similarity index 97% rename from aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignatureProof2020.py rename to aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py index b72d0daeec..e8a79e2297 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_BbsBlsSignatureProof2020.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_bbs_bls_signature_proof_2020.py @@ -21,13 +21,14 @@ TEST_VC_DOCUMENT_PARTIAL_PROOF_BBS, TEST_VC_DOCUMENT_NESTED_REVEAL, ) -from ...crypto.WalletKeyPair import WalletKeyPair -from ...purposes.AssertionProofPurpose import AssertionProofPurpose +from ....vc_ld import derive_credential, verify_credential +from ...crypto.wallet_key_pair import WalletKeyPair +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ...error import LinkedDataProofException from ...ld_proofs import verify, derive -from ....vc_ld import derive_credential, verify_credential -from ..BbsBlsSignatureProof2020 import BbsBlsSignatureProof2020 + +from ..bbs_bls_signature_proof_2020 import BbsBlsSignatureProof2020 @pytest.mark.ursa_bbs_signatures diff --git a/aries_cloudagent/vc/ld_proofs/suites/tests/test_Ed25519Signature2018.py b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py similarity index 95% rename from aries_cloudagent/vc/ld_proofs/suites/tests/test_Ed25519Signature2018.py rename to aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py index 7999a07da6..613aec46ab 100644 --- a/aries_cloudagent/vc/ld_proofs/suites/tests/test_Ed25519Signature2018.py +++ b/aries_cloudagent/vc/ld_proofs/suites/tests/test_ed25519_signature_2018.py @@ -5,6 +5,7 @@ from .....wallet.key_pair import KeyType from .....wallet.in_memory import InMemoryWallet from .....core.in_memory import InMemoryProfile + from ....tests.document_loader import custom_document_loader from ....tests.data import ( TEST_LD_DOCUMENT, @@ -13,11 +14,12 @@ TEST_VC_DOCUMENT, TEST_VC_DOCUMENT_SIGNED_ED25519, ) -from ...crypto.WalletKeyPair import WalletKeyPair -from ...purposes.AssertionProofPurpose import AssertionProofPurpose +from ...crypto.wallet_key_pair import WalletKeyPair +from ...purposes.assertion_proof_purpose import AssertionProofPurpose from ...ld_proofs import sign, verify -from ..Ed25519Signature2018 import Ed25519Signature2018 + +from ..ed25519_signature_2018 import Ed25519Signature2018 class TestEd25519Signature2018(TestCase): diff --git a/aries_cloudagent/vc/vc_ld/tests/test_validation_result.py b/aries_cloudagent/vc/vc_ld/tests/test_validation_result.py index d9e69269f4..26f027d4a6 100644 --- a/aries_cloudagent/vc/vc_ld/tests/test_validation_result.py +++ b/aries_cloudagent/vc/vc_ld/tests/test_validation_result.py @@ -1,7 +1,4 @@ from asynctest import TestCase -from datetime import datetime - -import pytest from ..validation_result import PresentationVerificationResult