Module: authenicator

This module contains functions for user authentication and verification.
Version:
  • 1.0
Author:
  • Mateusz Nowak, Luka Kralj

Methods


<inner> canLogin()

Function tha naively checks if user provided right credentials

<async, inner> initTokens()

Retrieves all access tokens (if any) from the database and creates a lookup table for faster access.

<async, inner> logoutUser(accessToken)

Delete access token for this user.
Parameters:
Name Type Description
accessToken string Token used for identification.
Returns:
True if token successfully deleted, false if invalid token.
Type
boolean

<async, inner> registerNewUsername(username)

Register the given username with a login token that is used in authorisation of the requests.
Parameters:
Name Type Description
username string A valid username.
Returns:
A login token for this user.
Type
string

<async, inner> verifyToken(accessToken)

Verifies user using the accessToken.
Parameters:
Name Type Description
accessToken string Token used for identification.
Returns:
Username of the user or undefined if token is invalid.