Skip to content

Commit 57a42f0

Browse files
authored
Merge pull request #19 from Indicio-tech/feature/jwk-handling
feat: support JsonWebKey2020 in Askar backend
2 parents 98f1107 + c92aee5 commit 57a42f0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • didcomm_messaging/crypto/backend

didcomm_messaging/crypto/backend/askar.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ def from_verification_method(cls, vm: VerificationMethod) -> "AskarKey":
8787
key = cls.multikey_to_key(multikey)
8888
return cls(key, kid)
8989

90+
if vm.type == "JsonWebKey2020":
91+
jwk = vm.public_key_jwk
92+
if not jwk:
93+
raise ValueError("JWK verification method missing key")
94+
try:
95+
key = Key.from_jwk(jwk)
96+
except AskarError as err:
97+
raise ValueError("Invalid JWK") from err
98+
return cls(key, kid)
99+
90100
alg = cls.type_to_alg.get(vm.type)
91101
if not alg:
92102
raise ValueError("Unsupported verification method type: {vm_type}")

0 commit comments

Comments
 (0)