I'm trying to generate a pem string using github.com/lestrrat-go/jwx/jwk
.
But so far I coudn't, I'm guessing it's because I'm new to go and there's something I'm not understanding. I have gone through the relevant examples of this library.
My code fetchs a JWK from a server, once I have it, I try to generate a pem string here :
// validationCrt contains my []byte from the server
set, err := jwk.Parse(validationCrt)
if err != nil {
println(err)
}
// I suspect this piece of code is actually a mess
// but I just can't understand what I'm doing wrong
key, err := jwk.GetPublicKey(set)
if err != nil {
log.Printf("failed to create public key: %s", err)
}
I am really lost I tried multiple ways (with and without this lib) and it seems I can't find any example out there (they usually explain how to generate a key, or go from pem to jwt, but my Go app is a client.)