package ez_api

  1. Overview
  2. Docs
type foreign_info = {
  1. foreign_origin : string;
  2. foreign_token : string;
}

Foreign user without password, whose login is equal to foreign_origin ^ foreign_token and whose password is not req.

type 'user_id session = {
  1. session_token : string;
  2. session_login : string;
  3. session_user_id : 'user_id;
  4. session_last : float;
  5. session_foreign : foreign_info option;
}

A session that helps to keep connection for the given user and stores useful information about his communication with the sever.

module type SessionArg = sig ... end

Main module that specifies the session parameters for given implementation of API server.

type ('user_id, 'user_info) auth = {
  1. auth_login : string;
  2. auth_user_id : 'user_id;
  3. auth_token : string;
  4. auth_user_info : 'user_info;
}

Authentification information returned by server after successful connection

type auth_needed = {
  1. challenge_id : string;
  2. challenge : string;
}

Challenge that should be resolved to be able to connect

type 'auth connect_response =
  1. | AuthOk of 'auth
  2. | AuthNeeded of auth_needed

Connection response, that either describes user information if connection successes either describes challenge to resolve to be able to connect

type local_login_message = {
  1. login_user : string;
  2. login_challenge_id : string;
  3. login_challenge_reply : string;
}

Logining request, that contains the login and the challenge resolution obtained by hashing challenge and password provided by the user.

type login_message =
  1. | Local of local_login_message
  2. | Foreign of foreign_info

Logining request, that could be asked either by user with the password provided either by a foreign user without a password.

type ('user_id, 'user_info) login_response =
  1. | LoginOk of ('user_id, 'user_info) auth
  2. | LoginWait of 'user_id

Possible logining outcomes.

type login_error = [
  1. | `Bad_user_or_password
  2. | `User_not_registered
  3. | `Unverified_user
  4. | `Challenge_not_found_or_expired of string
  5. | `Invalid_session_login of string
]

Errors that could be raised while logining.

type logout_error = [
  1. | `Invalid_session_logout of string
]

Errors that could be raised while disconnecting.

type connect_error = [
  1. | `Session_expired
  2. | `Invalid_session_connect of string
]

Errors that could be raised while connecting.

OCaml

Innovation. Community. Security.