Skip to content

eXo-OpenSource/ml_jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT Server Module for MTA:SA

Build Status

Developing

  1. Download and install the EditorConfig plugin for Visual Studio: https://github.com/editorconfig/editorconfig-visualstudio#readme
  2. Launch premake.bat
  3. Open Build/JWT.sln

Debugging

  1. Create a directory junktion to MTA-Server directory in the root of the repo
    • mklink /J mta-server "PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server"
  2. Create a symlink to the build output dll in the modules directory
    • cd PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server\x64\modules for x64
    • cd PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server\mods\deathmatch\modules for Win32
    • mklink ml_jwt.dll "PATH_TO_REPO\Bin\Debug\ml_jwt.dll"
  3. Press F5 in Visual Studio and the MTA-Server should start

Installing

  1. Put the resulting Bin/ml_jwt.dll/.so into your MTA:SA server modules folder.
  2. Add <module src="ml_jwt.dll"/> (or .so for Linux) to your mtaserver.conf.
  3. Start the server

Depdencies

  • libcrypto (openssl or compatible)
  • libssl-dev (for the header files)

API

Globals

Algorithm

  • JWT_ALGORITHM_HS256
  • JWT_ALGORITHM_HS384
  • JWT_ALGORITHM_HS512
  • JWT_ALGORITHM_RS256
  • JWT_ALGORITHM_RS384
  • JWT_ALGORITHM_RS512

Functions

Function: jwtSign

bool jwtSign(function(string/boolean) callback, table claims, JWT_ALGORITHM algorithm, string secret/private_key_path, bool is_file_path = false)
  • callback: Lorem ipsum
  • claims: Lorem ipsum
  • algorithm: Lorem ipsum
  • secret/private_key_path Lorem ipsum
  • is_file_path Lorem ipsum

Returns true if everything went fine, false otherwise.

Function: jwtVerify

bool jwtVerify(function(boolean) callback, string token, string secret/public_key_path, bool is_file_path = false)
  • callback: Lorem ipsum
  • token: Lorem ipsum
  • secret/file_path Lorem ipsum
  • is_file_path Lorem ipsum

Returns true if everything went fine, false otherwise.

Function: jwtGetClaims

table jwtGetClaims(string token)
  • token: Lorem ipsum

Returns a table containing the claims.

Download

via https://github.com/Contextualist/glare

Contributors

  • Stefan K.