Module TOTP.Make

Make creates a strategy for a provided model with provided responses.

Parameters

module R : RESPONSES
module M : MODEL

Signature

type entity = M.t
val call : Dream.request -> entity -> entity FPauth_core.Static.StratResult.t Lwt.t

call is the main function of the strategy. It needs "totp_code" param, otherwise it is skipped. Verifies, that the code is correct for user's secret.

val routes : Dream.route

routes provide these routes in "/totp" scope:

  • GET "/generate_secret" is the first step to enable TOTP. Generates a secret for a user. The user must be authenticated first. The user must have TOTP disabled.
  • POST "/finish_setup" is the second step to enable TOTP. Should recieve "totp_code" as param, verifies it and enables TOTP if it was correct.
val name : string