hyperledger-archives / aries-framework-go

Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
https://wiki.hyperledger.org/display/ARIES/aries-framework-go
Apache License 2.0
241 stars 158 forks source link

Condense key format conversion helpers #3614

Open Moopli opened 11 months ago

Moopli commented 11 months ago

We have code scattered around to convert keys between different formats/representations:

I'm thinking we should make JWK the primary representation (outside of KMS/Crypto), since we already have support for converting to/from JWK for stdlib crypto keys, and bytes+kms.KeyType. For Tink key handles & KMS Key IDs, the KMS api supports converting to/from bytes+kms.KeyType - helper functions could consolidate to pass/receive JWK directly, and potentially update KMS API in future. DID Verification Methods either hold a JWK, or encoded key bytes with a type identifier (different from kms.KeyType), so VerificationMethod could get an API upgrade to support returning non-JWK keys as JWKs.