wg-lua/tests/generatePublicKey.luau
Erica Marigold 666a5f79e8
feat: generatePublicKey from base64 string
`Wireguard:generatePublicKey` now accepts the privateKey as a base64 encoded string, which gets decoded internally to produce the raw bytes.
2024-03-31 15:56:34 +05:30

9 lines
358 B
Lua

local wg = require("../out/").wireguard
local PRIVATE_KEY = "iIWrphmeEnCLZFjdN17RQfEq8ND1MX+qAdIpRJdRhEA="
local PUBLIC_KEY = "lYnVoKy9rzIapS0zPoLHskf4B+L3FouFXWwddKhRa3s="
local publicKey = wg:generatePublicKey(PRIVATE_KEY)
assert(#publicKey == 44, "expected public key to be 44 bytes")
assert(publicKey == PUBLIC_KEY, "expected the correct public key")