package sihl-facade

  1. Overview
  2. Docs
val to_sexp : Sihl_contract.User.t -> Sexplib0.Sexp.t
val to_yojson : Sihl_contract.User.t -> Yojson.Safe.t
val of_yojson : Yojson.Safe.t -> Sihl_contract.User.t option
val pp : Stdlib.Format.formatter -> Sihl_contract.User.t -> unit
val make : email:string -> password:string -> username:string option -> admin:bool -> confirmed:bool -> (Sihl_contract.User.t, string) Result.t
val set_user_password : Sihl_contract.User.t -> string -> (Sihl_contract.User.t, string) Stdlib.result
val set_user_details : Sihl_contract.User.t -> email:string -> username:string option -> Sihl_contract.User.t
val is_admin : Sihl_contract.User.t -> bool
val is_owner : Sihl_contract.User.t -> string -> bool
val is_confirmed : Sihl_contract.User.t -> bool
val matches_password : string -> Sihl_contract.User.t -> bool
val default_password_policy : string -> (unit, string) Stdlib.result
val validate_new_password : password:string -> password_confirmation:string -> password_policy:(string -> (unit, string) Stdlib.result) -> (unit, string) Stdlib.result
val validate_change_password : Sihl_contract.User.t -> old_password:string -> new_password:string -> new_password_confirmation:string -> password_policy:(string -> (unit, string) Stdlib.result) -> (unit, string) Stdlib.result
include Sihl_contract.User.Sig
val find_opt : user_id:string -> Sihl_contract.User.t option Lwt.t
val find : user_id:string -> Sihl_contract.User.t Lwt.t
val find_by_email : email:string -> Sihl_contract.User.t Lwt.t
val find_by_email_opt : email:string -> Sihl_contract.User.t option Lwt.t
val update_password : ?password_policy:(string -> (unit, string) Result.t) -> user:Sihl_contract.User.t -> old_password:string -> new_password:string -> new_password_confirmation:string -> unit -> (Sihl_contract.User.t, string) Result.t Lwt.t
val update_details : user:Sihl_contract.User.t -> email:string -> username:string option -> Sihl_contract.User.t Lwt.t
val set_password : ?password_policy:(string -> (unit, string) Result.t) -> user:Sihl_contract.User.t -> password:string -> password_confirmation:string -> unit -> (Sihl_contract.User.t, string) Result.t Lwt.t

Set the password of a user without knowing the old password.

This feature is typically used by admins.

val create : email:string -> password:string -> username:string option -> admin:bool -> confirmed:bool -> (Sihl_contract.User.t, string) Stdlib.result Lwt.t
val create_user : email:string -> password:string -> username:string option -> Sihl_contract.User.t Lwt.t

Create and store a user.

val create_admin : email:string -> password:string -> username:string option -> Sihl_contract.User.t Lwt.t

Create and store a user that is also an admin.

val register_user : ?password_policy:(string -> (unit, string) Stdlib.result) -> ?username:string -> email:string -> password:string -> password_confirmation:string -> unit -> (Sihl_contract.User.t, Sihl_contract.User.error) Result.t Lwt.t

Create and store new user.

Provide password_policy to check whether the password fulfills certain criteria.

val login : email:string -> password:string -> (Sihl_contract.User.t, Sihl_contract.User.error) Result.t Lwt.t

Find user by email if password matches.

val lifecycle : unit -> Sihl_core.Container.Lifecycle.t
OCaml

Innovation. Community. Security.