From 715adeac86fa5c9ea9dc75f07a7bdde5dde813c8 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Tue, 4 May 2021 23:12:01 -0400 Subject: [PATCH 1/3] feat: verification methods can report type string Signed-off-by: Daniel Bluhm --- pydid/verification_method.py | 6 ++++++ tests/test_verification_method.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/pydid/verification_method.py b/pydid/verification_method.py index 28d2093..87431bc 100644 --- a/pydid/verification_method.py +++ b/pydid/verification_method.py @@ -163,6 +163,12 @@ def material(self, value): ) return setattr(self, self._material_prop, value) + @classmethod + @property + def method_type(cls) -> Optional[str]: + """Return method type if known.""" + return cls._fill_in_required_literals().get("type") + # Verification Method Suites registered in DID Spec diff --git a/tests/test_verification_method.py b/tests/test_verification_method.py index be2dbe3..a4b1371 100644 --- a/tests/test_verification_method.py +++ b/tests/test_verification_method.py @@ -178,3 +178,7 @@ def test_infer_material(): } vmethod = VerificationMethod.deserialize(vmethod_raw) assert vmethod.material == vmethod_raw["blockchainAccountId"] + + +def test_method_type(): + assert Ed25519VerificationKey2018.method_type == "Ed25519VerificationKey2018" From 2ffb0b7af9e990eed61b473493b1820b8982ebcf Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Tue, 4 May 2021 23:13:08 -0400 Subject: [PATCH 2/3] chore: bump version for pre-release Signed-off-by: Daniel Bluhm --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 67e9518..c8028fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ show_missing = true [tool.poetry] name = "pydid" -version = "0.2.5" +version = "0.3.0-pre.3" description = "Python library for validating, constructing, and representing DIDs and DID Documents" authors = ["Daniel Bluhm "] license = "Apache 2.0" From 19ad7ea6c2dfe3640e7a32c6f325cf8d6637cd4b Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Tue, 4 May 2021 23:18:09 -0400 Subject: [PATCH 3/3] fix: compat with <= 3.7 Signed-off-by: Daniel Bluhm --- pydid/verification_method.py | 1 - tests/test_verification_method.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pydid/verification_method.py b/pydid/verification_method.py index 87431bc..94bf0d5 100644 --- a/pydid/verification_method.py +++ b/pydid/verification_method.py @@ -164,7 +164,6 @@ def material(self, value): return setattr(self, self._material_prop, value) @classmethod - @property def method_type(cls) -> Optional[str]: """Return method type if known.""" return cls._fill_in_required_literals().get("type") diff --git a/tests/test_verification_method.py b/tests/test_verification_method.py index a4b1371..d5525be 100644 --- a/tests/test_verification_method.py +++ b/tests/test_verification_method.py @@ -181,4 +181,4 @@ def test_infer_material(): def test_method_type(): - assert Ed25519VerificationKey2018.method_type == "Ed25519VerificationKey2018" + assert Ed25519VerificationKey2018.method_type() == "Ed25519VerificationKey2018"