jkeys089 / lua-resty-hmac

HMAC functions for ngx_lua and LuaJIT
160 stars 99 forks source link

how to install? #35

Open psvz opened 2 years ago

psvz commented 2 years ago

You say "It is recommended to use the latest ngx_openresty bundle directly" Well, I do have the bundle installed, and yet I am getting:

2022/10/26 11:12:54 [error] 3649#3649: *33 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:97):4: module 'resty.hmac' not found:
        no field package.preload['resty.hmac']
        no file '/usr/local/openresty/site/lualib/resty/hmac.ljbc'
        no file '/usr/local/openresty/site/lualib/resty/hmac/init.ljbc'
        no file '/usr/local/openresty/lualib/resty/hmac.ljbc'
        no file '/usr/local/openresty/lualib/resty/hmac/init.ljbc'
        no file '/usr/local/openresty/site/lualib/resty/hmac.lua'
        no file '/usr/local/openresty/site/lualib/resty/hmac/init.lua'
        no file '/usr/local/openresty/lualib/resty/hmac.lua'
        no file '/usr/local/openresty/lualib/resty/hmac/init.lua'
        no file './resty/hmac.lua'
        no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/resty/hmac.lua'
        no file '/usr/local/share/lua/5.1/resty/hmac.lua'
        no file '/usr/local/share/lua/5.1/resty/hmac/init.lua'
        no file '/usr/local/openresty/luajit/share/lua/5.1/resty/hmac.lua'
        no file '/usr/local/openresty/luajit/share/lua/5.1/resty/hmac/init.lua'
        no file '/usr/local/openresty/site/lualib/resty/hmac.so'
        no file '/usr/local/openresty/lualib/resty/hmac.so'
        no file './resty/hmac.so'
        no file '/usr/local/lib/lua/5.1/resty/hmac.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/resty/hmac.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/usr/local/openresty/site/lualib/resty.so'
        no file '/usr/local/openresty/lualib/resty.so'
        no file './resty.so'
        no file '/usr/local/lib/lua/5.1/resty.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/resty.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'

So is there any installation procedure?

jkeys089 commented 2 years ago

https://github.com/jkeys089/lua-resty-hmac#installation

Many openresty folks also use opm

psvz commented 2 years ago

sorry I'm new to lua and opm. I studied the link you provided meticulously before I raised the issue. I couldn't find in that section how to install with opm. I am happy to install your model with opm - what package name I should use?

On a side note, set_hmac_sha256 is a function available in nginx_misc_set module. Is there a possibility to re-use that function as opposed to installing new module? Thanks for your prompt response!

jkeys089 commented 2 years ago

https://opm.openresty.org/search?q=hmac

psvz commented 2 years ago

That was easy! Thanks! might be worthy adding it to your installation section for a next newbie :-)