FedecksServer.Token (fedecks_server v0.1.0)

Token used by clients that have already authorised.

Link to this section Summary

Functions

Convert the token previously generated with to_token/1 back to its identifier (if valid)

Convert the identifier to a token, that will expire in expiry_secs seconds, using the secret / salt tuple

Link to this section Functions

Link to this function

from_token(token, arg)

@spec from_token(
  token :: binary(),
  {secret :: binary(), salt :: binary()}
) :: {:error, :expired | :invalid | :missing} | {:ok, identifier :: term()}

Convert the token previously generated with to_token/1 back to its identifier (if valid)

Link to this function

to_token(identifier, expiry_secs, arg)

@spec to_token(
  identifier :: term(),
  expiry_secs :: pos_integer(),
  {secret :: binary(), salst :: binary()}
) :: binary()

Convert the identifier to a token, that will expire in expiry_secs seconds, using the secret / salt tuple