Skip to content

Commit

Permalink
Merge pull request #19 from Indicio-tech/feature/jwk-handling
Browse files Browse the repository at this point in the history
feat: support JsonWebKey2020 in Askar backend
  • Loading branch information
Frostyfrog authored Dec 6, 2023
2 parents 98f1107 + c92aee5 commit 57a42f0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions didcomm_messaging/crypto/backend/askar.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ def from_verification_method(cls, vm: VerificationMethod) -> "AskarKey":
key = cls.multikey_to_key(multikey)
return cls(key, kid)

if vm.type == "JsonWebKey2020":
jwk = vm.public_key_jwk
if not jwk:
raise ValueError("JWK verification method missing key")
try:
key = Key.from_jwk(jwk)
except AskarError as err:
raise ValueError("Invalid JWK") from err
return cls(key, kid)

alg = cls.type_to_alg.get(vm.type)
if not alg:
raise ValueError("Unsupported verification method type: {vm_type}")
Expand Down

0 comments on commit 57a42f0

Please sign in to comment.