@@ 0,0 1,24 @@
+const util = require('util');
+const pfs = require('fs').promises
+const exec = util.promisify(require('child_process').exec);
+
+async function genkey () {
+ await exec('sudo wg genkey > private')
+ await exec('sudo wg genkey < private > public')
+}
+
+
+if (process.argv[2] === 'genkey') {
+ genkey().then(function () {
+ var keypair = {}
+ pfs.readFile(__dirname + '/private', 'UTF-8').then(privatekey => {
+ console.log(privatekey.substring(0, 44))
+ keypair.privateKey = privatekey.substring(0, 44)
+ pfs.readFile(__dirname + '/public', 'UTF-8').then(publickey => {
+ keypair.publicKey = publickey.substring(0, 44)
+ console.log(keypair)
+ })
+ })
+ })
+}
+