summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard')
-rwxr-xr-xprotocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard26
1 files changed, 26 insertions, 0 deletions
diff --git a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
new file mode 100755
index 000000000..a6c951f3d
--- /dev/null
+++ b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+ list)
+ json_init
+ json_add_object "generateKeyPair"
+ json_close_object
+ json_dump
+ ;;
+ call)
+ case "$2" in
+ generateKeyPair)
+ prv=$(wg genkey)
+ pub=$(echo $prv | wg pubkey)
+ json_init
+ json_add_object "keys"
+ json_add_string "priv" "$prv"
+ json_add_string "pub" "$pub"
+ json_close_object
+ json_dump
+ ;;
+ esac
+ ;;
+esac