Skip to content

Commit

Permalink
Merge pull request #32 from dbluhm/fix/integrations
Browse files Browse the repository at this point in the history
feat: verification method types can report type
  • Loading branch information
dbluhm authored May 5, 2021
2 parents 6b54afa + 19ad7ea commit b1fea75
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pydid/verification_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def material(self, value):
)
return setattr(self, self._material_prop, value)

@classmethod
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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "Apache 2.0"
Expand Down
4 changes: 4 additions & 0 deletions tests/test_verification_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit b1fea75

Please sign in to comment.