encryptionelixirjwt

How to generate a HS512 secret key to use with JWT


I am using Guardian to realize JWT Authentication with an Elixir / Phoenix app. I'm using the HS512 algorithm. And I need a key for that. Are there any conditions for this key except that it has to be 512 bits or longer? It can be any arbitrary string, right?


Solution

  • In case anyone visits this now: Guardian added a mix task for that.

    mix guardian.gen.secret

    https://hexdocs.pm/guardian/Mix.Tasks.Guardian.Gen.Secret.html#content