mirror of
https://github.com/0x5eal/wg-lua.git
synced 2025-12-08 09:31:55 +00:00
A lua implementation of the wireguard keygen algorithm.
| .github/workflows | ||
| .lune | ||
| .vscode | ||
| examples | ||
| src | ||
| tests | ||
| .eslintrc | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| .prettierignore | ||
| .prettierrc | ||
| aftman.toml | ||
| CHANGELOG.md | ||
| LICENSE.md | ||
| lune_require_patch.diff | ||
| lunew | ||
| lunew.bat | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README.md | ||
| tsconfig.json | ||
wg-lua
A lua implementation of the wireguard keygen algorithm.
local wg = require("wg").wireguard
local keypair = wg:generateKeypair()
print("Public Key: ", keypair.publicKey)
print("Private Key: ", keypair.privateKey)
print(wg:generatePublicKey(keypair.privateKey))
Methods
-
Wireguard:generateKeypair() -> { publicKey: string, privateKey: string }
Generates a wireguard keypair consisting of a public and private key.
-
Wireguard:generatePublicKey(privateKey: { number } | string) -> string
Generates a wireguard public key, given a private key.
Development
To get started, install the required dependencies with:
aftman install
pnpm i
Run tests with:
pnpm test
Run any luau file with:
./lunew <path>
Run an example with:
./lunew example <example-name>