mirror of
https://github.com/0x5eal/wg-lua.git
synced 2024-12-12 12:50:36 +00:00
11 lines
443 B
Lua
11 lines
443 B
Lua
local wg = require("../out/").wireguard
|
|
|
|
local BASE64_PAT = "^[%w%+%/=]-=?%w=*$"
|
|
|
|
local keypair = wg:generateKeypair()
|
|
|
|
assert(#keypair.publicKey == 44, "expected public key to be 44 bytes")
|
|
assert(#keypair.privateKey == 44, "expected private key to be 44 bytes")
|
|
|
|
assert(keypair.privateKey:match(BASE64_PAT), "expected private key to be base64 encoded")
|
|
assert(keypair.publicKey:match(BASE64_PAT), "expected public key to be base64 encoded")
|