A lua implementation of the wireguard keygen algorithm.
Find a file
2024-03-30 12:20:50 +05:30
.github/workflows chore(actions): clone with submodules when needed 2024-03-30 12:20:50 +05:30
.lune chore(actions): include publishing action 2024-03-30 12:10:28 +05:30
.vscode chore(vscode): remove comments to fix failing lint 2024-03-28 16:20:07 +05:30
examples chore(examples): include peer example 2024-03-28 16:53:04 +05:30
src fix(types): fix luau re-export stub logic 2024-03-29 23:33:35 +05:30
tests chore(tests): fix failing generateKeypair test by replacing pattern 2024-03-27 22:37:43 +05:30
.eslintrc chore: include eslint and prettier configs 2024-03-27 16:48:03 +05:30
.gitattributes chore: move .gitattributes to root 2024-03-27 19:19:58 +05:30
.gitignore init: the basics 2024-03-27 16:38:52 +05:30
.gitmodules chore: include build script to bundle compiled files too 2024-03-29 22:26:04 +05:30
.prettierignore chore(actions): add other luau dirs to analyze cmd 2024-03-29 22:26:04 +05:30
.prettierrc refactor: address lint and formatting issues 2024-03-27 17:09:50 +05:30
aftman.toml chore: include examples and runner 2024-03-28 15:57:29 +05:30
CHANGELOG.md chore(pkg): wg-lua v0.1.0 2024-03-30 12:13:37 +05:30
LICENSE.md chore(licensing): license as Apache 2.0 2024-03-27 18:16:05 +05:30
lune_require_patch.diff init: the basics 2024-03-27 16:38:52 +05:30
lunew chore: include examples and runner 2024-03-28 15:57:29 +05:30
lunew.bat chore: include lunew as batch script too 2024-03-28 17:21:13 +05:30
package.json chore(pkg): wg-lua v0.1.0 2024-03-30 12:13:37 +05:30
pnpm-lock.yaml chore: finalize linter and formatter config 2024-03-27 16:55:30 +05:30
README.md chore(README): use luau types for methods 2024-03-29 23:15:57 +05:30
tsconfig.json chore: include build script to bundle compiled files too 2024-03-29 22:26:04 +05:30

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

    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>