Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Condense key format conversion helpers #3614

Open
Moopli opened this issue Aug 2, 2023 · 0 comments
Open

Condense key format conversion helpers #3614

Moopli opened this issue Aug 2, 2023 · 0 comments

Comments

@Moopli
Copy link
Contributor

Moopli commented Aug 2, 2023

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

  • DID Verification Method
  • JWK
  • Key bytes (sometimes in multiple different formats between uses) + kms.KeyType
  • standard library crypto keys (ecdsa.PrivateKey, etc)
  • Tink key handles & KMS Key IDs

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant