LUA

From UVOO Tech Wiki
Jump to navigation Jump to search

Requests Library

https://github.com/JakobGreen/lua-requests#sending-data

Ubuntu install

apt install -y luarocks lua5.3 lua-sec libssl-dev liblua5.3-dev lua-basexx
luarocks install lua-requests

NGINX

http {

   lua_package_path "/etc/nginx/lua/?.lua;;";

Snippets

https://github.com/openresty/lua-nginx-module

s = 'one two'
words = {}
for word in s:gmatch("%w+") do table.insert(words, word) end
print(words[2])
s = string.match('first last', '%S-$')
user_pass = "myuser:mypass"
username = string.match(user_pass, '(.*):')

CJSON

local cjson = require "cjson"
if cjson.decode(ngx.var.request_body).method == "eth_accounts" then
   ngx.say('passes')
end

Crypto

https://github.com/wahern/luaossl

now you can support secp256k1 and others

JWT

https://github.com/SkyLothar/lua-resty-jwt#methods

or https://github.com/altexy/lua-resty-jwt

doesn't appear to support ES512 maybe mix with the above or write your own lib

limited

Resources