Please help me rewrite this Javascript function to Elixir

Ok, this means that pem_entry_decode returns a certificate and not a public_key directly. You then need to extract the public_key from the certificate data structure. I have not got anything available to test this right now and can’t remember from heart.

The public key user guide might help you:

It is in erlang and they return erlang records, so you may want to read up on elixir Records as well to handle them in the proper way.