Module Sihl_token.MariaDb
include Sihl.Contract.Token.Sig
- val create : ?ctx:(string * string) list -> ?secret:string -> ?expires_in:Sihl__.Core_time.duration -> (string * string) list -> string Lwt.t
- create ?ctx ?expires_in ?secret datareturns a token that expires in- expires_inwith the associated data- data. If no- expires_inis set, the default is 7 days. An optional secret- secretcan be provided for the token signature, by default `SIHL_SECRET` is used.
- val read : ?ctx:(string * string) list -> ?secret:string -> ?force:unit -> string -> k:string -> string option Lwt.t
- read ?ctx ?secret ?force token kreturns the value that is associated with the key- kin the token- token. If- forceis set, the value is read and returned even if the token is expired, deactivated and the signature is invalid. If the token is completely invalid and can not be read, no value is returned. An optional secret- secretcan be provided to override the default `SIHL_SECRET`.
- val read_all : ?ctx:(string * string) list -> ?secret:string -> ?force:unit -> string -> (string * string) list option Lwt.t
- read_all ?ctx ?secret ?force tokenreturns all key-value pairs associated with the token- token. If- forceis set, the values are read and returned even if the token is expired, deactivated and the signature is invalid. If the token is completely invalid and can not be read, no value is returned. An optional secret- secretcan be provided to override the default `SIHL_SECRET`.
- val verify : ?ctx:(string * string) list -> ?secret:string -> string -> bool Lwt.t
- verify ?ctx ?secret tokenreturns true if the token has a valid structure and the signature is valid, false otherwise. An optional secret- secretcan be provided to override the default `SIHL_SECRET`.
- val deactivate : ?ctx:(string * string) list -> string -> unit Lwt.t
- deactivate ?ctx tokendeactivates the token. Depending on the backend of the token service a blacklist is used to store the token.
- val activate : ?ctx:(string * string) list -> string -> unit Lwt.t
- activate ?ctx tokenre-activates the token. Depending on the backend of the token service a blacklist is used to store the token.
- val is_active : ?ctx:(string * string) list -> string -> bool Lwt.t
- is_active ?ctx tokenreturns true if the token is active, false if the token was deactivated. An expired token or a token that has an invalid signature is not necessarily inactive.
- val is_expired : ?ctx:(string * string) list -> ?secret:string -> string -> bool Lwt.t
- is_expired ?ctx tokenreturns true if the token is expired, false otherwise. An optional secret- secretcan be provided to override the default `SIHL_SECRET`.
- val is_valid : ?ctx:(string * string) list -> ?secret:string -> string -> bool Lwt.t
- is_valid ?ctx tokenreturns true if the token is not expired, active and the signature is valid and false otherwise. A valid token can safely be used. An optional secret- secretcan be provided to override the default `SIHL_SECRET`.
- val register : unit -> Sihl__.Core_container.Service.t
include Sihl__.Core_container.Service.Sig
- val lifecycle : Sihl__.Core_lifecycle.lifecycle