Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 55949b9

Browse files
jainejaine
authored andcommitted
ci: allow sodium as ed25519 provider
1 parent 39b6e8a commit 55949b9

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
sudo apt-get update
2121
sudo apt-get install -y lua5.4 lua5.4-dev luarocks libsodium-dev
2222
23-
- name: "Install required rocks (Lua 5.4: lua-cjson/luv/lsqlite3/luaossl/sodium/ed25519)"
23+
- name: "Install required rocks (Lua 5.4: lua-cjson/luv/lsqlite3/luaossl/sodium)"
2424
run: |
25-
rocks=(lua-cjson luv lsqlite3 luaossl sodium ed25519)
25+
rocks=(lua-cjson luv lsqlite3 luaossl sodium)
2626
for rock in "${rocks[@]}"; do
2727
luarocks --lua-version=5.4 install --local "$rock" || exit 1
2828
done

scripts/verify/deps_check.lua

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
local deps = {
22
{ name = "luv", mod = "luv" },
3-
{ name = "ed25519", mod = "ed25519" },
43
{ name = "lsqlite3", mod = "lsqlite3" },
54
{ name = "cjson", mod = "cjson.safe" },
65
{ name = "luaossl", mod = "openssl" },
76
{ name = "sodium", mod = "sodium" },
87
}
98

9+
local function require_any(label, modules)
10+
for _, m in ipairs(modules) do
11+
local ok = pcall(require, m)
12+
if ok then
13+
io.stdout:write(string.format("%-10s: available (%s)\n", label, m))
14+
return true
15+
end
16+
end
17+
io.stdout:write(string.format("%-10s: missing\n", label))
18+
return false
19+
end
20+
21+
-- core deps
1022
for _, d in ipairs(deps) do
11-
local ok, _ = pcall(require, d.mod)
12-
io.stdout:write(string.format("%-10s: %s\n", d.name, ok and "available" or "missing"))
13-
if not ok then os.exit(1) end
23+
if not require_any(d.name, { d.mod }) then os.exit(1) end
1424
end
1525

16-
-- Fail-closed if sodium (for ed25519) is missing when signatures are required
26+
-- Ed25519 signer: allow either ed25519 rock or sodium providing crypto_sign_* API
27+
local ed25519_ok = require_any("ed25519", { "ed25519", "sodium" })
28+
if not ed25519_ok then os.exit(1) end
29+
30+
-- Fail-closed if signatures required and no sodium available (used for ed25519)
1731
if os.getenv("AUTH_REQUIRE_SIGNATURE") == "1" then
18-
local ok_sodium, _ = pcall(require, "sodium")
32+
local ok_sodium = pcall(require, "sodium")
1933
if not ok_sodium then
2034
io.stderr:write("sodium module missing but AUTH_REQUIRE_SIGNATURE=1\n")
2135
os.exit(1)

0 commit comments

Comments
 (0)