Closed mistermoe closed 7 months ago
What is the programmatic use case for converting an array of bytes into a public key?
What is the programmatic use case for converting an array of bytes into a public key?
Any case where key material needs to be converted into a format that isn't JWK. A specific example would be converting from a public key in JWK format to z-base-32 or Base64URL encoding for DID DHT or multibase encoding for DID Key.
The specifics of converting between byte array and JWK representations has some nuance that varies by the key type (e.g., Ed25519
, secp256k1
, etc.) so its useful to have specific implementations of publicKeyToBytes()
and bytesToPublicKey()
for each asymmetric key type (and the ...privateKey...()
complements).
@KendallWeihe i linked the concrete usecase in the PR description: https://github.com/TBD54566975/web5-go/pull/3#discussion_r1474913355
Summary
Implements Methods to convert public key bytes -> JWKs based on a specified algorithm ID. In support of https://github.com/TBD54566975/web5-go/pull/3#discussion_r1474913355. Includes minimal test coverage. full coverage to come when we consume test vectors here
Usage