Hi, we’re looking to create the output from Phoenix.Token.encrypt and .decrypt in another language for testing purposes. My guess it’s a combination of HEX(HMAC()) and concatenation with . of some of the context/key/salt.
Phoenix.Token mostly delegates the work to Plug.Crypto.
For instance, Phoenix.Token.encrypt leads here:
and then to MessageEncryptor:
Also note that encode in Plug.Crypto uses :erlang.term_to_binary, so you’ll need an implementation of External Term Format as well as all the ChaCha20 juggling.