The pass cookie a client gets for solving a challenge.
Like challenge tokens, passes are stateless: an expiry and a truncated
HMAC-SHA256 over it and the client identity (see
Limen.Challenge.pass_binding/1), with a key only used for passes.
<<version, expires_at::32, mac::16 bytes>>Verifying one is the fast path of Limen.Plug: parse the cookie header,
decode 28 characters, compute one HMAC.
Summary
Functions
Finds cookie name in the values of cookie headers without parsing
every cookie.
Issues a pass for the client in ctx, returning the cookie value and its
lifetime in seconds.
Sets the pass cookie on conn.
Verifies the pass the client in ctx presents, if any.
Verifies a pass cookie value for the client in ctx.
Functions
Finds cookie name in the values of cookie headers without parsing
every cookie.
iex> Limen.Challenge.Pass.cookie(["a=1; _limen_pass=abc; b=2"], "_limen_pass")
"abc"
@spec issue(Limen.Context.t()) :: {String.t(), pos_integer()}
Issues a pass for the client in ctx, returning the cookie value and its
lifetime in seconds.
@spec put_cookie(Plug.Conn.t(), Limen.Instance.t(), String.t(), pos_integer()) :: Plug.Conn.t()
Sets the pass cookie on conn.
@spec verify(Limen.Context.t()) :: {:ok, non_neg_integer()} | {:error, :missing | :malformed | :invalid | :expired}
Verifies the pass the client in ctx presents, if any.
@spec verify(String.t(), Limen.Context.t()) :: {:ok, non_neg_integer()} | {:error, :malformed | :invalid | :expired}
Verifies a pass cookie value for the client in ctx.